Example #1
0
    def __init__(self, invite):
        Palette.__init__(self, '')

        self._invite = invite

        menu_item = MenuItem(_('Join'), icon_name='dialog-ok')
        menu_item.connect('activate', self.__join_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        menu_item = MenuItem(_('Decline'), icon_name='dialog-cancel')
        menu_item.connect('activate', self.__decline_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        bundle_id = invite.get_bundle_id()

        registry = bundleregistry.get_registry()
        self._bundle = registry.get_bundle(bundle_id)
        if self._bundle:
            name = self._bundle.get_name()
        else:
            name = bundle_id

        self.set_primary_text(glib.markup_escape_text(name))
    def __init__(self, **kwargs):
        self._color = gtk.gdk.Color(0, 0, 0)
        self._previous_color = self._color.copy()
        self._scales = None

        Palette.__init__(self, **kwargs)

        self.connect('popup', self.__popup_cb)
        self.connect('popdown', self.__popdown_cb)

        self._picker_hbox = gtk.HBox()
        self.set_content(self._picker_hbox)

        self._swatch_tray = gtk.Table()

        self._picker_hbox.pack_start(self._swatch_tray)
        self._picker_hbox.pack_start(gtk.VSeparator(),
                                     padding=style.DEFAULT_SPACING)
        
        self._chooser_table = gtk.Table(3, 2)
        self._chooser_table.set_col_spacing(0, style.DEFAULT_PADDING)

        self._scales = []
        self._scales.append(
            self._create_color_scale(_('Red'), self._RED, 0))
        self._scales.append(
            self._create_color_scale(_('Green'), self._GREEN, 1))
        self._scales.append(
            self._create_color_scale(_('Blue'), self._BLUE, 2))

        self._picker_hbox.add(self._chooser_table)
        
        self._picker_hbox.show_all()

        self._build_swatches()
Example #3
0
    def __init__(self, **kwargs):
        self._color = gtk.gdk.Color(0, 0, 0)
        self._previous_color = self._color.copy()
        self._scales = None

        Palette.__init__(self, **kwargs)

        self.connect('popup', self.__popup_cb)
        self.connect('popdown', self.__popdown_cb)

        self._picker_hbox = gtk.HBox()
        self.set_content(self._picker_hbox)

        self._swatch_tray = gtk.Table()

        self._picker_hbox.pack_start(self._swatch_tray)
        self._picker_hbox.pack_start(gtk.VSeparator(),
                                     padding=style.DEFAULT_SPACING)

        self._chooser_table = gtk.Table(3, 2)
        self._chooser_table.set_col_spacing(0, style.DEFAULT_PADDING)

        self._scales = []
        self._scales.append(self._create_color_scale(_('Red'), self._RED, 0))
        self._scales.append(
            self._create_color_scale(_('Green'), self._GREEN, 1))
        self._scales.append(self._create_color_scale(_('Blue'), self._BLUE, 2))

        self._picker_hbox.add(self._chooser_table)

        self._picker_hbox.show_all()

        self._build_swatches()
Example #4
0
    def __init__(self, mount):
        Palette.__init__(self, label=mount.get_name())
        self._mount = mount

        path = mount.get_root().get_path()
        self.props.secondary_text = glib.markup_escape_text(path)

        vbox = gtk.VBox()
        self.set_content(vbox)
        vbox.show()

        self._progress_bar = gtk.ProgressBar()
        vbox.add(self._progress_bar)
        self._progress_bar.show()

        self._free_space_label = gtk.Label()
        self._free_space_label.set_alignment(0.5, 0.5)
        vbox.add(self._free_space_label)
        self._free_space_label.show()

        self.connect('popup', self.__popup_cb)

        menu_item = MenuItem(pgettext('Volume', 'Remove'))

        icon = Icon(icon_name='media-eject', icon_size=gtk.ICON_SIZE_MENU)
        menu_item.set_image(icon)
        icon.show()

        menu_item.connect('activate', self.__unmount_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
Example #5
0
    def __init__(self, primary_text):
        Palette.__init__(self, label=primary_text)

        self._disconnect_item = None

        self._channel_label = gtk.Label()
        self._channel_label.props.xalign = 0.0
        self._channel_label.show()

        self._ip_address_label = gtk.Label()

        self._info = gtk.VBox()

        def _padded(child, xalign=0, yalign=0.5):
            padder = gtk.Alignment(xalign=xalign, yalign=yalign,
                                   xscale=1, yscale=0.33)
            padder.set_padding(style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING)
            padder.add(child)
            return padder

        self._info.pack_start(_padded(self._channel_label))
        self._info.pack_start(_padded(self._ip_address_label))
        self._info.show_all()

        self._disconnect_item = MenuItem(_('Disconnect'))
        icon = Icon(icon_size=gtk.ICON_SIZE_MENU, icon_name='media-eject')
        self._disconnect_item.set_image(icon)
        self._disconnect_item.connect('activate',
                                      self.__disconnect_activate_cb)
        self.menu.append(self._disconnect_item)
Example #6
0
    def __init__(self, mount):
        Palette.__init__(self, label=mount.get_name())
        self._mount = mount

        path = mount.get_root().get_path()
        self.props.secondary_text = glib.markup_escape_text(path)

        vbox = gtk.VBox()
        self.set_content(vbox)
        vbox.show()

        self._progress_bar = gtk.ProgressBar()
        vbox.add(self._progress_bar)
        self._progress_bar.show()

        self._free_space_label = gtk.Label()
        self._free_space_label.set_alignment(0.5, 0.5)
        vbox.add(self._free_space_label)
        self._free_space_label.show()

        self.connect('popup', self.__popup_cb)

        menu_item = MenuItem(pgettext('Volume', 'Remove'))

        icon = Icon(icon_name='media-eject', icon_size=gtk.ICON_SIZE_MENU)
        menu_item.set_image(icon)
        icon.show()

        menu_item.connect('activate', self.__unmount_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
Example #7
0
    def __init__(self):
        label = glib.markup_escape_text(_('Wired Network'))
        Palette.__init__(self, primary_text=label)

        self._speed_label = gtk.Label()
        self._speed_label.props.xalign = 0.0
        self._speed_label.show()

        self._ip_address_label = gtk.Label()

        self._info = gtk.VBox()

        def _padded(child, xalign=0, yalign=0.5):
            padder = gtk.Alignment(xalign=xalign, yalign=yalign,
                                   xscale=1, yscale=0.33)
            padder.set_padding(style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING)
            padder.add(child)
            return padder

        self._info.pack_start(_padded(self._speed_label))
        self._info.pack_start(_padded(self._ip_address_label))
        self._info.show_all()

        self.set_content(self._info)
        self.props.secondary_text = glib.markup_escape_text(_('Connected'))
Example #8
0
    def __init__(self, url):
        Palette.__init__(self, url)

        self.url = url_check_protocol(url)

        menu_item = MenuItem(_('Copy to Clipboard'), 'edit-copy')
        menu_item.connect('activate', self._copy_to_clipboard_cb)
        self.menu.append(menu_item)
        menu_item.show()
Example #9
0
    def __init__(self, url):
        Palette.__init__(self, url)

        self.owns_clipboard = False
        self.url = _url_check_protocol(url)

        menu_item = MenuItem(_('Copy to Clipboard'), 'edit-copy')
        menu_item.connect('activate', self._copy_to_clipboard_cb)
        self.menu.append(menu_item)
        menu_item.show()
Example #10
0
    def __init__(self, buddy):
        self._buddy = buddy

        nick, colors = buddy
        buddy_icon = Icon(icon_name='computer-xo',
                          icon_size=style.STANDARD_ICON_SIZE,
                          xo_color=XoColor(colors))

        Palette.__init__(self, primary_text=glib.markup_escape_text(nick),
                         icon=buddy_icon)
Example #11
0
    def __init__(self, file_transfer):
        Palette.__init__(self, glib.markup_escape_text(file_transfer.title))

        self.file_transfer = file_transfer

        self.progress_bar = None
        self.progress_label = None
        self._notify_transferred_bytes_handler = None

        self.connect('popup', self.__popup_cb)
        self.connect('popdown', self.__popdown_cb)
    def __init__(self, label, tree):
        Palette.__init__(self, label)
        self.tree = tree

        background = gtk.VBox()
        self.set_content(background)

        default_view = gtk.RadioButton()
        default_view.props.label = _('Default list view')
        default_view.connect('clicked', self._listview_cb, 'default')
        background.pack_start(default_view)

        for type, props in sorted(TRAITS.items(),
                cmp=lambda x, y: cmp(x[1]['title'], y[1]['title'])):
            i = gtk.RadioButton()
            i.props.label = props['title']
            i.props.group = default_view
            background.pack_start(i)
            if type == this.config['list_type']:
                i.props.active = True
            i.connect('clicked', self._listview_cb, type)

        separator = gtk.Label(' ')
        background.pack_start(separator)

        self.expander = gtk.Expander(_('Columns'))

        # XXX suppress gtk artifacts during the second showing
        # if expander was expanded/unexpanded before
        expander_box = gtk.EventBox()
        expander_box.add(self.expander)
        background.pack_start(expander_box)

        self.model = gtk.ListStore(bool, str)
        self.view = gtk.TreeView(self.model)
        self.view.props.headers_visible = False
        self.expander.add(self.view)

        cell = gtk.CellRendererToggle()
        cell.props.activatable = True
        cell.props.cell_background_gdk = style.COLOR_BLACK.get_gdk_color()
        cell.connect('toggled', self._toggled_cb)
        self.view.insert_column_with_attributes(0, '', cell, active=0)

        cell = gtk.CellRendererText()
        cell.props.cell_background_gdk = style.COLOR_BLACK.get_gdk_color()
        cell.props.foreground_gdk = style.COLOR_WHITE.get_gdk_color()
        self.view.insert_column_with_attributes(1, '', cell, text=1)

        background.show_all()

        self.connect('popup', self._popup_cb)
        self.connect('popdown', self._popdown_cb)
Example #13
0
    def __init__(self, home_activity):
        Palette.__init__(self)

        self._notify_launch_hid = None

        if home_activity.props.launch_status == shell.Activity.LAUNCHING:
            self._notify_launch_hid = home_activity.connect( \
                    'notify::launch-status', self.__notify_launch_status_cb)
            self.set_primary_text(glib.markup_escape_text(_('Starting...')))
        elif home_activity.props.launch_status == shell.Activity.LAUNCH_FAILED:
            self._on_failed_launch()
        else:
            self.setup_palette()
Example #14
0
    def __init__(self, home_activity):
        Palette.__init__(self)

        self._notify_launch_hid = None

        if home_activity.props.launch_status == shell.Activity.LAUNCHING:
            self._notify_launch_hid = home_activity.connect( \
                    'notify::launch-status', self.__notify_launch_status_cb)
            self.set_primary_text(glib.markup_escape_text(_('Starting...')))
        elif home_activity.props.launch_status == shell.Activity.LAUNCH_FAILED:
            self._on_failed_launch()
        else:
            self.setup_palette()
Example #15
0
    def __init__(self):
        label = glib.markup_escape_text(_('Wireless modem'))
        Palette.__init__(self, primary_text=label)

        self._current_state = None
        self._failed_connection = False

        self._toggle_state_item = MenuItem('')
        self._toggle_state_item.connect('activate', self.__toggle_state_cb)
        self.menu.append(self._toggle_state_item)
        self._toggle_state_item.show()

        self.info_box = gtk.VBox()

        self.error_title_label = gtk.Label("")
        self.error_title_label.set_alignment(0, 0.5)
        self.error_title_label.set_line_wrap(True)
        self.info_box.pack_start(self.error_title_label)
        self.error_description_label = gtk.Label("")
        self.error_description_label.set_alignment(0, 0.5)
        self.error_description_label.set_line_wrap(True)
        self.info_box.pack_start(self.error_description_label)

        self.connection_info_box = gtk.HBox()
        icon = Icon(icon_name='data-upload', icon_size=gtk.ICON_SIZE_MENU)
        self.connection_info_box.pack_start(icon)
        icon.show()

        self._data_label_up = gtk.Label()
        self._data_label_up.props.xalign = 0.0
        label_alignment = self._add_widget_with_padding(self._data_label_up)
        self.connection_info_box.pack_start(label_alignment)
        self._data_label_up.show()
        label_alignment.show()

        icon = Icon(icon_name='data-download', icon_size=gtk.ICON_SIZE_MENU)
        self.connection_info_box.pack_start(icon)
        icon.show()
        self._data_label_down = gtk.Label()
        self._data_label_down.props.xalign = 0.0
        label_alignment = self._add_widget_with_padding(self._data_label_down)
        self.connection_info_box.pack_start(label_alignment)
        self._data_label_down.show()
        label_alignment.show()

        self.info_box.pack_start(self.connection_info_box)

        self.info_box.show()
        self.set_content(self.info_box)

        self.set_state(_GSM_STATE_NOT_READY)
Example #16
0
    def __init__(self, primary_text, manager):
        Palette.__init__(self, label=primary_text)

        self._manager = manager
        self._manager.connect('play', self._set_menu_state, 'play')
        self._manager.connect('stop', self._set_menu_state, 'stop')
        self._manager.connect('pause', self._set_menu_state, 'pause')

        vbox = gtk.VBox()
        self.set_content(vbox)

        self._play_icon = Icon(icon_name='player_play')
        self._pause_icon = Icon(icon_name='player_pause')
        self._play_pause_menu = MenuItem(text_label=_('Say selected text'))
        self._play_pause_menu.set_image(self._play_icon)
        self._play_pause_menu.connect('activate', self.__play_activated_cb)
        self._play_pause_menu.show()

        self._stop_menu = MenuItem(icon_name='player_stop',
                text_label=_('Stop playback'))
        self._stop_menu.connect('activate', self.__stop_activated_cb)
        self._stop_menu.set_sensitive(False)
        self._stop_menu.show()

        self.menu.append(self._play_pause_menu)
        self.menu.append(self._stop_menu)

        self._adj_pitch = gtk.Adjustment(value=self._manager.get_pitch(),
                                          lower=self._manager.MIN_PITCH,
                                          upper=self._manager.MAX_PITCH)
        self._hscale_pitch = gtk.HScale(self._adj_pitch)
        self._hscale_pitch.set_draw_value(False)

        vbox.pack_start(gtk.Label(_('Pitch')), padding=style.DEFAULT_PADDING)
        vbox.pack_start(self._hscale_pitch)

        self._adj_rate = gtk.Adjustment(value=self._manager.get_rate(),
                                          lower=self._manager.MIN_RATE,
                                          upper=self._manager.MAX_RATE)
        self._hscale_rate = gtk.HScale(self._adj_rate)
        self._hscale_rate.set_draw_value(False)

        vbox.pack_start(gtk.Label(_('Rate')), padding=style.DEFAULT_PADDING)
        vbox.pack_start(self._hscale_rate)
        vbox.show_all()

        self._adj_pitch.connect('value_changed', self.__adj_pitch_changed_cb)
        self._adj_rate.connect('value_changed', self.__adj_rate_changed_cb)
Example #17
0
    def __init__(self, mount):
        Palette.__init__(self, glib.markup_escape_text(_('Journal')))
        vbox = gtk.VBox()
        self.set_content(vbox)
        vbox.show()

        self._progress_bar = gtk.ProgressBar()
        vbox.add(self._progress_bar)
        self._progress_bar.show()

        self._free_space_label = gtk.Label()
        self._free_space_label.set_alignment(0.5, 0.5)
        vbox.add(self._free_space_label)
        self._free_space_label.show()

        self.connect('popup', self.__popup_cb)
    def __init__(self, mount):
        Palette.__init__(self, glib.markup_escape_text(_('Journal')))
        vbox = gtk.VBox()
        self.set_content(vbox)
        vbox.show()

        self._progress_bar = gtk.ProgressBar()
        vbox.add(self._progress_bar)
        self._progress_bar.show()

        self._free_space_label = gtk.Label()
        self._free_space_label.set_alignment(0.5, 0.5)
        vbox.add(self._free_space_label)
        self._free_space_label.show()

        self.connect('popup', self.__popup_cb)
Example #19
0
    def __init__(self, primary_text, icon):
        """ Create the palette and initilize with current touchpad status. """
        Palette.__init__(self, label=primary_text)

        self._icon = icon

        vbox = gtk.VBox()
        self.set_content(vbox)

        self._status_text = gtk.Label()
        vbox.pack_start(self._status_text, padding=style.DEFAULT_PADDING)
        self._status_text.show()

        vbox.show()

        self._mode = _read_touchpad_mode()
        self._update()
Example #20
0
    def __init__(self):
        Palette.__init__(self, _('Root'))

        self.connect('popup', self._popup_cb)

        box = gtk.VBox()
        self.set_content(box)

        self.radio = [None] * 3

        self.radio[0] = gtk.RadioButton(self.radio[0], _('Hide local objects'))
        box.pack_start(self.radio[0])

        self.radio[1] = gtk.RadioButton(self.radio[0],
                                        _('Show all local objects'))
        box.pack_start(self.radio[1])

        self.radio[2] = gtk.RadioButton(self.radio[0])
        box.pack_start(self.radio[2])

        separator = gtk.Label()
        box.pack_start(separator)

        self.setup = gtk.Button(_('Add current path to filter'))
        self.setup.connect('clicked', self._setup_cb)
        setup_box = gtk.HBox()
        setup_box.pack_start(self.setup, False)
        box.pack_start(setup_box)

        box.show_all()

        self.config = model.this['path']
        for tag_type, tag, name in self.config['root_path']:
            button = _create_button(name)
            this.last_root.append([tag_type, tag, [button]])
        this.pos = self.config['root_type']
        self.radio[this.pos].props.active = True
        model.local_source.set_active(this.pos)
        if this.pos == 2:
            this.root = [] + this.last_root
        _query(None, this.pos)

        self.radio[0].connect('toggled', self._non_filter_cb, 0, False)
        self.radio[1].connect('toggled', self._non_filter_cb, 1, True)
        self.radio[2].connect('toggled', self._filter_cb)
    def __init__(self, editor):
        Palette.__init__(self, _('Pronounce text during tile flip'))

        self.face = speak.face.View()

        toolbar = gtk.HBox()
        toolbar.modify_bg(gtk.STATE_NORMAL, style.COLOR_BLACK.get_gdk_color())

        usespeak_play = ToolButton(icon_name='media-playback-start')
        usespeak_play.connect('clicked', lambda button:
                self.face.say(editor.get_text()))
        toolbar.pack_start(usespeak_play, False)

        self.voices = speak.widgets.Voices(self.face)
        toolbar.pack_start(ToolComboBox(self.voices))

        toolbar.show_all()
        self.set_content(toolbar)
Example #22
0
    def __init__(self, primary_text):
        Palette.__init__(self, primary_text)
        self._level = 0
        self._time = 0
        self._status = _STATUS_NOT_PRESENT
        self._progress_bar = gtk.ProgressBar()
        self._progress_bar.set_size_request(
            style.zoom(style.GRID_CELL_SIZE * 4), -1)
        self._progress_bar.show()
        self._status_label = gtk.Label()
        self._status_label.show()

        vbox = gtk.VBox()
        vbox.pack_start(self._progress_bar)
        vbox.pack_start(self._status_label)
        vbox.show()

        self._progress_widget = vbox
        self.set_content(self._progress_widget)
Example #23
0
    def __init__(self, buddy):
        self._buddy = buddy

        buddy_icon = Icon(icon_name='computer-xo',
                          xo_color=buddy.get_color(),
                          icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
        nick = buddy.get_nick()
        Palette.__init__(self, None,
                         primary_text=glib.markup_escape_text(nick),
                         icon=buddy_icon)
        self._invite_menu = None
        self._active_activity_changed_hid = None
        self.connect('destroy', self.__destroy_cb)

        self._buddy.connect('notify::nick', self.__buddy_notify_nick_cb)

        if buddy.is_owner():
            self._add_my_items()
        else:
            self._add_buddy_items()
Example #24
0
    def __init__(self):
        Palette.__init__(self, _('Tag sidebar'))

        box = gtk.VBox()
        self.set_content(box)

        pos = 2 * [None]

        pos[0] = gtk.RadioButton(None, _('On the left side'))
        pos[0].connect('clicked', self._cb, 0)
        box.pack_start(pos[0])

        pos[1] = gtk.RadioButton(pos[0], _('On the right side'))
        pos[1].connect('clicked', self._cb, 1)
        box.pack_start(pos[1])

        saved_pos = this.config['sidebar_separator']
        pos[this.config['sidebar_position']].props.active = True
        this.workspace.props.position = saved_pos

        box.show_all()
Example #25
0
    def __init__(self, buddy):
        self._buddy = buddy

        buddy_icon = Icon(icon_name='computer-xo',
                          xo_color=buddy.get_color(),
                          icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
        nick = buddy.get_nick()
        Palette.__init__(self,
                         None,
                         primary_text=glib.markup_escape_text(nick),
                         icon=buddy_icon)
        self._invite_menu = None
        self._active_activity_changed_hid = None
        self.connect('destroy', self.__destroy_cb)

        self._buddy.connect('notify::nick', self.__buddy_notify_nick_cb)

        if buddy.is_owner():
            self._add_my_items()
        else:
            self._add_buddy_items()
Example #26
0
    def __init__(self, activity_info):
        self._activity_info = activity_info

        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        activity_icon = Icon(file=activity_info.get_icon(),
                             xo_color=color,
                             icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)

        name = activity_info.get_name()
        Palette.__init__(self, primary_text=glib.markup_escape_text(name),
                         icon=activity_icon)

        xo_color = XoColor('%s,%s' % (style.COLOR_WHITE.get_svg(),
                                      style.COLOR_TRANSPARENT.get_svg()))
        menu_item = MenuItem(text_label=_('Start new'),
                             file_name=activity_info.get_icon(),
                             xo_color=xo_color)
        menu_item.connect('activate', self.__start_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
Example #27
0
    def __init__(self, primary_text, model):
        Palette.__init__(self, label=primary_text)

        self._model = model

        vbox = gtk.VBox()
        self.set_content(vbox)
        vbox.show()

        vol_step = sound.VOLUME_STEP
        self._adjustment = gtk.Adjustment(value=self._model.props.level,
                                          lower=0,
                                          upper=100 + vol_step,
                                          step_incr=vol_step,
                                          page_incr=vol_step,
                                          page_size=vol_step)
        self._hscale = gtk.HScale(self._adjustment)
        self._hscale.set_digits(0)
        self._hscale.set_draw_value(False)
        vbox.add(self._hscale)
        self._hscale.show()

        self._mute_item = MenuItem('')
        self._mute_icon = Icon(icon_size=gtk.ICON_SIZE_MENU)
        self._mute_item.set_image(self._mute_icon)
        self.menu.append(self._mute_item)
        self._mute_item.show()

        self._adjustment_handler_id = \
            self._adjustment.connect('value_changed',
                                     self.__adjustment_changed_cb)

        self._model_notify_level_handler_id = \
            self._model.connect('notify::level', self.__level_changed_cb)
        self._model.connect('notify::muted', self.__muted_changed_cb)

        self._mute_item.connect('activate', self.__mute_activate_cb)

        self.connect('popup', self.__popup_cb)
Example #28
0
    def __init__(self, browser, title, url, owner_document):
        Palette.__init__(self)

        self._browser = browser
        self._title = title
        self._url = url
        self._owner_document = owner_document
        
        if title is not None:
            self.props.primary_text = title
            self.props.secondary_text = url
        else:
            self.props.primary_text = url

        menu_item = MenuItem(_('Follow link'), 'edit-copy')
        menu_item.connect('activate', self.__follow_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        menu_item = MenuItem(_('Copy'))
        icon = Icon(icon_name='edit-copy', xo_color=profile.get_color(),
                    icon_size=gtk.ICON_SIZE_MENU)
        menu_item.set_image(icon)
        menu_item.connect('activate', self.__copy_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
        
        if url.startswith('javascript:'):
            # only show if the link is a bookmarklet
            menu_item = MenuItem(_('Save bookmarklet'))
            menu_item.connect('activate', self.__bookmarklet_activate_cb)
            self.menu.append(menu_item)
            menu_item.show()
        else:
            # for all other links
            menu_item = MenuItem(_('Download link'))
            menu_item.connect('activate', self.__download_activate_cb)
            self.menu.append(menu_item)
            menu_item.show()
Example #29
0
    def __init__(self, title, url, owner_document):
        Palette.__init__(self)

        self._title = title
        self._url = url
        self._owner_document = owner_document

        self.props.primary_text = title
        self.props.secondary_text = url

        menu_item = MenuItem(_('Copy'))
        icon = Icon(icon_name='edit-copy', xo_color=profile.get_color(),
                    icon_size=gtk.ICON_SIZE_MENU)
        menu_item.set_image(icon)
        menu_item.connect('activate', self.__copy_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        menu_item = MenuItem(_('Download image'))
        menu_item.connect('activate', self.__download_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
Example #30
0
    def __init__(self, label, tag_type, view):
        Palette.__init__(self, label)

        box = gtk.VBox()
        self.set_content(box)

        def sort_cb(widget, sort):
            if not widget.props.active:
                return
            view.sort = sort
            model.this['tag_sidebar'][`tag_type`]['cloud_by_size'] = \
                    (sort == SORT_COUNT)
            view.update(force=True)

        alphabet = gtk.RadioButton(None, _('Sort alphabetically'))
        alphabet.connect('clicked', sort_cb, SORT_ALPHABET)
        box.pack_start(alphabet)

        by_size = gtk.RadioButton(alphabet, _('Sort by size'))
        by_size.connect('clicked', sort_cb, SORT_COUNT)
        box.pack_start(by_size)

        separator = gtk.HSeparator()
        box.pack_start(separator)

        def reverse_cb(widget):
            view.reverse = widget.props.active
            model.this['tag_sidebar'][`tag_type`]['cloud_reverse'] = \
                    widget.props.active
            view.update(force=True)

        reverse = gtk.CheckButton(_('Reverse order'))
        reverse.connect('clicked', reverse_cb)
        box.pack_start(reverse)

        box.show_all()

        if model.this['tag_sidebar'][ ` tag_type `]['cloud_by_size']:
            by_size.props.active = True
Example #31
0
    def __init__(self, activity_info):
        self._activity_info = activity_info

        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        activity_icon = Icon(file=activity_info.get_icon(),
                             xo_color=color,
                             icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)

        name = activity_info.get_name()
        Palette.__init__(self,
                         primary_text=glib.markup_escape_text(name),
                         icon=activity_icon)

        xo_color = XoColor(
            '%s,%s' %
            (style.COLOR_WHITE.get_svg(), style.COLOR_TRANSPARENT.get_svg()))
        menu_item = MenuItem(text_label=_('Start new'),
                             file_name=activity_info.get_icon(),
                             xo_color=xo_color)
        menu_item.connect('activate', self.__start_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
Example #32
0
    def __init__(self, cb_object):
        Palette.__init__(self, text_maxlen=100)

        self._cb_object = cb_object

        self.set_group_id('frame')

        cb_service = clipboard.get_instance()
        cb_service.connect('object-state-changed',
                           self._object_state_changed_cb)

        self._progress_bar = None

        self._remove_item = MenuItem(pgettext('Clipboard', 'Remove'),
                                     'list-remove')
        self._remove_item.connect('activate', self._remove_item_activate_cb)
        self.menu.append(self._remove_item)
        self._remove_item.show()

        self._open_item = MenuItem(_('Open'), 'zoom-activity')
        self._open_item.connect('activate', self._open_item_activate_cb)
        self.menu.append(self._open_item)
        self._open_item.show()

        self._journal_item = MenuItem(_('Keep'))
        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        icon = Icon(icon_name='document-save',
                    icon_size=gtk.ICON_SIZE_MENU,
                    xo_color=color)
        self._journal_item.set_image(icon)

        self._journal_item.connect('activate', self._journal_item_activate_cb)
        self.menu.append(self._journal_item)
        self._journal_item.show()

        self._update()
    def __init__(self, cb_object):
        Palette.__init__(self, text_maxlen=100)

        self._cb_object = cb_object

        self.set_group_id('frame')

        cb_service = clipboard.get_instance()
        cb_service.connect('object-state-changed',
                           self._object_state_changed_cb)

        self._progress_bar = None

        self._remove_item = MenuItem(pgettext('Clipboard', 'Remove'),
                                     'list-remove')
        self._remove_item.connect('activate', self._remove_item_activate_cb)
        self.menu.append(self._remove_item)
        self._remove_item.show()

        self._open_item = MenuItem(_('Open'), 'zoom-activity')
        self._open_item.connect('activate', self._open_item_activate_cb)
        self.menu.append(self._open_item)
        self._open_item.show()

        self._journal_item = MenuItem(_('Keep'))
        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        icon = Icon(icon_name='document-save', icon_size=gtk.ICON_SIZE_MENU,
                    xo_color=color)
        self._journal_item.set_image(icon)

        self._journal_item.connect('activate', self._journal_item_activate_cb)
        self.menu.append(self._journal_item)
        self._journal_item.show()

        self._update()
Example #34
0
    def __init__(self, label, jam):
        Palette.__init__(self, label)
        self.connect('popup', self.handlePopup)
        self.connect('popdown', self.handlePopdown)

        self.jam = jam

        self.tooltips = gtk.Tooltips()
        self.loopedSound = False
        self.soundLength = 1.00
        self.start = 0
        self.end = 1.00
        self.dur = 0.01
        self.volume = 1
        self.register = 0
        self.ok = True

        self.mainBox = gtk.VBox()

        self.controlsBox = gtk.HBox()

        self.GUI = {}

        self.soundBox = gtk.HBox()
        self.soundLabel = gtk.Label(_('Sound: '))
        self.soundMenuBox = BigComboBox()
        self.sounds = [snd for snd in os.listdir(Config.DATA_DIR) \
                           if snd != 'snds_info']
        for sound in self.sounds:
            self.soundMenuBox.append_item(self.sounds.index(sound), sound)
        self.soundMenuBox.connect('changed', self.handleSound)
        self.soundBox.pack_start(self.soundLabel, False, False, padding=10)
        self.soundBox.pack_start(self.soundMenuBox, False, False, padding=10)

        self.mainBox.pack_start(self.soundBox, False, False, 10)

        nameBox = gtk.VBox()
        self.nameEntry = gtk.Entry()
        entrycolor = gtk.gdk.Color()
        self.nameEntry.modify_text(gtk.STATE_NORMAL, entrycolor)
        self.nameEntry.set_text("name_of_the_sound")
        nameBox.pack_start(self.nameEntry)
        self.mainBox.pack_start(nameBox, False, False, 10)

        registerBox = gtk.HBox()
        self.registerBoxLabel = gtk.Label(_('Register: '))
        self.registerMenuBox = BigComboBox()
        self.registers = ['LOW', 'MID', 'HIGH', 'PUNCH']
        for reg in self.registers:
            self.registerMenuBox.append_item(self.registers.index(reg), reg)
        self.registerMenuBox.connect('changed', self.handleRegister)
        registerBox.pack_start(self.registerBoxLabel, False, False, padding=10)
        registerBox.pack_end(self.registerMenuBox, False, False, padding=10)
        self.mainBox.pack_start(registerBox, False, False, 10)

        loopedBox = gtk.HBox()
        loopedLabel = gtk.Label("Looped sound: ")
        loopedToggle = ImageToggleButton('checkOff.png', 'checkOn.png')
        loopedToggle.connect('button-press-event', self.handleLooped)
        loopedBox.pack_start(loopedLabel, False, False, padding=10)
        loopedBox.pack_end(loopedToggle, False, False, padding=10)
        self.mainBox.pack_start(loopedBox, False, False, 10)

        startBox = gtk.VBox()
        self.startAdjust = gtk.Adjustment(0.01, 0, 1., .001, .001, 0)
        self.GUI['startSlider'] = gtk.VScale(adjustment=self.startAdjust)
        self.startAdjust.connect("value-changed", self.handleStart)
        self.GUI['startSlider'].set_inverted(True)
        self.GUI['startSlider'].set_size_request(50, 200)
        self.GUI['startSlider'].set_digits(3)
        # tooltip closes loop settings palette!!!
        #self._add_tooltip(self.GUI['startSlider'], _("Loop start position"))
        self.handleStart(self.startAdjust)
        startBox.pack_start(self.GUI['startSlider'], True, True, 5)
        self.controlsBox.pack_start(startBox)

        endBox = gtk.VBox()
        self.endAdjust = gtk.Adjustment(0.9, 0, 1, .001, .001, 0)
        self.GUI['endSlider'] = gtk.VScale(adjustment=self.endAdjust)
        self.endAdjust.connect("value-changed", self.handleEnd)
        self.GUI['endSlider'].set_inverted(True)
        self.GUI['endSlider'].set_size_request(50, 200)
        self.GUI['endSlider'].set_digits(3)
        self.handleEnd(self.endAdjust)
        endBox.pack_start(self.GUI['endSlider'], True, True, 5)
        self.controlsBox.pack_start(endBox)

        durBox = gtk.VBox()
        self.durAdjust = gtk.Adjustment(0.01, 0, 0.2, .001, .001, 0)
        self.GUI['durSlider'] = gtk.VScale(adjustment=self.durAdjust)
        self.durAdjust.connect("value-changed", self.handleDur)
        self.GUI['durSlider'].set_inverted(True)
        self.GUI['durSlider'].set_size_request(50, 200)
        self.GUI['durSlider'].set_digits(3)
        self.handleDur(self.durAdjust)
        durBox.pack_start(self.GUI['durSlider'], True, True, 5)
        self.controlsBox.pack_start(durBox)

        volBox = gtk.VBox()
        self.volAdjust = gtk.Adjustment(1, 0, 2, .01, .01, 0)
        self.GUI['volSlider'] = gtk.VScale(adjustment=self.volAdjust)
        self.volAdjust.connect("value-changed", self.handleVol)
        self.GUI['volSlider'].set_inverted(True)
        self.GUI['volSlider'].set_size_request(50, 200)
        self.GUI['volSlider'].set_digits(3)
        self.handleVol(self.volAdjust)
        volBox.pack_start(self.GUI['volSlider'], True, True, 5)
        self.controlsBox.pack_start(volBox)

        self.mainBox.pack_start(self.controlsBox, False, False, 10)

        previewBox = gtk.VBox()
        self.playStopButton = ImageToggleButton('miniplay.png', 'stop.png')
        self.playStopButton.connect('button-press-event',
                                    self.handlePlayButton)
        previewBox.pack_start(self.playStopButton)
        self.mainBox.pack_start(previewBox, False, False, 10)

        checkBox = gtk.VBox()
        checkButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/accept.svg')
        checkButton.connect('clicked', self.handleCheck)
        checkBox.pack_start(checkButton)
        self.mainBox.pack_start(checkBox, False, False, 10)

        self.mainBox.show_all()
        self.set_content(self.mainBox)
    def __init__(self, **kwargs):
        Palette.__init__(self, **kwargs)

        self.button_box = gtk.HBox()
        self.button_box.show()
        self.set_content(self.button_box)
Example #36
0
    def __init__( self, label, mini ):
        Palette.__init__( self, label )
        self.connect('popup', self.handlePopup)
        self.connect('popdown', self.handlePopdown)

        self.mini = mini

        self.tooltips = gtk.Tooltips()
        self.loopedSound = False
        self.soundLength = 1.00
        self.start = 0
        self.end = 1.00
        self.dur = 0.01
        self.volume = 1
        self.register = 0
        self.ok = True

        self.mainBox = gtk.VBox()

        self.controlsBox = gtk.HBox()

        self.GUI = {}

        self.soundBox = gtk.HBox()
        self.soundLabel = gtk.Label(_('Sound: '))
        self.soundMenuBox = BigComboBox()
        self.sounds = os.listdir(Config.DATA_DIR)
        for sound in self.sounds:
            self.soundMenuBox.append_item(self.sounds.index(sound), sound)
        self.soundMenuBox.connect('changed', self.handleSound)
        self.soundBox.pack_start(self.soundLabel, False, False, padding=10)
        self.soundBox.pack_start(self.soundMenuBox, False, False, padding=10)

        self.mainBox.pack_start(self.soundBox, False, False, 10)

        nameBox = gtk.VBox()
        self.nameEntry = gtk.Entry()
        entrycolor = gtk.gdk.Color()
        self.nameEntry.modify_text(gtk.STATE_NORMAL, entrycolor)
        self.nameEntry.set_text("name_of_the_sound")
        nameBox.pack_start(self.nameEntry)
        self.mainBox.pack_start(nameBox, False, False, 10)

        registerBox = gtk.HBox()
        self.registerBoxLabel = gtk.Label(_('Register: '))
        self.registerMenuBox = BigComboBox()
        self.registers = ['LOW', 'MID', 'HIGH', 'PUNCH']
        for reg in self.registers:
            self.registerMenuBox.append_item(self.registers.index(reg), reg)
        self.registerMenuBox.connect('changed', self.handleRegister)
        registerBox.pack_start(self.registerBoxLabel, False, False, padding=10)
        registerBox.pack_end(self.registerMenuBox, False, False, padding=10)
        self.mainBox.pack_start(registerBox, False, False, 10)

        loopedBox = gtk.HBox()
        loopedLabel = gtk.Label("Looped sound: ")
        loopedToggle = ImageToggleButton('checkOff.png', 'checkOn.png')
        loopedToggle.connect('button-press-event', self.handleLooped )
        loopedBox.pack_start(loopedLabel, False, False, padding=10)
        loopedBox.pack_end(loopedToggle, False, False, padding=10)
        self.mainBox.pack_start(loopedBox, False, False, 10)

        startBox = gtk.VBox()
        self.startAdjust = gtk.Adjustment( 0.01, 0, 1., .001, .001, 0)
        self.GUI['startSlider'] = gtk.VScale( adjustment = self.startAdjust )
        self.startAdjust.connect("value-changed", self.handleStart)
        self.GUI['startSlider'].set_inverted(True)
        self.GUI['startSlider'].set_size_request(50, 200)
        self.GUI['startSlider'].set_digits(3)
        self.handleStart( self.startAdjust )
        startBox.pack_start(self.GUI['startSlider'], True, True, 5)
        self.controlsBox.pack_start(startBox)

        endBox = gtk.VBox()
        self.endAdjust = gtk.Adjustment( 0.9, 0, 1, .001, .001, 0)
        self.GUI['endSlider'] = gtk.VScale( adjustment = self.endAdjust )
        self.endAdjust.connect("value-changed", self.handleEnd)
        self.GUI['endSlider'].set_inverted(True)
        self.GUI['endSlider'].set_size_request(50, 200)
        self.GUI['endSlider'].set_digits(3)
        self.handleEnd( self.endAdjust )
        endBox.pack_start(self.GUI['endSlider'], True, True, 5)
        self.controlsBox.pack_start(endBox)

        durBox = gtk.VBox()
        self.durAdjust = gtk.Adjustment( 0.01, 0, 0.2, .001, .001, 0)
        self.GUI['durSlider'] = gtk.VScale( adjustment = self.durAdjust )
        self.durAdjust.connect("value-changed", self.handleDur)
        self.GUI['durSlider'].set_inverted(True)
        self.GUI['durSlider'].set_size_request(50, 200)
        self.GUI['durSlider'].set_digits(3)
        self.handleDur( self.durAdjust )
        durBox.pack_start(self.GUI['durSlider'], True, True, 5)
        self.controlsBox.pack_start(durBox)

        volBox = gtk.VBox()
        self.volAdjust = gtk.Adjustment( 1, 0, 2, .01, .01, 0)
        self.GUI['volSlider'] = gtk.VScale( adjustment = self.volAdjust )
        self.volAdjust.connect("value-changed", self.handleVol)
        self.GUI['volSlider'].set_inverted(True)
        self.GUI['volSlider'].set_size_request(50, 200)
        self.GUI['volSlider'].set_digits(3)
        self.handleVol( self.volAdjust )
        volBox.pack_start(self.GUI['volSlider'], True, True, 5)
        self.controlsBox.pack_start(volBox)

        self.mainBox.pack_start(self.controlsBox, False, False, 10)

        previewBox = gtk.VBox()
        self.playStopButton = ImageToggleButton('miniplay.png', 'stop.png')
        self.playStopButton.connect('button-press-event' , self.handlePlayButton)
        previewBox.pack_start(self.playStopButton)
        self.mainBox.pack_start(previewBox, False, False, 10)

        checkBox = gtk.VBox()
        checkButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/accept.svg')
        checkButton.connect('clicked' , self.handleCheck)
        checkBox.pack_start(checkButton)
        self.mainBox.pack_start(checkBox, False, False, 10)

        self.mainBox.show_all()
        self.set_content(self.mainBox)
    def __init__(self, **kwargs):
        Palette.__init__(self, **kwargs)

        self.button_box = gtk.HBox()
        self.button_box.show()
        self.set_content(self.button_box)
Example #38
0
 def __init__(self, tag):
     tag_icon = Icon(file='icons/'+tag.icon+'.svg',
                     xo_color=profile.get_color(),
                     icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR)
     Palette.__init__(self, primary_text=tag.label, icon=tag_icon)
     self._tag = tag
    def __init__(self, primary_text, v4l2_control = False,
            v4l2_auto_control = False):
        Palette.__init__(self, label=primary_text)

        vbox = gtk.VBox()
        self.set_content(vbox)
        vbox.show()

        if v4l2_control:
            self._query_control = v4l2.v4l2_queryctrl(v4l2_control)
            self._control = v4l2.v4l2_control(v4l2_control)

            ioctl(VD, v4l2.VIDIOC_QUERYCTRL, self._query_control)
            ioctl(VD, v4l2.VIDIOC_G_CTRL, self._control)

            _max = self._query_control.maximum
            _min = self._query_control.minimum

            if v4l2_control == v4l2.V4L2_CID_EXPOSURE:
                _min = 0
                _max = 512
            elif v4l2_control == v4l2.V4L2_CID_GAIN:
                _min = 0
                _max = 37
            elif v4l2_control == v4l2.V4L2_CID_CONTRAST:
                _min = 0
                _max = 127
            elif v4l2_control == v4l2.V4L2_CID_BRIGHTNESS:
                _min = 0
                _max = 255
            #elif v4l2_control == v4l2.V4L2_CID_NIGHT_MODE:
            #    _min = 0
            #    _max = 1

            self._adjustment = gtk.Adjustment(value=self._control.value,
                    lower=_min,
                    upper=_max,
                    step_incr=1, page_incr=1, page_size=0)

            self._hscale = gtk.HScale(self._adjustment)
            self._hscale.set_digits(0)
            self._hscale.set_draw_value(False)
            self._hscale.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
            vbox.add(self._hscale)
            self._hscale.show()

            self._adjustment_handler_id = \
                self._adjustment.connect('value_changed',
                                         self.__adjustment_changed_cb)

            if v4l2_auto_control:
                self._auto_query_control =\
                    v4l2.v4l2_queryctrl(v4l2_auto_control)
                self._auto_control = v4l2.v4l2_control(v4l2_auto_control)

                self._auto_button = gtk.CheckButton('Auto')
                self._auto_button.set_active(self._auto_control.value)
                self._auto_button.connect('toggled',
                        self.__auto_button_toggled_cb)
                vbox.add(self._auto_button)
                self._auto_button.show()

                if self._auto_control.value == True:
                    self._hscale.set_sensitive(False)

        vbox.show()
Example #40
0
    def __init__(self, metadata, detail=False):

        self._metadata = metadata

        activity_icon = Icon(icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
        activity_icon.props.file = misc.get_icon_name(metadata)
        color = misc.get_icon_color(metadata)
        activity_icon.props.xo_color = color

        if 'title' in metadata:
            title = gobject.markup_escape_text(metadata['title'])
        else:
            title = glib.markup_escape_text(_('Untitled'))

        Palette.__init__(self, primary_text=title,
                         icon=activity_icon)

        if misc.get_activities(metadata) or misc.is_bundle(metadata):
            if metadata.get('activity_id', ''):
                resume_label = _('Resume')
                resume_with_label = _('Resume with')
            else:
                resume_label = _('Start')
                resume_with_label = _('Start with')
            menu_item = MenuItem(resume_label, 'activity-start')
            menu_item.connect('activate', self.__start_activate_cb)
            self.menu.append(menu_item)
            menu_item.show()

            menu_item = MenuItem(resume_with_label, 'activity-start')
            self.menu.append(menu_item)
            menu_item.show()
            start_with_menu = StartWithMenu(self._metadata)
            menu_item.set_submenu(start_with_menu)

        else:
            menu_item = MenuItem(_('No activity to start entry'))
            menu_item.set_sensitive(False)
            self.menu.append(menu_item)
            menu_item.show()

        menu_item = MenuItem(_('Copy to'))
        icon = Icon(icon_name='edit-copy', xo_color=color,
                    icon_size=gtk.ICON_SIZE_MENU)
        menu_item.set_image(icon)
        self.menu.append(menu_item)
        menu_item.show()
        copy_menu = CopyMenu(metadata)
        copy_menu.connect('volume-error', self.__volume_error_cb)
        menu_item.set_submenu(copy_menu)

        if self._metadata['mountpoint'] == '/':
            menu_item = MenuItem(_('Duplicate'))
            icon = Icon(icon_name='edit-duplicate', xo_color=color,
                        icon_size=gtk.ICON_SIZE_MENU)
            menu_item.set_image(icon)
            menu_item.connect('activate', self.__duplicate_activate_cb)
            self.menu.append(menu_item)
            menu_item.show()

        menu_item = MenuItem(_('Send to'), 'document-send')
        self.menu.append(menu_item)
        menu_item.show()

        friends_menu = FriendsMenu()
        friends_menu.connect('friend-selected', self.__friend_selected_cb)
        menu_item.set_submenu(friends_menu)

        if detail == True:
            menu_item = MenuItem(_('View Details'), 'go-right')
            menu_item.connect('activate', self.__detail_activate_cb)
            self.menu.append(menu_item)
            menu_item.show()

        menu_item = MenuItem(_('Erase'), 'list-remove')
        menu_item.connect('activate', self.__erase_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()