[pygobject] Override Label constructor to behave like pygtk
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Override Label constructor to behave like pygtk
- Date: Sat, 4 Dec 2010 14:47:49 +0000 (UTC)
commit dfeabe0b68938e27da2e65903983b5113dc422f1
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Dec 4 15:49:15 2010 +0100
Override Label constructor to behave like pygtk
gi/overrides/Gtk.py | 7 +++++++
tests/test_overrides.py | 4 ++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 28f3416..ab4719b 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1044,6 +1044,13 @@ class Button(Gtk.Button, Container):
Button = override(Button)
__all__.append('Button')
+class Label(Gtk.Label):
+ def __init__(self, str=None, **kwds):
+ Gtk.Table.__init__(self, label=str, **kwds)
+
+Label = override(Label)
+__all__.append('Label')
+
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 717e6c2..e7e0632 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -755,6 +755,10 @@ class TestGtk(unittest.TestCase):
text = entry.get_chars(0, 11)
self.assertEquals('Hello World', text)
+ def test_label(self):
+ label = Gtk.Label('Hello')
+ self.assertEquals(label.get_text(), 'Hello')
+
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]