[Sugar-devel] [PATCH Read] Use Box, ButtonBox, Scrollbar instead of his deprecated form

Agustin Zubiaga aguz at sugarlabs.org
Tue Jun 26 21:53:57 EDT 2012


Signed-off-by: Agustin Zubiaga <aguz at sugarlabs.org>
---
 epubview/epubview.py |    9 +++++----
 readactivity.py      |   11 +++++++----
 readdialog.py        |   11 +++++++----
 readsidebar.py       |    6 ++++--
 readtoolbar.py       |    3 ++-
 readtopbar.py        |    5 +++--
 sugarmenuitem.py     |    5 +++--
 7 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/epubview/epubview.py b/epubview/epubview.py
index ea52b5a..2146dd3 100644
--- a/epubview/epubview.py
+++ b/epubview/epubview.py
@@ -35,7 +35,7 @@ LOADING_HTML = '''
 '''
 
 
-class _View(Gtk.HBox):
+class _View(Gtk.Box):
 
     __gproperties__ = {
         'scale': (GObject.TYPE_FLOAT, 'the zoom level',
@@ -51,7 +51,7 @@ class _View(Gtk.HBox):
 
     def __init__(self):
         GObject.threads_init()
-        Gtk.HBox.__init__(self)
+        Gtk.Box.__init__(self)
 
         self.connect("destroy", self._destroy_cb)
 
@@ -94,13 +94,14 @@ class _View(Gtk.HBox):
         self._v_scrollbar_value_changed_cb_id = \
                 self._v_vscrollbar.connect('value-changed', \
                 self._v_scrollbar_value_changed_cb)
-        self._scrollbar = Gtk.VScrollbar()
+        self._scrollbar = Gtk.Scrollbar()
+        self._scrollbar.set_orientation(Gtk.Orientation.VERTICAL)
         self._scrollbar_change_value_cb_id = \
                 self._scrollbar.connect('change-value', \
                 self._scrollbar_change_value_cb)
 
         overlay = Gtk.Overlay()
-        hbox = Gtk.HBox()
+        hbox = Gtk.Box()
         overlay.add(hbox)
         hbox.add(self._sw)
 
diff --git a/readactivity.py b/readactivity.py
index c56c0db..a227c12 100644
--- a/readactivity.py
+++ b/readactivity.py
@@ -252,13 +252,14 @@ class ReadActivity(activity.Activity):
         self.set_toolbar_box(toolbar_box)
         toolbar_box.show()
 
-        self._vbox = Gtk.VBox()
+        self._vbox = Gtk.Box()
+        self._vbox.set_orientation(Gtk.Orientation.VERTICAL)
         self._vbox.show()
 
         self._topbar = TopBar()
         self._vbox.pack_start(self._topbar, False, False, 0)
 
-        self._hbox = Gtk.HBox()
+        self._hbox = Gtk.Box()
         self._hbox.show()
         self._hbox.pack_start(self._sidebar, False, False, 0)
 
@@ -341,7 +342,8 @@ class ReadActivity(activity.Activity):
         back.props.sensitive = False
         palette = back.get_palette()
 
-        vbox_menu = Gtk.VBox()
+        vbox_menu = Gtk.Box()
+        vbox_menu.set_orientation(Gtk.Orientation.VERTICAL)
         previous_page = SugarMenuItem(text_label=_("Previous page"))
         vbox_menu.add(previous_page)
         previous_bookmark = SugarMenuItem(text_label=_("Previous bookmark"))
@@ -363,7 +365,8 @@ class ReadActivity(activity.Activity):
         forward.props.sensitive = False
         palette = forward.get_palette()
 
-        vbox_menu = Gtk.VBox()
+        vbox_menu = Gtk.Box()
+        vbox_menu.set_orientation(Gtk.Orientation.VERTICAL)
         next_page = SugarMenuItem(text_label=_("Next page"))
         vbox_menu.add(next_page)
         next_bookmark = SugarMenuItem(text_label=_("Next bookmark"))
diff --git a/readdialog.py b/readdialog.py
index b6366bf..f859e35 100644
--- a/readdialog.py
+++ b/readdialog.py
@@ -30,7 +30,8 @@ class BaseReadDialog(Gtk.Window):
 
         self._parent_window_xid = parent_xid
 
-        _vbox = Gtk.VBox(spacing=2)
+        _vbox = Gtk.Box(spacing=2)
+        _vbox.set_orientation(Gtk.Orientation.VERTICAL)
         self.add(_vbox)
 
         self.toolbar = Gtk.Toolbar()
@@ -104,8 +105,9 @@ class BookmarkDialog(BaseReadDialog):
         self._sidebarinstance = sidebarinstance
         self._page = page
 
-        vbox = Gtk.VBox()
-        thbox = Gtk.HBox()
+        vbox = Gtk.Box()
+        vbox.set_orientation(Gtk.Orientation.VERTICAL)
+        thbox = Gtk.Box()
         vbox.pack_start(thbox, False, False, 0)
         thbox.set_border_width(style.DEFAULT_SPACING * 2)
         thbox.set_spacing(style.DEFAULT_SPACING)
@@ -131,7 +133,8 @@ class BookmarkDialog(BaseReadDialog):
         if bookmark_title is not None:
             self._title_entry.set_text(bookmark_title)
 
-        cvbox = Gtk.VBox()
+        cvbox = Gtk.Box()
+        cvbox.set_orientation(Gtk.Orientation.VERTICAL)
         vbox.pack_start(cvbox, True, True, 0)
         cvbox.set_border_width(style.DEFAULT_SPACING * 2)
         cvbox.set_spacing(style.DEFAULT_SPACING / 2)
diff --git a/readsidebar.py b/readsidebar.py
index 6990f05..a79a465 100644
--- a/readsidebar.py
+++ b/readsidebar.py
@@ -51,7 +51,8 @@ class Sidebar(Gtk.EventBox):
         # Take care of the background first
         self.modify_bg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color())
 
-        self._box = Gtk.VButtonBox()
+        self._box = Gtk.ButtonBox()
+        self._box.set_orientation(Gtk.Orientation.VERTICAL)
         self._box.set_layout(Gtk.ButtonBoxStyle.CENTER)
         self.add(self._box)
 
@@ -93,7 +94,8 @@ class Sidebar(Gtk.EventBox):
                 % {'user': bookmark.nick.decode('utf-8'),
                 'time': time.decode('utf-8')})
 
-        vbox = Gtk.VBox()
+        vbox = Gtk.Box()
+        vbox.set_orientation(Gtk.Orientation.VERTICAL)
 
         l = Gtk.Label('<big>%s</big>' % tooltip_header)
         l.set_use_markup(True)
diff --git a/readtoolbar.py b/readtoolbar.py
index 55ffd2b..4a08b26 100644
--- a/readtoolbar.py
+++ b/readtoolbar.py
@@ -191,7 +191,8 @@ class ViewToolbar(Gtk.Toolbar):
         self.insert(self._zoom_to_width, -1)
         self._zoom_to_width.show()
 
-        vbox_menu = Gtk.VBox()
+        vbox_menu = Gtk.Box()
+        vbox_menu.set_orientation(Gtk.Orientation.VERTICAL)
         fit_menu = SugarMenuItem(text_label=_('Zoom to fit'))
         fit_menu.connect('clicked', self._zoom_to_fit_menu_item_activate_cb)
         vbox_menu.add(fit_menu)
diff --git a/readtopbar.py b/readtopbar.py
index d0da3d0..b6fe196 100644
--- a/readtopbar.py
+++ b/readtopbar.py
@@ -33,15 +33,16 @@ _UP_DEVICE_IFACE = 'org.freedesktop.UPower.Device'
 _UP_TYPE_BATTERY = 2
 
 
-class _TopBar(Gtk.HBox):
+class _TopBar(Gtk.Box):
     __gproperties__ = {
         'completion-level': (float, None, None, 0.0, 100.0, 0.0,
                              GObject.ParamFlags.WRITABLE),
     }
 
     def __init__(self):
-        Gtk.HBox.__init__(self)
+        Gtk.Box.__init__(self)
 
+        self.set_orientation(Gtk.Orientation.VERTICAL)
         self.set_border_width(int(style.DEFAULT_SPACING / 2.0))
         self.set_spacing(style.DEFAULT_SPACING * 4)
 
diff --git a/sugarmenuitem.py b/sugarmenuitem.py
index 5071406..12127c9 100644
--- a/sugarmenuitem.py
+++ b/sugarmenuitem.py
@@ -30,8 +30,9 @@ class SugarMenuItem(Gtk.EventBox):
     def __init__(self, text_label='', icon_name=None):
         Gtk.EventBox.__init__(self)
         self._sensitive = True
-        vbox = Gtk.VBox()
-        hbox = Gtk.HBox()
+        vbox = Gtk.Box()
+        vbox.set_orientation(Gtk.Orientation.VERTICAL)
+        hbox = Gtk.Box()
         vbox.set_border_width(style.DEFAULT_PADDING)
         if icon_name is not None:
             self.icon = Icon()
-- 
1.7.10.2



More information about the Sugar-devel mailing list