Skip to content

Commit a1a44de

Browse files
Merge pull request #76 from duynguyenhoang/feature/fix_error_double_switch_workspace
Fix issue when double/triple click to switch workspace
2 parents adb0023 + cc00957 commit a1a44de

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

app.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def _exception_handler(self, loop, context):
5151
return
5252

5353
def __init__(self, config):
54+
self._loading = False
5455
self.config = config
5556
self.workspaces = list(config['workspaces'].items())
5657
self.store = Store(self.workspaces, self.config)
@@ -67,6 +68,7 @@ def __init__(self, config):
6768
self.workspaces_line = None
6869
else:
6970
self.workspaces_line = Workspaces(self.workspaces)
71+
7072
self.columns = urwid.Columns([
7173
('fixed', config['sidebar']['width'], urwid.AttrWrap(sidebar, 'sidebar')),
7274
urwid.AttrWrap(chatbox, 'chatbox')
@@ -88,13 +90,14 @@ def start(self):
8890
self.urwid_loop.run()
8991

9092
def switch_to_workspace(self, workspace_number):
91-
self.sidebar = LoadingSideBar()
92-
self.chatbox = LoadingChatBox('And it becomes worse!')
93-
self._loading = True
94-
self.message_box = None
95-
self.store.switch_to_workspace(workspace_number)
96-
loop.create_task(self.animate_loading())
97-
loop.create_task(self.component_did_mount())
93+
if not self._loading:
94+
self._loading = True
95+
self.sidebar = LoadingSideBar()
96+
self.chatbox = LoadingChatBox('And it becomes worse!')
97+
self.message_box = None
98+
self.store.switch_to_workspace(workspace_number)
99+
loop.create_task(self.animate_loading())
100+
loop.create_task(self.component_did_mount())
98101

99102
@property
100103
def sidebar(self):

0 commit comments

Comments
 (0)