From 3d862d615ea2665ff65d4b68048889165005922b Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 1 Dec 2013 14:22:49 +0100 Subject: move from Gtk.Grid to Gtk.Table --- ptgui.glade | 34 ++-------------------------------- ptgui.py | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 38 deletions(-) diff --git a/ptgui.glade b/ptgui.glade index f1fc0fa..8170616 100644 --- a/ptgui.glade +++ b/ptgui.glade @@ -163,41 +163,11 @@ True in - + True False - - True - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/ptgui.py b/ptgui.py index 032dbe2..45046e2 100644 --- a/ptgui.py +++ b/ptgui.py @@ -20,7 +20,9 @@ class MainWindow(object): self.wnd = builder.get_object('mainwnd') self.wnd.connect("delete-event", Gtk.main_quit) self.statuslabel = builder.get_object('statuslabel') - self.ctlgrid = builder.get_object('ctlgrid') + tabviewport = builder.get_object('tabviewport') + self.ctlgrid = Gtk.Table() + tabviewport.add(self.ctlgrid) self.printbtn = builder.get_object('printbtn') self.color_fg = builder.get_object('color_fg') self.color_bg = builder.get_object('color_bg') @@ -209,14 +211,38 @@ class MainWindow(object): def layout_put_controls(self): nodes = [self.layout] + rows = -1 while len(nodes) > 0: + rows += 1 # separator node = nodes.pop(0) - nodes.extend(reversed(node.children())) - for p in reversed(node.properties()): + nodes.extend(node.children()) + for p in node.properties(): + rows += 1 + + self.ctlgrid.resize(rows, 2) + + nodes = [self.layout] + row = 0 + first = True + while len(nodes) > 0: + if not first: + hs = Gtk.HSeparator() + self.ctlgrid.attach(hs, 0, 2, row, row + 1, ypadding = 3.0, + xoptions = Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND, yoptions = 0) + row += 1 + first = False + + node = nodes.pop(0) + nodes.extend(node.children()) + for p in node.properties(): elem = self.layout_control(node, p[0], p[1]) - self.ctlgrid.insert_row(0) - self.ctlgrid.attach(Gtk.Label(p[0]), 0, 0, 1, 1) - self.ctlgrid.attach(elem, 1, 0, 1, 1) + lbl = Gtk.Label(p[0]) + lbl.set_alignment(0.0, 0.5) + self.ctlgrid.attach(lbl, 0, 1, row, row + 1, + xoptions = Gtk.AttachOptions.FILL, yoptions = 0) + self.ctlgrid.attach(elem, 1, 2, row, row + 1, + xoptions = Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND, yoptions = 0) + row += 1 def on_print(self, *args): if self.label_surface is None: -- cgit v1.2.1