Skip to content

Commit

Permalink
stub check for updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hausman-gdit committed Jan 30, 2024
1 parent 1230395 commit e7eeb6b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
28 changes: 26 additions & 2 deletions bmds_server/desktop/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"

Expand All @@ -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",
)
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions bmds_server/desktop/config.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[desktop]
directory = c:\bit9prog\dev\bmds-server\logs
file_name = zzz.sqlite3
directory = default
file_name = default

22 changes: 22 additions & 0 deletions bmds_server/desktop/content/app.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit e7eeb6b

Please sign in to comment.