Skip to content

Commit df59aa1

Browse files
committed
refactor: separate dir utils out
1 parent e3cf3fd commit df59aa1

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Diff for: scripts/dataset_manager/dir_utils.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import os
2+
from pathlib import Path
3+
4+
5+
def get_common_directories():
6+
"""Get a list of common directories to choose from."""
7+
common_dirs = [
8+
str(Path.home()),
9+
str(Path.home() / "data"),
10+
str(Path.home() / "workspace"),
11+
]
12+
return [d for d in common_dirs if os.path.exists(d)]

Diff for: scripts/dataset_manager/gui.py

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import asyncio
2-
import os
32
from pathlib import Path
43

54
from dataset_downloader import DatasetDownloader
5+
from dir_utils import get_common_directories
66
from nicegui import ui
77

88

@@ -35,16 +35,6 @@ def __init__(self):
3535

3636
ui.run(host="0.0.0.0", port=8080)
3737

38-
@staticmethod
39-
def get_common_directories():
40-
"""Get a list of common directories to choose from."""
41-
common_dirs = [
42-
str(Path.home()),
43-
str(Path.home() / "data"),
44-
str(Path.home() / "workspace"),
45-
]
46-
return [d for d in common_dirs if os.path.exists(d)]
47-
4838
def update_directory_status(self):
4939
# global status_label, sequence_status_list
5040
"""Update the status information for the current directory."""
@@ -181,9 +171,7 @@ async def download_ground_truth():
181171
# Directory selection section
182172
ui.label("Select Base Directory").classes("text-h6 q-mb-md text-center")
183173
with ui.row().classes("justify-center"):
184-
self.dir_select = ui.select(
185-
options=self.get_common_directories(), label="Select Directory", with_input=True
186-
)
174+
self.dir_select = ui.select(options=get_common_directories(), label="Select Directory", with_input=True)
187175
self.dir_select.props('style="width: 300px"')
188176
self.dir_select.value = str(self.downloader.base_dir)
189177
self.dir_select.on("update:model-value", self.handle_directory_change)

0 commit comments

Comments
 (0)