From d05c6b40224609dcb5375533ae132388d5973699 Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Tue, 14 May 2013 21:41:46 +0200 Subject: Lib: stick with graph name as a window title (hackish) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- lib.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib.py') diff --git a/lib.py b/lib.py index 56f6fbf..8c3d40f 100644 --- a/lib.py +++ b/lib.py @@ -6,7 +6,7 @@ # (to view a copy, visit http://creativecommons.org/licenses/by-sa/3.0/) """Elements library incl. visual aspects""" -#from sys import path +from sys import path from os.path import expanduser, extsep from pydot import Dot, Edge, Node, Subgraph @@ -299,10 +299,9 @@ def xdot_graph(*args, **kwargs): import gtk import gtk.gdk try: + path[:] = [expanduser('~/wrkspc/goss-medium/jrfonseca.xdot')] + path[:] import xdot except ImportError: - #path.append(expanduser('~/wrkspc/goss-medium/jrfonseca.xdot')) - #import xdot print 'missing xdot; use "pip install xdot" or equivalent' raise @@ -348,7 +347,12 @@ def xdot_graph(*args, **kwargs): self._args = args self._kwargs = kwargs super(LibDotWindow, self).__init__() - self.set_dotcode(gen_graph(*args, **kwargs).to_string()) + dotcode = gen_graph(*args, **kwargs).to_string() + title = dotcode[dotcode.find('digraph', 0, 512) + len('digraph') + : + dotcode.find('{', 0, 512)].strip(' \'"') + self.base_title = title + self.set_dotcode(dotcode) mb = gtk.MenuBar() -- cgit