From 44dd509d5ed33d7bd5b7057d2056b677fe597000 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Sun, 8 Sep 2024 21:35:42 +0100 Subject: [PATCH] Add config for showing/hiding collection browser ons tartup --- .coverage | Bin 53248 -> 53248 bytes docs/CHANGELOG.md | 5 +++++ docs/guide/configuration.md | 1 + docs/guide/index.md | 2 +- src/posting/app.py | 13 +++++-------- src/posting/config.py | 3 +++ 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.coverage b/.coverage index d02e6dc7fdea4c657be3fb3c241bc51d1a82adf7..429d02f815abbdedd7cfd36bcf72fe88084527d0 100644 GIT binary patch delta 1775 zcmY+EdrVVT7{Jf{Zt3gxwzWLk0)0@RAP5wSY={CXTQZ|=nTs(_!Nk{=2)ZSECU9He zs8d9=&gpQ7&b{2`10rUV(K_R@DKeM+Aq%gvCEzksw21;j@7?KH`p3>6=l6ZT?>i^= z+;dw`C+q2C+ftasBdIHy#LHXG2m*H=EmpTN+*$4r*TlW9Yg4yzHM%-(z3vrVA@>4T zp)+zN+IcRWi`V|lskE=D$F=Ktkq`6Z{O{^P{s+F9-=-em*Yj0;0iVemct$g>xuxmW zoYNfDys6o#Db+YN3NFGu;wHIat{eStbldcEDxu7~QO1-tR*|V`E18;2GDcN~fz0p9 z#TsYe5j;EjUdJ;H`DmcKwx@RMt8^1PLY1hhWAapm{{}kl0-?GTkDpj$>caL zT34wRn2pvIbzsDZL@rsK&EP?|# zW@TJ+y-cOjMh~lERBIQHI&q;--;yO@7il&WUyzgvToB#C9oDIEK8X^F^8Z361Ey$#QWHQ5*6_$k$+9tDKvk@~rJrt0z&a7I*T zf8WA()Gd#`1~L-%Sa3SgOS8lQj-5&J59CbZyQ6^#kIaS} z#~xTYY$3*!R&5O)46qiQLb9bcaXWdWhijy%NXk#-K>{R;_;=4NEy2m8Ugx`UsHiF) zn@OB)5$mnNnudxN7Cf`h**R>C?w69!1}hlQ;v|w;lb@PVr^Eo`R^db<63o@**Nb1q z3BH`x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QL(RyJ{M`-{%@>9G;Mc<6F!9(#swG<7GKRhd5yOsKYsS!Iv zCb=oQI4aKY;;=YD{x3u~ufc`no&fLKxWVTy-i`P2#RWF8*_SusJmS-}Lf;#a>J2?C z8HVTjKyVC0wOQ=i7mPQPz;d57M@)BR7+RumTvcK#?Y7-m68OoP!R{_*-R`nP!$6QC>O$h$^}qA8;OFwR7FA^Wdzhx&WD=WNEqy< zDin56hQLnBAgG#+7 ComposeResult: yield AppHeader() yield UrlBar() with AppBody(): - yield CollectionBrowser(collection=self.collection) + collection_browser = CollectionBrowser(collection=self.collection) + collection_browser.display = ( + self.settings.collection_browser.show_on_startup + ) + yield collection_browser yield RequestEditor() yield ResponseArea() yield Footer(show_command_palette=False) @@ -677,13 +681,6 @@ def get_default_screen(self) -> MainScreen: layout=self.settings.layout, environment_files=self.environment_files, ) - if not self.collection_specified: - self.notify( - "Using the default collection directory.", - title="No collection specified", - severity="warning", - timeout=7, - ) return self.main_screen def get_css_variables(self) -> dict[str, str]: diff --git a/src/posting/config.py b/src/posting/config.py index ae0b2cf1..c889965e 100644 --- a/src/posting/config.py +++ b/src/posting/config.py @@ -89,6 +89,9 @@ class CollectionBrowserSettings(BaseModel): position: Literal["left", "right"] = Field(default="left") """The position of the collection browser on screen.""" + show_on_startup: bool = Field(default=True) + """If enabled, the collection browser will be shown on startup.""" + class Settings(BaseSettings): model_config = SettingsConfigDict(