Release v1.0.3
This commit is contained in:
@@ -45,7 +45,6 @@ class SpbtDayPanelApp:
|
||||
value=str(self.repo_root / "data"),
|
||||
)
|
||||
self.show_all_files = pn.widgets.Checkbox(label="Show all files", value=False)
|
||||
self.refresh_button = pn.widgets.Button(label="Refresh")
|
||||
self.file_select = pn.widgets.Select(
|
||||
label="SQLite result file",
|
||||
options={},
|
||||
@@ -85,7 +84,6 @@ class SpbtDayPanelApp:
|
||||
sizing_mode="stretch_width",
|
||||
)
|
||||
|
||||
self.refresh_button.on_click(self.refresh_files)
|
||||
self.calculate_button.on_click(self.calculate)
|
||||
self.directory_input.param.watch(self.refresh_files, "value")
|
||||
self.show_all_files.param.watch(self.refresh_files, "value")
|
||||
@@ -111,7 +109,7 @@ class SpbtDayPanelApp:
|
||||
raise ValueError(f"Selected database path is not a file: {db_path}")
|
||||
return db_path
|
||||
|
||||
def refresh_files(self, *_events: Any) -> None:
|
||||
def refresh_files(self, *_events: Any) -> bool:
|
||||
"""Refresh selectable SQLite files from the configured directory."""
|
||||
try:
|
||||
directory = spbt_day.normalize_directory(
|
||||
@@ -126,7 +124,7 @@ class SpbtDayPanelApp:
|
||||
self.file_select.options = {}
|
||||
self.file_select.value = None
|
||||
self.set_status(str(exc), error=True)
|
||||
return
|
||||
return False
|
||||
|
||||
options = {path.name: str(path) for path in candidates}
|
||||
previous_value = self.file_select.value
|
||||
@@ -142,11 +140,14 @@ class SpbtDayPanelApp:
|
||||
self.set_status(f"Found {len(options):,} file(s) in {directory}.")
|
||||
else:
|
||||
self.set_status(f"No selectable files found in {directory}.")
|
||||
return True
|
||||
|
||||
def calculate(self, *_events: Any) -> None:
|
||||
"""Load selected data and calculate all-pair TheoRet."""
|
||||
self.calculate_button.loading = True
|
||||
try:
|
||||
if not self.refresh_files():
|
||||
return
|
||||
db_path = self.selected_database_path()
|
||||
self.min_pctg_change = float(self.min_pctg_change_input.value)
|
||||
|
||||
@@ -260,7 +261,7 @@ class SpbtDayPanelApp:
|
||||
"""Return the app layout."""
|
||||
controls = pn.Column(
|
||||
"## Inputs",
|
||||
pn.Row(self.directory_input, self.refresh_button),
|
||||
self.directory_input,
|
||||
self.show_all_files,
|
||||
self.file_select,
|
||||
self.min_pctg_change_input,
|
||||
|
||||
Reference in New Issue
Block a user