Skip to content

Commit 7fe5226

Browse files
authored
Fix empty file list and loading spinner in sync file browser (#76)
* Add param trigger so _initialize_path() gets called * Remove loading spinner after file listing is updated
1 parent 660f7a6 commit 7fe5226

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

uit/gui_tools/file_browser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,20 @@ def do_callback(self, changed=True):
286286
def go_home(self):
287287
self.path_text = Path.cwd().as_posix()
288288
self.file_listing = []
289+
self.stop_loading()
289290

290291
def move_up(self):
291292
self.path_text = self.path.parent.as_posix()
292293
self.file_listing = []
294+
self.stop_loading()
293295

294296
@param.depends("file_listing", watch=True)
295297
def move_down(self):
296298
if self.file_listing:
297299
filename = self.file_listing[0]
298300
fn = self.path / filename
299301
self.path_text = fn.as_posix()
302+
self.stop_loading()
300303

301304
@param.depends("path_text", "refresh_control", watch=True)
302305
def validate(self):
@@ -599,6 +602,7 @@ class HpcFileBrowser(FileBrowser):
599602
def __init__(self, uit_client, **params):
600603
params["uit_client"] = uit_client
601604
super().__init__(**params)
605+
self.param.trigger("uit_client") # for _initialize_path()
602606

603607
@property
604608
def controls(self):
@@ -617,11 +621,13 @@ def _initialize_path(self):
617621
def go_home(self):
618622
self.path_text = self._new_path(self.uit_client.HOME).as_posix()
619623
self.file_listing = []
624+
self.stop_loading()
620625

621626
@HpcPath._ensure_connected
622627
def go_to_workdir(self):
623628
self.path_text = self._new_path(self.uit_client.WORKDIR).as_posix()
624629
self.file_listing = []
630+
self.stop_loading()
625631

626632

627633
class AsyncHpcFileBrowser(HpcFileBrowser):

0 commit comments

Comments
 (0)