[pygobject] Override LinkButton constructor to make 'uri' mandatory
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Override LinkButton constructor to make 'uri' mandatory
- Date: Tue, 7 Dec 2010 19:38:43 +0000 (UTC)
commit 4d8d96326b2cac91e6d75e6601b92e202d1918ff
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Dec 7 20:39:15 2010 +0100
Override LinkButton constructor to make 'uri' mandatory
gi/overrides/Gtk.py | 7 +++++++
tests/test_overrides.py | 6 ++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index c8233e7..c3b5884 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1051,6 +1051,13 @@ class Button(Gtk.Button, Container):
Button = override(Button)
__all__.append('Button')
+class LinkButton(Gtk.LinkButton):
+ def __init__(self, uri, label=None, **kwds):
+ Gtk.LinkButton.__init__(self, uri=uri, label=label, **kwds)
+
+LinkButton = override(LinkButton)
+__all__.append('LinkButton')
+
class Label(Gtk.Label):
def __init__(self, str=None, **kwds):
Gtk.Label.__init__(self, label=str, **kwds)
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 45be0b8..be7693a 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -721,6 +721,12 @@ class TestGtk(unittest.TestCase):
self.assertTrue(button.get_use_stock())
self.assertTrue(button.get_use_underline())
+ # test Gtk.LinkButton
+ self.assertRaises(TypeError, Gtk.LinkButton)
+ button = Gtk.LinkButton('http://www.gtk.org', 'Gtk')
+ self.assertEquals('http://www.gtk.org', button.get_uri())
+ self.assertEquals('Gtk', button.get_label())
+
def test_inheritance(self):
for name in overrides.Gtk.__all__:
over = getattr(overrides.Gtk, name)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]