[pygobject] Add a couple of constructors



commit 017fdfc1dd06259006719e02ffa48883cee01ffd
Author: Johan Dahlin <jdahlin litl com>
Date:   Mon Jun 27 00:39:41 2011 -0300

    Add a couple of constructors
    
    This is for PyGTK compatibility, so that gtk.HBox(True, 2) etc
    works.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653462

 gi/overrides/Gtk.py |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 37cdee1..38afc8c 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -308,6 +308,41 @@ class ComboBox(Gtk.ComboBox, Container):
 ComboBox = override(ComboBox)
 __all__.append('ComboBox')
 
+
+class Box(Gtk.Box):
+    def __init__(self, homogeneous=False, spacing=0):
+        super(Box, self).__init__()
+        self.set_homogeneous(homogeneous)
+        self.set_spacing(spacing)
+
+Box = override(Box)
+__all__.append('Box')
+
+
+class Window(Gtk.Window):
+    def __init__(self, type=Gtk.WindowType.TOPLEVEL):
+        super(Window, self).__init__(type=type)
+
+Window = override(Window)
+__all__.append('Window')
+
+
+class SizeGroup(Gtk.SizeGroup):
+    def __init__(self, mode=Gtk.SizeGroupMode.VERTICAL):
+        super(SizeGroup, self).__init__(mode=mode)
+
+SizeGroup = override(SizeGroup)
+__all__.append('SizeGroup')
+
+
+class MenuItem(Gtk.MenuItem):
+    def __init__(self, label=None):
+        super(MenuItem, self).__init__(label=label)
+
+MenuItem = override(MenuItem)
+__all__.append('MenuItem')
+
+
 class Builder(Gtk.Builder):
 
     def connect_signals(self, obj_or_map):
@@ -1109,6 +1144,11 @@ __all__.append('TreeStore')
 
 class TreeView(Gtk.TreeView, Container):
 
+    def __init__(self, model=None):
+        Gtk.TreeView.__init__(self)
+        if model:
+            self.set_model(model)
+
     def get_path_at_pos(self, x, y):
         success, path, column, cell_x, cell_y = super(TreeView, self).get_path_at_pos(x, y)
         if success:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]