def __init__(self, file_name, document_path, title): 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.ICON_SIZE_LARGE_TOOLBAR, xo_color=XoColor(self._color)) self.set_icon_widget(icon) icon.show() menu_item = MenuItem(_('Keep')) icon = Icon(icon_name='document-save', icon_size=gtk.ICON_SIZE_MENU, xo_color=XoColor(self._color)) menu_item.set_image(icon) menu_item.connect('activate', self.__keep_in_journal_cb) self.props.palette.menu.append(menu_item) menu_item.show()
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.ICON_SIZE_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.ICON_SIZE_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.ICON_SIZE_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 = PulsingIcon() 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: 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, cb_object, group): RadioToolButton.__init__(self, group=group) self.props.palette_invoker = FrameWidgetInvoker(self) 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, 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, mount_point): RadioToolButton.__init__(self) self.mount_point = mount_point self.drag_dest_set(gtk.DEST_DEFAULT_ALL, [('journal-object-id', 0, 0)], gtk.gdk.ACTION_COPY) self.connect('drag-data-received', self._drag_data_received_cb)
def __init__(self, parent, name, icon_name='', callback=None, tooltip=None, group=None): RadioToolButton.__init__(self) if icon_name == '': icon_name = 'computer-xo' icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR) self.set_icon_widget(icon) icon.show() if tooltip is not None: self.set_tooltip(tooltip) self.props.sensitive = True self.connect('clicked', callback) self.set_group(group) self.show() parent.button_dict[name] = self parent.callback_dict[name] = callback
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, fill=False) layout_item.connect('toggled', self.__layout_activate_cb, layoutid) layouts_grid.show_all() self.props.palette.set_content(layouts_grid)
def __init__(self): RadioToolButton.__init__(self) self.props.tooltip = _('Pathway view') self.props.accelerator = _('<Ctrl>3') 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, fill=False) layout_item.connect('toggled', self.__layout_activate_cb, layoutid) layouts_grid.show_all() self.props.palette.set_content(layouts_grid)
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)