[pygobject/pygobject-2-28] [gi-overrides] use pop instead of del and add extra tests for Gtk.Table kwargs
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-2-28] [gi-overrides] use pop instead of del and add extra tests for Gtk.Table kwargs
- Date: Wed, 16 Feb 2011 20:18:05 +0000 (UTC)
commit ed8710c7aa05cc0c919366536c94bf43955f1b71
Author: John (J5) Palmieri <johnp redhat com>
Date: Wed Feb 16 15:14:35 2011 -0500
[gi-overrides] use pop instead of del and add extra tests for Gtk.Table kwargs
gi/overrides/Gtk.py | 6 ++----
tests/test_overrides.py | 8 ++++++++
2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 543837a..bbca61d 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1144,12 +1144,10 @@ __all__.append('Adjustment')
class Table(Gtk.Table, Container):
def __init__(self, rows=1, columns=1, homogeneous=False, **kwds):
if 'n_rows' in kwds:
- rows = kwds['n_rows']
- del(kwds['n_rows'])
+ rows = kwds.pop('n_rows')
if 'n_columns' in kwds:
- columns = kwds['n_columns']
- del(kwds['n_columns'])
+ columns = kwds.pop('n_columns')
Gtk.Table.__init__(self, n_rows=rows, n_columns=columns, homogeneous=homogeneous, **kwds)
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 766beaf..f25fb07 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1180,6 +1180,14 @@ class TestGtk(unittest.TestCase):
self.assertEquals(table.get_size(), (2,3))
self.assertEquals(table.get_homogeneous(), True)
+ # Test PyGTK interface
+ table = Gtk.Table(rows=3, columns=2)
+ self.assertEquals(table.get_size(), (3,2))
+ # Test using the actual property names
+ table = Gtk.Table(n_rows=2, n_columns=3, homogeneous=True)
+ 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])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]