Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cylc gui: fix remove task after spawn #2013

Merged
merged 1 commit into from
Oct 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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