mirror of
https://github.com/ublue-os/forge.git
synced 2025-07-13 21:25:46 +03:00
wip - nicegui progress spinner
This commit is contained in:
parent
75095a841f
commit
dd001f4fe5
2 changed files with 55 additions and 13 deletions
|
@ -74,7 +74,9 @@ class local_file_picker(ui.dialog):
|
|||
if not self.show_hidden_files:
|
||||
paths = [p for p in paths if not p.name.startswith(".")]
|
||||
if self.file_name_filter: # Add this condition
|
||||
paths = [p for p in paths if p.is_file() and p.suffix == self.file_name_filter]
|
||||
paths = [
|
||||
p for p in paths if p.is_file() and p.suffix == self.file_name_filter
|
||||
]
|
||||
paths.sort(key=lambda p: p.name.lower())
|
||||
paths.sort(key=lambda p: not p.is_dir())
|
||||
|
||||
|
@ -114,5 +116,25 @@ class local_file_picker(ui.dialog):
|
|||
self.submit([r["path"] for r in rows])
|
||||
|
||||
|
||||
class progress_spinner(ui.spinner):
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
type: str = "dots",
|
||||
size: str = "lg",
|
||||
color: str | None = "red",
|
||||
thickness: float = 5,
|
||||
) -> None:
|
||||
super().__init__(type, size=size, color=color, thickness=thickness)
|
||||
with self, ui.spinner():
|
||||
self.visible = False
|
||||
|
||||
def enable_progress(self) -> None:
|
||||
self.set_visibility(True)
|
||||
|
||||
def disable_progress(self) -> None:
|
||||
self.set_visibility(False)
|
||||
|
||||
|
||||
def get_project_root() -> Path:
|
||||
return Path(__file__).parent.parent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue