Commit d0cbcc45 authored by Paolo Borelli's avatar Paolo Borelli
Browse files

Override Table.attach() to behave like pygtk

It is fairly common and even gtk itself still has attach_defaults.
parent 6409d659
......@@ -1097,6 +1097,9 @@ class Table(Gtk.Table, Container):
def __init__(self, rows=1, columns=1, homogeneous=False, **kwds):
Gtk.Table.__init__(self, n_rows=rows, n_columns=columns, homogeneous=homogeneous, **kwds)
def attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions=Gtk.AttachOptions.EXPAND|Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.EXPAND|Gtk.AttachOptions.FILL, xpadding=0, ypadding=0):
Gtk.Table.attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)
Table = override(Table)
__all__.append('Table')
......
......@@ -838,6 +838,10 @@ class TestGtk(unittest.TestCase):
self.assertEquals(table.get_size(), (2,3))
self.assertEquals(table.get_homogeneous(), True)
label = Gtk.Label('Hello')
table.attach(label, 0, 1, 0, 1)
self.assertEquals(label, table.get_children()[0])
def test_scrolledwindow(self):
sw = Gtk.ScrolledWindow()
sb = sw.get_hscrollbar()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment