Skip to content

Commit

Permalink
Merge pull request #2013 from matthewrmshin/fix-gui-remove-task-spawn
Browse files Browse the repository at this point in the history
cylc gui: fix remove task after spawn
  • Loading branch information
oliver-sanders authored Oct 10, 2016
2 parents c71bf19 + 7aa36be commit 9df6af3
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions lib/cylc/gui/app_gcylc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,17 +1461,16 @@ def get_right_click_menu(self, task_ids, t_states, task_is_family=False):

remove_item.set_image(img)
menu.append(remove_item)
remove_item.connect('activate', self.remove_task, task_ids,
task_is_family)
remove_item.connect('activate', self.remove_tasks, task_ids, True)

# Remove without spawning.
remove_nospawn_item = gtk.ImageMenuItem('Remove without spawning')
img = gtk.image_new_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_MENU)

remove_nospawn_item.set_image(img)
menu.append(remove_nospawn_item)
remove_nospawn_item.connect('activate', self.remove_task_nospawn,
task_ids, task_is_family)
remove_nospawn_item.connect(
'activate', self.remove_tasks, task_ids, False)

menu.show_all()
return menu
Expand Down Expand Up @@ -1735,28 +1734,17 @@ def reset_task_state(self, b, e, task_ids, state, is_family=False):
self.put_comms_command('reset_task_states', items=task_ids,
state=state)

def remove_task(self, b, task_ids, is_family):
"""Remove a task."""
if type(task_ids) is not list:
task_ids = [task_ids]

for task_id in task_ids:
if not self.get_confirmation(
"Remove %s after spawning?" % task_id):
return
name, point_string = TaskID.split(task_id)
self.put_comms_command('remove_task', task_ids, spawn=True)

def remove_task_nospawn(self, b, task_ids, is_family=False):
"""Remove a task, without spawn."""
if type(task_ids) is not list:
def remove_tasks(self, b, task_ids, spawn):
"""Send command to suite to remove tasks matching task_ids."""
if not isinstance(task_ids, list):
task_ids = [task_ids]

for task_id in task_ids:
if not self.get_confirmation(
"Remove %s without spawning?" % task_id):
return
self.put_comms_command('remove_tasks', task_ids, spawn=False)
if spawn:
message = "Remove %s after spawning?"
else:
message = "Remove %s without spawning?"
if not self.get_confirmation(message % task_ids):
return
self.put_comms_command('remove_tasks', items=task_ids, spawn=spawn)

def stopsuite_popup(self, b):
window = gtk.Window()
Expand Down

0 comments on commit 9df6af3

Please sign in to comment.