def __init__(self, file_name, document_path, activity_name, title, bundle=False): RadioToolButton.__init__(self) self._document_path = document_path self._title = title self._jobject = None self._activity_name = activity_name self.props.tooltip = _('Instance Source') settings = Gio.Settings('org.sugarlabs.user') self._color = settings.get_string('color') icon = Icon(file=file_name, pixel_size=style.STANDARD_ICON_SIZE, xo_color=XoColor(self._color)) self.set_icon_widget(icon) icon.show() box = PaletteMenuBox() self.props.palette.set_content(box) box.show() if bundle: menu_item = PaletteMenuItem(_('Duplicate'), 'edit-duplicate', xo_color=XoColor(self._color)) menu_item.connect('activate', self.__show_duplicate_alert) else: menu_item = PaletteMenuItem(_('Keep'), 'document-save', xo_color=XoColor(self._color)) menu_item.connect('activate', self.__keep_in_journal_cb) box.append_item(menu_item) menu_item.show()
def __init__(self, mount_point): RadioToolButton.__init__(self) self.mount_point = mount_point self.drag_dest_set(Gtk.DestDefaults.ALL, [Gtk.TargetEntry.new("journal-object-id", 0, 0)], Gdk.DragAction.COPY) self.connect("drag-data-received", self._drag_data_received_cb)
def __init__(self, abi, abi_signal, do_abi_cb, on_abi_cb=None, **kwargs): RadioToolButton.__init__(self, **kwargs) self._abi_handler = abi.connect(abi_signal, self.__abi_cb, abi_signal, on_abi_cb) self._toggled_handler = self.connect('toggled', self.__toggled_cb, abi, do_abi_cb)
def __init__(self, favorite_view): RadioToolButton.__init__(self) self.props.tooltip = _('Favorites view %d' % (favorite_view + 1)) self.props.accelerator = _('<Ctrl>%d' % (favorite_view + 1)) self.props.group = None self.props.icon_name = desktop.get_view_icons()[favorite_view] favorites_settings = favoritesview.get_settings(favorite_view) self._layout = favorites_settings.layout # someday, this will be a Gtk.Table() layouts_grid = Gtk.HBox() layout_item = None for layoutid, layoutclass in sorted(favoritesview.LAYOUT_MAP.items()): layout_item = RadioToolButton(icon_name=layoutclass.icon_name, group=layout_item, active=False) if layoutid == self._layout: layout_item.set_active(True) layouts_grid.pack_start(layout_item, True, False, 0) layout_item.connect('toggled', self.__layout_activate_cb, layoutid, favorite_view) layouts_grid.show_all() self.props.palette.set_content(layouts_grid)
def __init__(self, cb_object, group): RadioToolButton.__init__(self, group=group) self.props.palette_invoker = FrameWidgetInvoker(self) self.palette_invoker.props.toggle_palette = True self._cb_object = cb_object self.owns_clipboard = False self.props.sensitive = False self.props.active = False self._notif_icon = None self._current_percent = None self._icon = Icon() color = profile.get_color() self._icon.props.xo_color = color self.set_icon_widget(self._icon) self._icon.show() cb_service = clipboard.get_instance() cb_service.connect("object-state-changed", self._object_state_changed_cb) cb_service.connect("object-selected", self._object_selected_cb) child = self.get_child() child.connect("drag_data_get", self._drag_data_get_cb) self.connect("notify::active", self._notify_active_cb)
def __init__(self, file_name, document_path, title, bundle=False): RadioToolButton.__init__(self) self._document_path = document_path self._title = title self._jobject = None self.props.tooltip = _('Instance Source') client = GConf.Client.get_default() self._color = client.get_string('/desktop/sugar/user/color') icon = Icon(file=file_name, icon_size=Gtk.IconSize.LARGE_TOOLBAR, xo_color=XoColor(self._color)) self.set_icon_widget(icon) icon.show() if bundle: menu_item = MenuItem(_('Duplicate')) icon = Icon(icon_name='edit-duplicate', icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color)) menu_item.connect('activate', self.__copy_to_home_cb) else: menu_item = MenuItem(_('Keep')) icon = Icon(icon_name='document-save', icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color)) menu_item.connect('activate', self.__keep_in_journal_cb) menu_item.set_image(icon) self.props.palette.menu.append(menu_item) menu_item.show()
def __init__(self, home_activity, group): RadioToolButton.__init__(self, group=group) self.set_palette_invoker(FrameWidgetInvoker(self)) self.palette_invoker.cache_palette = False self._home_activity = home_activity self._notify_launch_hid = None self._icon = NotificationPulsingIcon() self._icon.props.base_color = home_activity.get_icon_color() self._icon.props.pulse_color = \ XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(), style.COLOR_TOOLBAR_GREY.get_svg())) if home_activity.get_icon_path(): self._icon.props.file = home_activity.get_icon_path() else: # Let's see if the X11 window can give us an icon. window = home_activity.get_window() if not window.get_icon_is_fallback(): pixbuf = window.get_icon() self._icon.pixbuf = pixbuf else: self._icon.props.icon_name = 'image-missing' self.set_icon_widget(self._icon) self._icon.show() if home_activity.props.launch_status == shell.Activity.LAUNCHING: self._icon.props.pulsing = True self._notify_launch_hid = home_activity.connect( 'notify::launch-status', self.__notify_launch_status_cb) elif home_activity.props.launch_status == shell.Activity.LAUNCH_FAILED: self._on_failed_launch()
def __init__(self, file_name, document_path, title, bundle=False): RadioToolButton.__init__(self) self._document_path = document_path self._title = title self._jobject = None self.props.tooltip = _('Instance Source') settings = Gio.Settings('org.sugarlabs.user') self._color = settings.get_string('color') icon = Icon(file=file_name, pixel_size=style.STANDARD_ICON_SIZE, xo_color=XoColor(self._color)) self.set_icon_widget(icon) icon.show() if bundle: menu_item = MenuItem(_('Duplicate')) icon = Icon(icon_name='edit-duplicate', pixel_size=style.SMALL_ICON_SIZE, xo_color=XoColor(self._color)) menu_item.connect('activate', self.__copy_to_home_cb) else: menu_item = MenuItem(_('Keep')) icon = Icon(icon_name='document-save', pixel_size=style.SMALL_ICON_SIZE, xo_color=XoColor(self._color)) menu_item.connect('activate', self.__keep_in_journal_cb) menu_item.set_image(icon) self.props.palette.menu.append(menu_item) menu_item.show()
def __init__(self, cb_object, group): RadioToolButton.__init__(self, group=group) self.props.palette_invoker = FrameWidgetInvoker(self) self.palette_invoker.props.toggle_palette = True self._cb_object = cb_object self.owns_clipboard = False self.props.sensitive = False self.props.active = False self._notif_icon = None self._current_percent = None self._icon = Icon() client = GConf.Client.get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) self._icon.props.xo_color = color self.set_icon_widget(self._icon) self._icon.show() cb_service = clipboard.get_instance() cb_service.connect('object-state-changed', self._object_state_changed_cb) cb_service.connect('object-selected', self._object_selected_cb) child = self.get_child() child.connect('drag_data_get', self._drag_data_get_cb) self.connect('notify::active', self._notify_active_cb)
def __init__(self, file_name, document_path, title, bundle=False): RadioToolButton.__init__(self) self._document_path = document_path self._title = title self._jobject = None self.props.tooltip = _("Instance Source") settings = Gio.Settings("org.sugarlabs.user") self._color = settings.get_string("color") icon = Icon(file=file_name, icon_size=Gtk.IconSize.LARGE_TOOLBAR, xo_color=XoColor(self._color)) self.set_icon_widget(icon) icon.show() if bundle: menu_item = MenuItem(_("Duplicate")) icon = Icon(icon_name="edit-duplicate", icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color)) menu_item.connect("activate", self.__copy_to_home_cb) else: menu_item = MenuItem(_("Keep")) icon = Icon(icon_name="document-save", icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color)) menu_item.connect("activate", self.__keep_in_journal_cb) menu_item.set_image(icon) self.props.palette.menu.append(menu_item) menu_item.show()
def __init__(self, cb_object, group): RadioToolButton.__init__(self, group=group) self.props.palette_invoker = FrameWidgetInvoker(self) self.palette_invoker.props.toggle_palette = True self._cb_object = cb_object self.owns_clipboard = False self.props.sensitive = False self.props.active = False self._notif_icon = None self._current_percent = None self._icon = Icon() color = profile.get_color() self._icon.props.xo_color = color self.set_icon_widget(self._icon) self._icon.show() cb_service = clipboard.get_instance() cb_service.connect('object-state-changed', self._object_state_changed_cb) cb_service.connect('object-selected', self._object_selected_cb) child = self.get_child() child.connect('drag_data_get', self._drag_data_get_cb) self.connect('notify::active', self._notify_active_cb)
def __init__(self, mount_point): RadioToolButton.__init__(self) self.mount_point = mount_point self.drag_dest_set(Gtk.DestDefaults.ALL, [Gtk.TargetEntry.new('journal-object-id', 0, 0)], Gdk.DragAction.COPY) self.connect('drag-data-received', self._drag_data_received_cb)
def __init__(self, icon_name, tool_group, tooltip): RadioToolButton.__init__(self, icon_name=icon_name) self.props.group = tool_group self.set_active(False) self.set_tooltip(tooltip) self.selected_button = None self.palette_invoker.props.toggle_palette = True self.props.hide_tooltip_on_click = False if self.props.palette: self.__palette_cb(None, None) self.menu_box = PaletteMenuBox() self.props.palette.set_content(self.menu_box) self.menu_box.show() self.connect('notify::palette', self.__palette_cb)
def __init__(self, favorite_view): RadioToolButton.__init__(self) self.props.tooltip = desktop.get_favorite_names()[favorite_view] self.props.accelerator = _("<Ctrl>%d" % (favorite_view + 1)) self.props.group = None self.props.icon_name = desktop.get_view_icons()[favorite_view] favorites_settings = favoritesview.get_settings(favorite_view) self._layout = favorites_settings.layout # someday, this will be a Gtk.Table() layouts_grid = Gtk.HBox() layout_item = None for layoutid, layoutclass in sorted(favoritesview.LAYOUT_MAP.items()): layout_item = RadioToolButton(icon_name=layoutclass.icon_name, group=layout_item, active=False) if layoutid == self._layout: layout_item.set_active(True) layouts_grid.pack_start(layout_item, True, False, 0) layout_item.connect("toggled", self.__layout_activate_cb, layoutid, favorite_view) layouts_grid.show_all() self.props.palette.set_content(layouts_grid)
def __init__(self): RadioToolButton.__init__(self) self.props.tooltip = _('Favorites view') self.props.accelerator = _('<Ctrl>1') self.props.group = None favorites_settings = favoritesview.get_settings() self._layout = favorites_settings.layout self._update_icon() # someday, this will be a Gtk.Table() layouts_grid = Gtk.HBox() layout_item = None for layoutid, layoutclass in sorted(favoritesview.LAYOUT_MAP.items()): layout_item = RadioToolButton(icon_name=layoutclass.icon_name, group=layout_item, active=False) if layoutid == self._layout: layout_item.set_active(True) layouts_grid.pack_start(layout_item, True, False, 0) layout_item.connect('toggled', self.__layout_activate_cb, layoutid) layouts_grid.show_all() self.props.palette.set_content(layouts_grid)