From e7eeb6b4a8a660cc47cd75c4d907aface532564e Mon Sep 17 00:00:00 2001 From: hausman-gdit Date: Tue, 30 Jan 2024 11:21:37 -0500 Subject: [PATCH] stub check for updates --- bmds_server/desktop/cli.py | 28 ++++++++++++++++++++++++++-- bmds_server/desktop/config.ini | 4 ++-- bmds_server/desktop/content/app.tcss | 22 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/bmds_server/desktop/cli.py b/bmds_server/desktop/cli.py index 80cd5b59..6fe1d0a0 100644 --- a/bmds_server/desktop/cli.py +++ b/bmds_server/desktop/cli.py @@ -97,6 +97,25 @@ def on_button_pressed(self, event: Button.Pressed) -> None: self.app.pop_screen() +class UpdateModal(ModalScreen): + """Screen with a dialog to check for updates.""" + + def compose(self) -> ComposeResult: + yield Grid( + Label( + f"Check for Updates: {version('bmds_server')}", id="modal-update-lbl" + ), + Button("Cancel", variant="primary", id="btn-update-cancel"), + id="update-modal", + ) + + def on_button_pressed(self, event: Button.Pressed) -> None: + # if event.button.id == "btn-modal-quit": + # self.app.exit() + # else: + self.app.pop_screen() + + class FNValidator(Validator): # def describe_failure(self, failure: Failure) -> str | None: # return super().describe_failure(failure) @@ -276,7 +295,7 @@ def zzz_btn(self, event: Button.Pressed) -> None: ) def compose(self) -> ComposeResult: - yield Button("<<", id="path-parent-btn") + # yield Button("<<", id="path-parent-btn") yield Label("Selected Folder:") yield Static( str(get_data_folder()), id="selected-disp", classes="selected-disp" @@ -370,6 +389,7 @@ def compose(self) -> ComposeResult: yield Button("save", id="btn-save-fn", classes="btn-auto save") def create_project(self): + # TODO: update project filename zzz = self.query_one(Input).value zzz = zzz + ".sqlite3" @@ -381,7 +401,7 @@ def create_project(self): config.write(configfile) # update current filename self.notify( - "New project created.", + f"{zzz} : project created.", title="Project Created", severity="information", ) @@ -457,6 +477,7 @@ class BmdsDesktop(App): ("q", "quit", "Quit"), ("d", "toggle_dark", "Toggle dark mode"), ("s", "key_start", "Start/Stop BMDS Desktop"), + ("u", "update_check", "Check for Updates"), ] CSS_PATH = "content/app.tcss" @@ -491,6 +512,9 @@ def action_key_start(self): # didnt work with "shift+s" ?? self.runner.toggle() + def action_update_check(self): + self.push_screen(UpdateModal()) + def on_mount(self) -> None: self.log_app.start() diff --git a/bmds_server/desktop/config.ini b/bmds_server/desktop/config.ini index 9065b2df..6712d1ae 100644 --- a/bmds_server/desktop/config.ini +++ b/bmds_server/desktop/config.ini @@ -1,4 +1,4 @@ [desktop] -directory = c:\bit9prog\dev\bmds-server\logs -file_name = zzz.sqlite3 +directory = default +file_name = default diff --git a/bmds_server/desktop/content/app.tcss b/bmds_server/desktop/content/app.tcss index 63232fa7..7116da70 100644 --- a/bmds_server/desktop/content/app.tcss +++ b/bmds_server/desktop/content/app.tcss @@ -130,4 +130,26 @@ QuitModal { .input-filename { width: 1fr; +} + +UpdateModal { + align: center middle; +} + +#update-modal { + grid-size: 2; + grid-gutter: 1 2; + grid-rows: 1fr 3; + padding: 0 1; + width: 37; + height: 11; + border: thick $background 80%; + background: $surface; +} + +#modal-update-lbl { + column-span: 2; + height: 1fr; + width: 1fr; + content-align: center middle; } \ No newline at end of file