Adding some more hooks for wxxdot.

This commit is contained in:
Jonathan Bohren 2010-05-24 22:35:26 +00:00
parent 04e4ebb7d9
commit b5a713e31d
1 changed files with 12 additions and 2 deletions

View File

@ -167,6 +167,7 @@ class WxDotWindow(wx.Panel):
self.select_cbs = []
self.dc = None
self.ctx = None
self.items_by_url = {}
### User callbacks
def register_select_callback(self, cb):
@ -183,6 +184,7 @@ class WxDotWindow(wx.Panel):
#print dc
ctx = wxcairo.ContextFromDC(dc)
ctx = pangocairo.CairoContext(ctx)
#print "DRAW"
# Get widget size
width, height = self.GetSize()
@ -245,8 +247,6 @@ class WxDotWindow(wx.Panel):
self.reload()
exit(0)
event.Skip()
### Helper functions
def get_current_pos(self):
"""Get the current graph position."""
@ -453,6 +453,16 @@ class WxDotWindow(wx.Panel):
return False
try:
self.set_xdotcode(xdotcode)
# Store references to all the items
self.items_by_url = {}
for item in self.graph.nodes + self.graph.edges:
if item.url is not None:
self.items_by_url[item.url] = item
# Store references to subgraph states
self.subgraph_shapes = self.graph.subgraph_shapes
except ParseError, ex:
print "ERROR PARSING XDOT CODE"
dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,