Commits

Ali Afshar committed b13cd14

some debugging tools

Comments (0)

Files changed (3)

gtkarchitect/utils/__init__.py

Empty file added.

gtkarchitect/utils/debug.py

+
+import gtk
+
+from lxml.etree import tostring
+
+from ..view.base import Slave
+
+class DebugSlave(Slave):
+
+
+    def create_ui(self):
+        t = self.get_toplevel()
+        buttons = gtk.HBox()
+        t.pack_start(buttons, expand=False)
+
+        self.dump_button = gtk.Button('Dump')
+        buttons.pack_start(self.dump_button, expand=False)
+
+    def set_main(self, mainview):
+        self.main = mainview
+
+    def on_dump_button__clicked(self, button):
+        p = self.main.project
+        print p
+        print tostring(p.tree)
+

gtkarchitect/view/main.py

         workspace = Workspace()
         projecttree = ProjectTree()
 
+        vb = gtk.VBox()
+        self.get_toplevel().add(vb)
+
         p = gtk.HPaned()
-        self.get_toplevel().add(p)
+        vb.pack_start(p)
         p.pack1(palette.get_toplevel())
         p2 = gtk.HPaned()
         p.pack2(p2)
         self.palette = palette
         self.workspace = workspace
         self.projecttree = projecttree
-        p.show_all()
+
+        from ..utils.debug import DebugSlave
+        self.debug = DebugSlave()
+        self.debug.set_main(self)
+        vb.pack_start(self.debug.get_toplevel())
+
+        vb.show_all()
 
     def on_palette__entity_selected(self, palette, entity_def):
         if entity_def is not None: