def __init__(self, **kwargs):
        ToolButton.__init__(self, **kwargs)
        self.selected_button = None

        if self.props.palette:
            self.__palette_cb(None, None)

        self.connect("notify::palette", self.__palette_cb)
    def __init__(self, **kwargs):
        ToolButton.__init__(self, **kwargs)
        self.selected_button = None

        if self.props.palette:
            self.__palette_cb(None, None)

        self.connect('notify::palette', self.__palette_cb)
Exemplo n.º 3
0
    def __init__(self, activity, **kwargs):
        ToolButton.__init__(self, **kwargs)

        icon = _create_activity_icon(activity.metadata)
        self.set_icon_widget(icon)
        icon.show()

        self.props.tooltip = activity.metadata['title']
        activity.metadata.connect('updated', self.__jobject_updated_cb)
Exemplo n.º 4
0
    def __init__(self, activity, **kwargs):
        ToolButton.__init__(self, **kwargs)

        icon = _create_activity_icon(activity.metadata)
        self.set_icon_widget(icon)
        icon.show()

        self.props.tooltip = activity.metadata['title']
        activity.metadata.connect('updated', self.__jobject_updated_cb)
Exemplo n.º 5
0
    def __init__(self, activity, abi):
        ToolButton.__init__(self, 'document-save')
        self.props.tooltip = _('Export')
        self.props.label = _('Export')

        for i in self._EXPORT_FORMATS:
            menu_item = MenuItem(i['title'])
            menu_item.connect('activate', self.__activate_cb, activity, abi, i)
            self.props.palette.menu.append(menu_item)
            menu_item.show()
Exemplo n.º 6
0
    def __init__(self, page=None, **kwargs):
        ToolButton.__init__(self, **kwargs)

        self.page_widget = None

        self.set_page(page)

        self.connect('clicked',
                     lambda widget: self.set_expanded(not self.is_expanded()))
        self.connect('size-allocate', self.__size_allocate_cb)
Exemplo n.º 7
0
    def __init__(self, activity, abi):
        ToolButton.__init__(self, "document-save")
        self.props.tooltip = _("Export")
        self.props.label = _("Export")

        for i in self._EXPORT_FORMATS:
            menu_item = MenuItem(i["title"])
            menu_item.connect("activate", self.__activate_cb, activity, abi, i)
            self.props.palette.menu.append(menu_item)
            menu_item.show()
Exemplo n.º 8
0
    def __init__(self, activity, **kwargs):
        ToolButton.__init__(self, **kwargs)
        self.props.tooltip = _('Keep')
        self.props.accelerator = '<Ctrl>S'

        color = profile.get_color()
        keep_icon = Icon(icon_name='document-save', xo_color=color)
        keep_icon.show()

        self.set_icon_widget(keep_icon)
        self.connect('clicked', self.__keep_button_clicked_cb, activity)
Exemplo n.º 9
0
    def __init__(self, page=None, **kwargs):
        ToolButton.__init__(self, **kwargs)

        self.page_widget = None

        self.set_page(page)

        self.connect('clicked',
                     lambda widget: self.set_expanded(not self.is_expanded()))

        self.connect('hierarchy-changed', self.__hierarchy_changed_cb)
Exemplo n.º 10
0
    def __init__(self, page=None, **kwargs):
        ToolButton.__init__(self, **kwargs)

        self.page_widget = None

        self.set_page(page)

        self.connect('clicked',
                lambda widget: self.set_expanded(not self.is_expanded()))

        self.connect('hierarchy-changed', self.__hierarchy_changed_cb)
Exemplo n.º 11
0
    def __init__(self, activity, **kwargs):
        ToolButton.__init__(self, **kwargs)
        logging.warning('KeepButton has been deprecated since Sugar 0.94'
                        ' and should not be used in newly written code.')
        self.props.tooltip = _('Keep')
        self.props.accelerator = '<Ctrl>S'

        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        keep_icon = Icon(icon_name='document-save', xo_color=color)
        keep_icon.show()

        self.set_icon_widget(keep_icon)
        self.connect('clicked', self.__keep_button_clicked_cb, activity)
Exemplo n.º 12
0
    def __init__(self, activity, **kwargs):
        ToolButton.__init__(self, **kwargs)
        logging.warning('KeepButton has been deprecated since Sugar 0.94'
                        ' and should not be used in newly written code.')
        self.props.tooltip = _('Keep')
        self.props.accelerator = '<Ctrl>S'

        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        keep_icon = Icon(icon_name='document-save', xo_color=color)
        keep_icon.show()

        self.set_icon_widget(keep_icon)
        self.connect('clicked', self.__keep_button_clicked_cb, activity)
Exemplo n.º 13
0
    def __init__(self):
        ToolButton.__init__(self)

        self._property = 'timestamp'
        self._order = gtk.SORT_ASCENDING

        self.props.tooltip = _('Sort view')
        self.props.icon_name = 'view-lastedit'

        for property_, icon, label in self._SORT_OPTIONS:
            button = MenuItem(icon_name=icon, text_label=label)
            button.connect('activate', self.__sort_type_changed_cb, property_,
                           icon)
            button.show()
            self.props.palette.menu.insert(button, -1)
Exemplo n.º 14
0
    def __init__(self, file_transfer):
        ToolButton.__init__(self)

        self.file_transfer = file_transfer
        file_transfer.connect('notify::state', self.__notify_state_cb)

        icon = Icon()
        self.props.icon_widget = icon
        icon.show()

        self.notif_icon = NotificationIcon()
        self.notif_icon.connect('button-release-event',
                                 self.__button_release_event_cb)

        self.connect('clicked', self.__button_clicked_cb)
Exemplo n.º 15
0
    def __init__(self, device):
        ToolButton.__init__(self)

        self._bus = dbus.SystemBus()
        self._device = device
        self._device_props = None
        self._flags = 0
        self._ssid = ''
        self._display_name = ''
        self._mode = network.NM_802_11_MODE_UNKNOWN
        self._strength = 0
        self._frequency = 0
        self._device_state = None
        self._color = None
        self._active_ap_op = None

        self._icon = PulsingIcon()
        self._icon.props.icon_name = get_icon_state('network-wireless', 0)
        self._inactive_color = xocolor.XoColor(
            '%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
                       style.COLOR_TRANSPARENT.get_svg()))
        self._icon.props.pulse_color = self._inactive_color
        self._icon.props.base_color = self._inactive_color

        self.set_icon_widget(self._icon)
        self._icon.show()

        self.set_palette_invoker(FrameWidgetInvoker(self))
        self._palette = WirelessPalette(self._display_name)
        self._palette.connect('deactivate-connection',
                              self.__deactivate_connection_cb)
        self.set_palette(self._palette)
        self._palette.set_group_id('frame')

        self._device_props = dbus.Interface(self._device,
                                            dbus.PROPERTIES_IFACE)
        self._device_props.GetAll(network.NM_DEVICE_IFACE, byte_arrays=True,
                              reply_handler=self.__get_device_props_reply_cb,
                              error_handler=self.__get_device_props_error_cb)

        self._device_props.Get(network.NM_WIRELESS_IFACE, 'ActiveAccessPoint',
                               reply_handler=self.__get_active_ap_reply_cb,
                               error_handler=self.__get_active_ap_error_cb)

        self._bus.add_signal_receiver(self.__state_changed_cb,
                                      signal_name='StateChanged',
                                      path=self._device.object_path,
                                      dbus_interface=network.NM_DEVICE_IFACE)
Exemplo n.º 16
0
 def __init__(self,jobject=None):
     LicenseWidget.__init__(self,"#ffffff,#ffffff")
     self._jobject = jobject
     if jobject:
         self._color_selected = XoColor(self._jobject.metadata['icon-color'])
     else:
         self._color_selected = profile.get_color()
     default, license = self.load_license()
     icon_name = self.uri_to_icon(license)
     ToolButton.__init__(self)
     icon = Icon(icon_name,icon_size=self._icon_size,xo_color=XoColor("#ffffff,#ffffff"))
     icon.show()
     self.set_icon_widget(icon)
     self.props.sensitive = True
     self.set_tooltip(self._format_tooltip(license))
     self.make_menu(self.get_palette(),XoColor("#ffffff,#ffffff"),self._color_selected,icon_name)
Exemplo n.º 17
0
    def __init__(self, icon_name, text, cb, help_cb=None, alt_html=''):
        ToolButton.__init__(self)

        if _icon_exists(icon_name):
            self.set_icon(icon_name)
        else:
            if alt_html == '':
                alt_html = icon_name

            label = gtk.Label()
            label.set_markup(alt_html)
            label.show()
            self.set_label_widget(label)

        self.create_palette(text, help_cb)

        self.connect('clicked', cb)
Exemplo n.º 18
0
    def __init__(self):
        ToolButton.__init__(self)

        self._property = 'timestamp'
        self._order = gtk.SORT_ASCENDING

        self.props.tooltip = _('Sort view')
        self.props.icon_name = 'view-lastedit'

        for property_, icon, label in self._SORT_OPTIONS:
            button = MenuItem(icon_name=icon, text_label=label)
            button.connect('activate',
                           self.__sort_type_changed_cb,
                           property_,
                           icon)
            button.show()
            self.props.palette.menu.insert(button, -1)
Exemplo n.º 19
0
    def __init__(self, icon_name, scroll_direction):
        ToolButton.__init__(self)
        self._viewport = None

        self._scroll_direction = scroll_direction

        self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)

        self.icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR)
        # The alignment is a hack to work around gtk.ToolButton code
        # that sets the icon_size when the icon_widget is a gtk.Image
        alignment = gtk.Alignment(0.5, 0.5)
        alignment.add(self.icon)
        self.set_icon_widget(alignment)
        alignment.show_all()

        self.connect("clicked", self._clicked_cb)
Exemplo n.º 20
0
    def __init__(self, icon_name, scroll_direction):
        ToolButton.__init__(self)
        self._viewport = None

        self._scroll_direction = scroll_direction

        self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)

        self.icon = Icon(icon_name=icon_name,
                         icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR)
        # The alignment is a hack to work around gtk.ToolButton code
        # that sets the icon_size when the icon_widget is a gtk.Image
        alignment = gtk.Alignment(0.5, 0.5)
        alignment.add(self.icon)
        self.set_icon_widget(alignment)
        alignment.show_all()

        self.connect('clicked', self._clicked_cb)
Exemplo n.º 21
0
 def __init__(self, toolbar, name, uri):
     self._name = name
     self._uri = uri
     self._toolbar = toolbar
     self._browser = toolbar._activity._browser
 
     # set up the button
     ToolButton.__init__(self, 'bookmarklet')
     self.connect('clicked', self.__clicked_cb)
     toolbar.insert(self, -1)
     
     # and its palette
     palette = Palette(name, text_maxlen=50)
     self.set_palette(palette)
     
     menu_item = gtk.MenuItem(_('Remove'))
     menu_item.connect('activate', self.__remove_cb)
     palette.menu.append(menu_item)
     menu_item.show()
     
     self.show()
Exemplo n.º 22
0
    def __init__(self, device, state):
        ToolButton.__init__(self)

        self._bus = dbus.SystemBus()
        self._device = device
        self._device_props = None
        self._device_state = None
        self._channel = 0

        self._icon = PulsingIcon(icon_name=self._ICON_NAME)
        self._inactive_color = xocolor.XoColor(
            '%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
                       style.COLOR_TRANSPARENT.get_svg()))
        self._icon.props.pulse_color = profile.get_color()
        self._icon.props.base_color = self._inactive_color

        self.set_icon_widget(self._icon)
        self._icon.show()

        self.set_palette_invoker(FrameWidgetInvoker(self))
        title = _('Mesh Network')
        self._palette = WirelessPalette(glib.markup_escape_text(title))
        self._palette.connect('deactivate-connection',
                              self.__deactivate_connection)
        self.set_palette(self._palette)
        self._palette.set_group_id('frame')

        self.update_state(state)

        self._device_props = dbus.Interface(self._device,
                                            dbus.PROPERTIES_IFACE)
        self._device_props.Get(network.NM_OLPC_MESH_IFACE, 'ActiveChannel',
                            reply_handler=self.__get_active_channel_reply_cb,
                            error_handler=self.__get_active_channel_error_cb)

        self._bus.add_signal_receiver(self.__wireless_properties_changed_cb,
                                      signal_name='PropertiesChanged',
                                      path=device.object_path,
                                      dbus_interface=network.NM_OLPC_MESH_IFACE)
Exemplo n.º 23
0
    def __init__(self, invite):
        ToolButton.__init__(self)

        self._invite = invite

        self.connect('clicked', self.__clicked_cb)
        self.connect('destroy', self.__destroy_cb)

        bundle_registry = bundleregistry.get_registry()
        bundle = bundle_registry.get_bundle(invite.get_bundle_id())

        self._icon = Icon()
        self._icon.props.xo_color = invite.get_color()
        if bundle is not None:
            self._icon.props.file = bundle.get_icon()
        else:
            self._icon.props.icon_name = 'image-missing'
        self.set_icon_widget(self._icon)
        self._icon.show()

        palette = InvitePalette(invite)
        palette.props.invoker = FrameWidgetInvoker(self)
        palette.set_group_id('frame')
        palette.connect('remove-invite', self.__remove_invite_cb)
        self.set_palette(palette)

        self._notif_icon = NotificationIcon()
        self._notif_icon.connect('button-release-event',
                                 self.__button_release_event_cb)

        self._notif_icon.props.xo_color = invite.get_color()
        if bundle is not None:
            self._notif_icon.props.icon_filename = bundle.get_icon()
        else:
            self._notif_icon.props.icon_name = 'image-missing'

        frame = jarabe.frame.get_view()
        frame.add_notification(self._notif_icon, gtk.CORNER_TOP_LEFT)
Exemplo n.º 24
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-redo', **kwargs)
     self.props.tooltip = _('Redo')
Exemplo n.º 25
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-paste', **kwargs)
     self.props.tooltip = _('Paste')
     self.props.accelerator = '<Ctrl>V'
Exemplo n.º 26
0
 def __init__(self, activity, **kwargs):
     ToolButton.__init__(self, 'score_card', **kwargs)
     self.props.tooltip = _('Score Card')
     self.connect('clicked', self.__show_score_win, activity)
Exemplo n.º 27
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'journal-import', **kwargs)
     self.props.tooltip = _('Restore Journal').encode('utf-8')
     self.props.accelerator = '<Alt>r'
Exemplo n.º 28
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'back', **kwargs)
     self.props.tooltip = _('Back')
     self.props.accelerator = '<Alt>Left'
Exemplo n.º 29
0
 def __init__(self, activity, **kwargs):
     ToolButton.__init__(self, 'activity-stop', **kwargs)
     self.props.tooltip = _('Stop')
     self.props.accelerator = '<Ctrl>Q'
     self.connect('clicked', self.__stop_button_clicked_cb, activity)
Exemplo n.º 30
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-copy', **kwargs)
     self.props.tooltip = _('Copy')
     self.props.accelerator = '<Ctrl>C'
Exemplo n.º 31
0
 def __init__(self, activity, **kwargs):
     ToolButton.__init__(self, "dialog-apply", **kwargs)
     self.props.tooltip = _("Score Card")
     self.props.accelerator = "<Ctrl>Q"
     self.connect("clicked", self.__show_score_win, activity)
Exemplo n.º 32
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'journal-export', **kwargs)
     self.props.tooltip = _('Backup Journal').encode('utf-8')
     self.props.accelerator = '<Alt>b'
Exemplo n.º 33
0
 def __init__(self, activity, **kwargs):
     ToolButton.__init__(self, 'scorestats', **kwargs)
     self.props.tooltip = _('Score Stats')
     self.connect('clicked', self.draw_score_chart)
Exemplo n.º 34
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-copy', **kwargs)
     self.props.tooltip = _('Copy')
     self.props.accelerator = '<Ctrl>C'
Exemplo n.º 35
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-paste', **kwargs)
     self.props.tooltip = _('Paste')
     self.props.accelerator = '<Ctrl>V'
Exemplo n.º 36
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-copy', **kwargs)
     self.props.tooltip = _('Copy')
Exemplo n.º 37
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, "back", **kwargs)
     self.props.tooltip = _("Back")
     self.props.accelerator = "<Alt>Left"
Exemplo n.º 38
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-paste', **kwargs)
     self.props.tooltip = _('Paste')
Exemplo n.º 39
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-undo', **kwargs)
     self.props.tooltip = _('Undo')
     self.props.accelerator = '<Ctrl>Z'
Exemplo n.º 40
0
 def __init__(self):
     ToolButton.__init__(self)
Exemplo n.º 41
0
 def __init__(self, activity, **kwargs):
     ToolButton.__init__(self, 'activity-stop', **kwargs)
     self.props.tooltip = _('Stop')
     self.props.accelerator = '<Ctrl>Q'
     self.connect('clicked', self.__stop_button_clicked_cb, activity)
Exemplo n.º 42
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-undo', **kwargs)
     self.props.tooltip = _('Undo')
     self.props.accelerator = '<Ctrl>Z'
Exemplo n.º 43
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, 'edit-redo', **kwargs)
     self.props.tooltip = _('Redo')
Exemplo n.º 44
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, **kwargs)
Exemplo n.º 45
0
 def __init__(self):
     ToolButton.__init__(self)
Exemplo n.º 46
0
 def __init__(self, **kwargs):
     ToolButton.__init__(self, **kwargs)