summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2013-12-01 14:22:49 +0100
committerDavid Lamparter <equinox@diac24.net>2013-12-01 14:22:49 +0100
commit3d862d615ea2665ff65d4b68048889165005922b (patch)
treeae274ce560611e48f5b9ce31607e8ab446811c1e
parenta78e2255c43870dad6f0bed5ab582864a08f228e (diff)
move from Gtk.Grid to Gtk.Table
-rw-r--r--ptgui.glade34
-rw-r--r--ptgui.py38
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 @@
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkViewport" id="viewport2">
+ <object class="GtkViewport" id="tabviewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkGrid" id="ctlgrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
+ <placeholder/>
</child>
</object>
</child>
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: