Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-10-30 13:54:53 (GMT)
committer Sascha Silbe <silbe@activitycentral.com>2011-11-22 12:28:56 (GMT)
commit14ea53d1aa75880df6304938677318afde4f3b36 (patch)
tree1f0ccec9833d7fd655462ad9bdaff56b6af939a7
parent0f4db7d23fa68d5d3c1250ed640290df5a7c87cf (diff)
Use GObject constructor for Gtk.Alignment
With PyGTK, all parameters of the Alignment constructor had defaults [1]. With GTK3+pygi, when using the explicit constructor (Alignment.new() resp. gtk_alignment_new() [2]), all values would need to be passed. However when using the GObject constructor, named properties can be passed in instead and we only need to pass those that different from the default. [1] http://developer.gnome.org/pygtk/stable/class-gtkalignment.html#constructor-gtkalignment [2] http://developer.gnome.org/gtk/stable/GtkAlignment.html#gtk-alignment-new [assembled from several patches; replaced description] Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
-rw-r--r--src/sugar3/graphics/alert.py2
-rw-r--r--src/sugar3/graphics/palette.py4
-rw-r--r--src/sugar3/graphics/toolbarbox.py2
-rw-r--r--src/sugar3/graphics/toolbox.py2
-rw-r--r--src/sugar3/graphics/tray.py2
5 files changed, 6 insertions, 6 deletions
diff --git a/src/sugar3/graphics/alert.py b/src/sugar3/graphics/alert.py
index f72a2bd..239afc2 100644
--- a/src/sugar3/graphics/alert.py
+++ b/src/sugar3/graphics/alert.py
@@ -342,7 +342,7 @@ class _TimeoutIcon(Gtk.Alignment):
__gtype_name__ = 'SugarTimeoutIcon'
def __init__(self):
- GObject.GObject.__init__(self, 0, 0, 1, 1)
+ Gtk.Alignment.__init__(self, xalign=0, yalign=0, xscale=1, yscale=1)
self.set_app_paintable(True)
self._text = Gtk.Label()
self._text.set_alignment(0.5, 0.5)
diff --git a/src/sugar3/graphics/palette.py b/src/sugar3/graphics/palette.py
index 6c24d27..b23a28d 100644
--- a/src/sugar3/graphics/palette.py
+++ b/src/sugar3/graphics/palette.py
@@ -67,8 +67,8 @@ class Palette(PaletteWindow):
primary_box.pack_start(self._icon_box, False, True, 0)
labels_box = Gtk.VBox()
- self._label_alignment = Gtk.Alignment.new(xalign=0, yalign=0.5,
- xscale=1, yscale=0.33)
+ self._label_alignment = Gtk.Alignment(xalign=0, yalign=0.5, xscale=1,
+ yscale=0.33)
self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
style.DEFAULT_SPACING)
self._label_alignment.add(labels_box)
diff --git a/src/sugar3/graphics/toolbarbox.py b/src/sugar3/graphics/toolbarbox.py
index 458c2d6..b321715 100644
--- a/src/sugar3/graphics/toolbarbox.py
+++ b/src/sugar3/graphics/toolbarbox.py
@@ -309,7 +309,7 @@ def _setup_page(page_widget, color, hpad):
def _embed_page(box_class, page):
page.show()
- alignment = Gtk.Alignment.new(0.0, 0.0, 1.0, 1.0)
+ alignment = Gtk.Alignment(xscale=1.0, yscale=1.0)
alignment.add(page)
alignment.show()
diff --git a/src/sugar3/graphics/toolbox.py b/src/sugar3/graphics/toolbox.py
index e67ff16..e4e4c32 100644
--- a/src/sugar3/graphics/toolbox.py
+++ b/src/sugar3/graphics/toolbox.py
@@ -65,7 +65,7 @@ class Toolbox(Gtk.VBox):
event_box = Gtk.EventBox()
- alignment = Gtk.Alignment.new(0.0, 0.0, 1.0, 1.0)
+ alignment = Gtk.Alignment(xscale=1.0, yscale=1.0)
alignment.set_padding(0, 0, style.TOOLBOX_HORIZONTAL_PADDING,
style.TOOLBOX_HORIZONTAL_PADDING)
diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py
index 83c59e5..f14569b 100644
--- a/src/sugar3/graphics/tray.py
+++ b/src/sugar3/graphics/tray.py
@@ -175,7 +175,7 @@ class _TrayScrollButton(ToolButton):
icon_size=Gtk.IconSize.SMALL_TOOLBAR)
# The alignment is a hack to work around Gtk.ToolButton code
# that sets the icon_size when the icon_widget is a Gtk.Image
- alignment = Gtk.Alignment.new(0.5, 0.5)
+ alignment = Gtk.Alignment(xalign=0.5, yalign=0.5)
alignment.add(self.icon)
self.set_icon_widget(alignment)
alignment.show_all()