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

Fix gui insert nested family #2603

Merged
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion lib/cylc/gui/updater_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def compare_dict_of_dict(one, two):


class GraphUpdater(threading.Thread):
"""Thread for updating "cylc gui" graph view."""

PREFIX_BASE = 'base:'

def __init__(self, cfg, updater, theme, info_bar, xdot):
super(GraphUpdater, self).__init__()

Expand Down Expand Up @@ -406,7 +410,8 @@ def update_gui(self):
node.attr['color'] = '#888888'
node.attr['fillcolor'] = 'white'
node.attr['fontcolor'] = '#888888'
node.attr['URL'] = 'base:%s' % node.attr['URL']
if not node.attr['URL'].startswith(self.PREFIX_BASE):
node.attr['URL'] = self.PREFIX_BASE + node.attr['URL']

for id_ in self.state_summary:
try:
Expand Down
43 changes: 17 additions & 26 deletions lib/cylc/gui/view_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import re
import gtk
import gobject

Expand Down Expand Up @@ -77,19 +76,6 @@ def toggle_graph_disconnect(self, w, update_button):
def graph_update(self, w):
self.t.action_required = True

def on_url_clicked(self, widget, url, event):
if event.button != 3:
return False

m = re.match('base:(.*)', url)
if m:
# base graph node
task_id = m.groups()[0]
self.right_click_menu(event, task_id, type_='base graph task')
return

self.right_click_menu(event, url, type_='live task')

def on_motion_notify(self, widget, event):
"""Add a new tooltip when the cursor moves in the graph."""
url = self.xdot.widget.get_url(event.x, event.y)
Expand All @@ -103,21 +89,26 @@ def on_motion_notify(self, widget, event):
if url is None:
self.xdot.widget.set_tooltip_text(None)
return False
url = unicode(url.url)
m = re.match('base:(.*)', url)
if m:
task_id = m.groups()[0]
self.xdot.widget.set_tooltip_text(self.t.get_summary(task_id))
return False

# URL is task ID
self.xdot.widget.set_tooltip_text(self.t.get_summary(url))
task_id = unicode(url.url)
if task_id.startswith(self.t.PREFIX_BASE):
# base graph node
task_id = task_id[len(self.t.PREFIX_BASE):]
self.xdot.widget.set_tooltip_text(self.t.get_summary(task_id))
return False

def stop(self):
self.t.quit = True

def right_click_menu(self, event, task_id, type_='live task'):
def on_url_clicked(self, _, task_id, event):
"""Callback on clicking the right hand mouse button."""
if event.button != 3:
return False

is_base = task_id.startswith(self.t.PREFIX_BASE)
if is_base:
# base graph node
task_id = task_id[len(self.t.PREFIX_BASE):]

name, point_string = TaskID.split(task_id)

menu = gtk.Menu()
Expand Down Expand Up @@ -158,7 +149,7 @@ def right_click_menu(self, event, task_id, type_='live task'):
name not in self.t.leaves)
ungroup_rec_item.connect('activate', self.grouping, name, False, True)

if type_ != 'live task':
if is_base:
insert_item = gtk.ImageMenuItem('Insert ...')
img = gtk.image_new_from_stock(gtk.STOCK_DIALOG_INFO,
gtk.ICON_SIZE_MENU)
Expand All @@ -181,7 +172,7 @@ def right_click_menu(self, event, task_id, type_='live task'):
menu.append(ungroup_item)
menu.append(ungroup_rec_item)

if type_ == 'live task':
if not is_base:
is_fam = (name in self.t.descendants)
if is_fam:
if task_id not in self.t.fam_state_summary:
Expand Down