Skip to content

Commit

Permalink
Auto-select the updated routine
Browse files Browse the repository at this point in the history
  • Loading branch information
zhe-slac committed Mar 15, 2024
1 parent fdaf3c0 commit 86f2289
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/badger/gui/default/pages/home_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,16 @@ def create_new_routine(self):
self.routine_editor.switch_mode(self.mode)
self.toggle_lock(True, 0)

def select_routine(self, routine_item: QListWidgetItem):
def select_routine(self, routine_item: QListWidgetItem, force=False):
# force: if True, select the target routine_item even if
# it's selected already
if self.prev_routine_item:
try:
self.routine_list.itemWidget(self.prev_routine_item).deactivate()
except ValueError:
pass

if self.prev_routine_item.routine_name == routine_item.routine_name: #
if (not force) and (self.prev_routine_item.routine_name == routine_item.routine_name):
# click a routine again to deselect
self.prev_routine_item = None
self.current_routine = None
Expand Down Expand Up @@ -457,7 +459,7 @@ def delete_run(self):

def routine_saved(self):
self.refresh_routine_list()
self.select_routine(self.routine_list.item(0))
self.select_routine(self.routine_list.item(0), force=True)
self.tab_state = 0 # force jump to run monitor
self.done_create_routine()

Expand Down

0 comments on commit 86f2289

Please sign in to comment.