From 2f7f95f9af39d51a2a000e02fea69010cc3ce1ce Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Sun, 30 Oct 2011 07:01:32 +0000 Subject: [PATCH] Pass all parameters to Box.pack_start() and ...pack_end() With PyGTK, several Box.pack_{start,end}() parameters had defaults [1,2]. With GTK3+pygi all values must be passed [3,4]. [1] http://developer.gnome.org/pygtk/stable/class-gtkbox.html#method-gtkbox--pack-start [2] http://developer.gnome.org/pygtk/stable/class-gtkbox.html#method-gtkbox--pack-end [3] http://developer.gnome.org/gtk/stable/GtkBox.html#gtk-box-pack-start [4] http://developer.gnome.org/gtk/stable/GtkBox.html#gtk-box-pack-end [assembled from several patches; replaced description] Signed-off-by: Sascha Silbe --- src/sugar3/activity/namingalert.py | 20 +++++++++----------- src/sugar3/graphics/alert.py | 8 ++++---- src/sugar3/graphics/notebook.py | 4 ++-- src/sugar3/graphics/toolcombobox.py | 2 +- src/sugar3/graphics/tray.py | 8 ++++---- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/sugar3/activity/namingalert.py b/src/sugar3/activity/namingalert.py index f1f59096..4dcc12ba 100644 --- a/src/sugar3/activity/namingalert.py +++ b/src/sugar3/activity/namingalert.py @@ -179,11 +179,11 @@ class NamingAlert(gtk.Window): toolbar = NamingToolbar() toolbar.connect('keep-clicked', self.__keep_cb) - vbox.pack_start(toolbar, False) + vbox.pack_start(toolbar, False, False, 0) toolbar.show() body = self._create_body() - vbox.pack_start(body, expand=True, fill=True) + vbox.pack_start(body, True, True, 0) body.show() self._title.grab_focus() @@ -192,26 +192,24 @@ class NamingAlert(gtk.Window): body = gtk.VBox(spacing=style.DEFAULT_SPACING) body.set_border_width(style.DEFAULT_SPACING * 3) header = self._create_header() - body.pack_start(header, expand=False, padding=style.DEFAULT_PADDING) + body.pack_start(header, False, False, style.DEFAULT_PADDING) - body.pack_start(self._create_separator(style.DEFAULT_SPACING), - expand=False) + body.pack_start(self._create_separator(style.DEFAULT_SPACING), False, False, 0) - body.pack_start(self._create_label(_('Description:')), expand=False) + body.pack_start(self._create_label(_('Description:')), False, False, 0) description = self._activity.metadata.get('description', '') description_box, self._description = self._create_text_view(description) - body.pack_start(description_box, expand=True, fill=True) + body.pack_start(description_box, True, True, 0) - body.pack_start(self._create_separator(style.DEFAULT_PADDING), - expand=False) + body.pack_start(self._create_separator(style.DEFAULT_PADDING), False, False, 0) - body.pack_start(self._create_label(_('Tags:')), expand=False) + body.pack_start(self._create_label(_('Tags:')), False, False, 0) tags = self._activity.metadata.get('tags', '') tags_box, self._tags = self._create_text_view(tags) - body.pack_start(tags_box, expand=True, fill=True) + body.pack_start(tags_box, True, True, 0) body.show_all() return body diff --git a/src/sugar3/graphics/alert.py b/src/sugar3/graphics/alert.py index 3d88d2ff..f5a850cd 100644 --- a/src/sugar3/graphics/alert.py +++ b/src/sugar3/graphics/alert.py @@ -104,12 +104,12 @@ class Alert(gtk.EventBox): self._msg_box = gtk.VBox() self._title_label = gtk.Label() self._title_label.set_alignment(0, 0.5) - self._msg_box.pack_start(self._title_label, False) + self._msg_box.pack_start(self._title_label, False, False, 0) self._msg_label = gtk.Label() self._msg_label.set_alignment(0, 0.5) - self._msg_box.pack_start(self._msg_label, False) - self._hbox.pack_start(self._msg_box, False) + self._msg_box.pack_start(self._msg_label, False, False, 0) + self._hbox.pack_start(self._msg_box, False, False, 0) self._buttons_box = gtk.HButtonBox() self._buttons_box.set_layout(gtk.BUTTONBOX_END) @@ -154,7 +154,7 @@ class Alert(gtk.EventBox): elif pspec.name == 'icon': if self._icon != value: self._icon = value - self._hbox.pack_start(self._icon, False) + self._hbox.pack_start(self._icon, False, False, 0) self._hbox.reorder_child(self._icon, 0) def do_get_property(self, pspec): diff --git a/src/sugar3/graphics/notebook.py b/src/sugar3/graphics/notebook.py index 603b7c9a..e1cafcc3 100644 --- a/src/sugar3/graphics/notebook.py +++ b/src/sugar3/graphics/notebook.py @@ -104,8 +104,8 @@ class Notebook(gtk.Notebook): tab_button.show() tab_label.show() - tab_box.pack_start(tab_label, True) - tab_box.pack_start(tab_button, True) + tab_box.pack_start(tab_label, True, False, 0) + tab_box.pack_start(tab_button, True, False, 0) tab_box.show_all() event_box.add(tab_box) diff --git a/src/sugar3/graphics/toolcombobox.py b/src/sugar3/graphics/toolcombobox.py index 8d161f5b..4b60b385 100644 --- a/src/sugar3/graphics/toolcombobox.py +++ b/src/sugar3/graphics/toolcombobox.py @@ -43,7 +43,7 @@ class ToolComboBox(gtk.ToolItem): hbox = gtk.HBox(False, style.DEFAULT_SPACING) self.label = gtk.Label(self._label_text) - hbox.pack_start(self.label, False) + hbox.pack_start(self.label, False, False, 0) self.label.show() if combo: diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py index a6fb08d2..de603171 100644 --- a/src/sugar3/graphics/tray.py +++ b/src/sugar3/graphics/tray.py @@ -233,14 +233,14 @@ class HTray(gtk.HBox): gobject.GObject.__init__(self, **kwargs) scroll_left = _TrayScrollButton('go-left', _PREVIOUS_PAGE) - self.pack_start(scroll_left, False) + self.pack_start(scroll_left, False, False, 0) self._viewport = _TrayViewport(gtk.ORIENTATION_HORIZONTAL) self.pack_start(self._viewport) self._viewport.show() scroll_right = _TrayScrollButton('go-right', _NEXT_PAGE) - self.pack_start(scroll_right, False) + self.pack_start(scroll_right, False, False, 0) scroll_left.viewport = self._viewport scroll_right.viewport = self._viewport @@ -319,14 +319,14 @@ class VTray(gtk.VBox): gobject.GObject.__init__(self, **kwargs) scroll_up = _TrayScrollButton('go-up', _PREVIOUS_PAGE) - self.pack_start(scroll_up, False) + self.pack_start(scroll_up, False, False, 0) self._viewport = _TrayViewport(gtk.ORIENTATION_VERTICAL) self.pack_start(self._viewport) self._viewport.show() scroll_down = _TrayScrollButton('go-down', _NEXT_PAGE) - self.pack_start(scroll_down, False) + self.pack_start(scroll_down, False, False, 0) scroll_up.viewport = self._viewport scroll_down.viewport = self._viewport