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

Signed-off-by: Simon Schampijer <simon@schampijer.de>
[assembled from several patches; replaced description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
master
Simon Schampijer 13 years ago
parent c82a775267
commit 20319cb3c4

@ -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)

@ -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)

@ -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()

@ -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)

@ -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()

Loading…
Cancel
Save