diff options
Diffstat (limited to 'src/view.py')
-rwxr-xr-x | src/view.py | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/src/view.py b/src/view.py index b2dceb8..acb3862 100755 --- a/src/view.py +++ b/src/view.py @@ -7,10 +7,11 @@ Checks for updates to activities and installs them.""" from __future__ import with_statement from __future__ import division -import gi -gi.require_version('Gtk', '3.0') -import gtk, gobject -Gdk.threads_init() +from gi.repository import Gtk +from gi.repository import Gdk +from gi.repository import GLib +from gi.repository import GObject +GLib.threads_init() import gettext import os @@ -21,7 +22,7 @@ import gettext _ = lambda msg: gettext.dgettext('sugar-update-control', msg) import bitfrost.update.actutils as actutils -from sugar.graphics import style +from sugar3.graphics import style from jarabe.controlpanel.sectionview import SectionView from jarabe.controlpanel.inlinealert import InlineAlert @@ -31,8 +32,8 @@ from model import _humanize_size, _svg2pixbuf, inhibit_suspend # COMPATIBILITY HACK: work around trac #8532 by forcibly removing the # SIGCHLD handler (and the necessity for one) -import sugar.activity.activityfactory -if hasattr(sugar.activity.activityfactory, '_sigchild_handler'): +import sugar3.activity.activityfactory +if hasattr(sugar3.activity.activityfactory, '_sigchild_handler'): from ctypes import CDLL, Structure, c_voidp, c_int, c_ulong, pointer import signal libc = CDLL("libc.so.6") @@ -121,7 +122,7 @@ class ActivityListView(Gtk.ScrolledWindow): # create the TreeViewColumn to display the data def view_func_maker(propname): - def view_func(cell_layout, renderer, m, it): + def view_func(cell_layout, renderer, m, it, user_data=None): renderer.set_property(propname, not m.get_value(it, model.IS_HEADER)) return view_func @@ -131,12 +132,12 @@ class ActivityListView(Gtk.ScrolledWindow): self.column_install.add_attribute(crbool, 'active', model.UPDATE_SELECTED) self.column_install.set_cell_data_func(crbool, hide_func) self.column = Gtk.TreeViewColumn('Name') - self.column.pack_start(cricon, False, True, 0) - self.column.pack_start(crtext, True, True, 0) + self.column.pack_start(cricon, False) + self.column.pack_start(crtext, True) self.column.add_attribute(cricon, 'pixbuf', model.ACTIVITY_ICON) self.column.set_resizable(True) self.column.set_cell_data_func(cricon, hide_func) - def markup_func(cell_layout, renderer, m, it): + def markup_func(cell_layout, renderer, m, it, user_data): s = '<b>%s</b>' % _e(m.get_value(it, model.DESCRIPTION_BIG)) if m.get_value(it, model.IS_HEADER): s = '<big>%s</big>' % s @@ -216,17 +217,19 @@ class GroupListView(Gtk.VBox): self.groupview.set_rules_hint(True) self.groupview.set_enable_search(False) self.groupview.set_reorderable(False) # we'll write own DnD funcs below - TARGETS = Gtk.target_list_add_text_targets(info=0) - TARGETS = Gtk.target_list_add_uri_targets(list=TARGETS, info=1) - self.groupview.enable_model_drag_source( Gdk.ModifierType.BUTTON1_MASK, - TARGETS, - Gdk.DragAction.DEFAULT - |Gdk.DragAction.COPY - |Gdk.DragAction.MOVE) - self.groupview.enable_model_drag_dest(TARGETS, - Gdk.DragAction.DEFAULT - |Gdk.DragAction.COPY - |Gdk.DragAction.MOVE) + # FIXME: port to GTK3 + #TARGETS = Gtk.TargetList() + #TARGETS.add_text_targets(0) + #TARGETS.add_uri_targets(1) + #self.groupview.enable_model_drag_source( Gdk.ModifierType.BUTTON1_MASK, + # TARGETS, + # Gdk.DragAction.DEFAULT + # |Gdk.DragAction.COPY + # |Gdk.DragAction.MOVE) + #self.groupview.enable_model_drag_dest(TARGETS, + # Gdk.DragAction.DEFAULT + # |Gdk.DragAction.COPY + # |Gdk.DragAction.MOVE) def drag_data_get_data(groupview, context, drag_selection, target_id, etime): selection = groupview.get_selection() m, it = selection.get_selected() @@ -437,7 +440,7 @@ class ProgressPane(Gtk.VBox): (self.refresh_button, activity_updater.refresh_cb), (self.try_again_button, activity_updater.refresh_cb)]: widget.connect('clicked', cb, activity_updater) - hbox.pack_start(widget, expand=True, fill=False) + hbox.pack_start(widget, True, False, 0) self.pack_start(self.icon, True, True, 0) self.pack_start(self.bar, True, True, 0) @@ -515,7 +518,7 @@ class ActivityUpdater(SectionView): bottom_label.set_markup(_('Software updates correct errors, eliminate security vulnerabilities, and provide new features.')) vbox2 = Gtk.VBox() vbox2.pack_start(self.top_label, False, True, 0) - vbox2.pack_start(Gtk.HSeparator(, True, True, 0), expand=False) + vbox2.pack_start(Gtk.HSeparator(), False, False, 0) vbox2.pack_start(bottom_label, True, True, 0) self.pack_start(vbox2, False, True, 0) @@ -526,7 +529,7 @@ class ActivityUpdater(SectionView): # progress pane ########### self.progress_pane = ProgressPane(self) - self.pack_start(self.progress_pane, expand=True, fill=False) + self.pack_start(self.progress_pane, True, False, 0) # special little extension to progress pane. self.expander = Gtk.Expander(label=_('Modify activity groups')) @@ -545,7 +548,7 @@ class ActivityUpdater(SectionView): def download_cb(self, widget, event, data=None): """Invoked when the 'ok' button is clicked.""" - from sugar.bundle.activitybundle import ActivityBundle + from sugar3.bundle.activitybundle import ActivityBundle self.top_label.set_markup('<big>%s</big>' % _('Downloading updates...')) self.progress_pane.switch_to_download_progress() |