[pygobject] Override Adjustment constructor to behave like pygtk
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Override Adjustment constructor to behave like pygtk
- Date: Thu, 9 Dec 2010 18:30:22 +0000 (UTC)
commit 7924b18a99a0680c04aca46be4b64a7aa507dfe5
Author: Dmitrijs Ledkovs <dmitrij ledkov ubuntu com>
Date: Sat Dec 4 22:13:28 2010 +0000
Override Adjustment constructor to behave like pygtk
https://bugzilla.gnome.org/show_bug.cgi?id=636486
gi/overrides/Gtk.py | 7 +++++++
tests/test_overrides.py | 9 +++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index eb9e132..0313664 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1072,6 +1072,13 @@ class Label(Gtk.Label):
Label = override(Label)
__all__.append('Label')
+class Adjustment(Gtk.Adjustment):
+ def __init__(self, value=None, lower=None, upper=None, step_increment=None, page_increment=None, page_size=None, **kwds):
+ Gtk.Adjustment.__init__(self, value=value, lower=lower, upper=upper, step_increment=step_increment, page_increment=page_increment, page_size=page_size, **kwds)
+
+Adjustment = override(Adjustment)
+__all__.append('Adjustment')
+
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)
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 0e2d976..95c14f6 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -784,6 +784,15 @@ class TestGtk(unittest.TestCase):
label = Gtk.Label('Hello')
self.assertEquals(label.get_text(), 'Hello')
+ def test_adjustment(self):
+ adjustment = Gtk.Adjustment(1, 0, 3, 4, 5, 6)
+ self.assertEquals(adjustment.get_value(),1)
+ self.assertEquals(adjustment.get_lower(),0)
+ self.assertEquals(adjustment.get_upper(),3)
+ self.assertEquals(adjustment.get_step_increment(),4)
+ self.assertEquals(adjustment.get_page_increment(),5)
+ self.assertEquals(adjustment.get_page_size(),6)
+
def test_table(self):
table = Gtk.Table()
self.assertEquals(table.get_size(), (1,1))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]