Ejemplo n.º 1
0
def __create_radio_panel_menus():

    # w, n, o, c: window, name, parent, context

    menu.simple_menu_item('new-station', [], _('_New Station'), 'list-add',
                          lambda w, n, o, c: o._on_add_button_clicked()) \
        .register('radio-panel-menu')
Ejemplo n.º 2
0
    def __init__(self, exaile, gui):
        notebook.SmartNotebook.__init__(self, vertical=True)
        
        self.exaile = exaile
        self.panels = {}    # key: name, value: PanelData object

        self.set_add_tab_on_empty(False)
        
        self.loading_panels = True
        
        self.connect('page-removed', self.on_panel_removed)
        self.connect('page-reordered', self.on_panel_reordered)
        self.connect('switch-page', self.on_panel_switch)
        
        _register_builtin_panels(exaile, gui.main.window)
        
        self.view_menu = menu.Menu(None)
        
        # setup/register the view menu
        menu.simple_menu_item('panel-menu', ['show-playing-track'], _('P_anels'),
                              submenu=self.view_menu) \
                            .register('menubar-view-menu')
        
        providers.ProviderHandler.__init__(self, 'main-panel', simple_init=True)
        
        # Provide interface for adding buttons to the notebook
        self.actions = notebook.NotebookActionService(self, 'main-panel-actions')
        
        if not self.exaile.loading:
            self.on_gui_loaded()
Ejemplo n.º 3
0
    def __init__(self, exaile, gui):
        notebook.SmartNotebook.__init__(self, vertical=True)

        self.exaile = exaile
        self.panels = {}  # key: name, value: PanelData object

        self.set_add_tab_on_empty(False)

        self.loading_panels = True

        self.connect('page-removed', self.on_panel_removed)
        self.connect('page-reordered', self.on_panel_reordered)
        self.connect('switch-page', self.on_panel_switch)

        _register_builtin_panels(exaile, gui.main.window)

        self.view_menu = menu.ProviderMenu('panel-tab-context', None)

        # setup/register the view menu
        menu.simple_menu_item('panel-menu', ['show-playing-track'], _('P_anels'),
                              submenu=self.view_menu) \
            .register('menubar-view-menu')

        providers.ProviderHandler.__init__(self,
                                           'main-panel',
                                           simple_init=True)

        # Provide interface for adding buttons to the notebook
        self.actions = notebook.NotebookActionService(self,
                                                      'main-panel-actions')

        if not self.exaile.loading:
            self.on_gui_loaded()
Ejemplo n.º 4
0
def __create_marker_context_menu():
    items = []

    def on_jumpto_item_activate(widget, name, parent, context):
        # parent.seek(context['current-marker'].props.position)
        position = context['current-marker'].props.position
        player.PLAYER.set_progress(position)

    def on_remove_item_activate(widget, name, parent, context):
        providers.unregister('playback-markers', context['current-marker'])

    items.append(
        menu.simple_menu_item(
            'jumpto-marker', [], _("_Jump to"), 'go-jump', on_jumpto_item_activate
        )
    )
    items.append(MoveMarkerMenuItem('move-marker', [items[-1].name]))
    items.append(
        menu.simple_menu_item(
            'remove-marker',
            [items[-1].name],
            _("_Remove Marker"),
            'list-remove',
            on_remove_item_activate,
        )
    )

    for item in items:
        providers.register('playback-marker-context-menu', item)
Ejemplo n.º 5
0
def __create_marker_context_menu():
    items = []

    def on_jumpto_item_activate(widget, name, parent, context):
        # parent.seek(context['current-marker'].props.position)
        position = context['current-marker'].props.position
        player.PLAYER.set_progress(position)

    def on_remove_item_activate(widget, name, parent, context):
        providers.unregister('playback-markers', context['current-marker'])

    items.append(
        menu.simple_menu_item(
            'jumpto-marker', [], _("_Jump to"), 'go-jump', on_jumpto_item_activate
        )
    )
    items.append(MoveMarkerMenuItem('move-marker', [items[-1].name]))
    items.append(
        menu.simple_menu_item(
            'remove-marker',
            [items[-1].name],
            _("_Remove Marker"),
            'list-remove',
            on_remove_item_activate,
        )
    )

    for item in items:
        providers.register('playback-marker-context-menu', item)
Ejemplo n.º 6
0
def __create_radio_panel_menus():
    
    # w, n, o, c: window, name, parent, context

    menu.simple_menu_item('new-station', [], _('_New Station'), 'list-add',
                          lambda w, n, o, c: o._on_add_button_clicked()) \
        .register('radio-panel-menu')
Ejemplo n.º 7
0
 def on_gui_loaded(self):
     
     # register menu items
     item = menu.simple_menu_item('pz-run', [], _('Analyze playlists'),
                                  callback=self.on_analyze_playlists)
     item.register('menubar-tools-menu')
     self.menu_items.append(item)
     
     item = menu.simple_menu_item('pz-run', ['export-files'], _('Analyze playlist'),
                                  callback=self.on_analyze_playlist)
     item.register('playlist-panel-context-menu')
     self.menu_items.append(item)
Ejemplo n.º 8
0
 def on_gui_loaded(self):
     
     # register menu items
     item = menu.simple_menu_item('pz-run', [], _('Analyze playlists'),
                                  callback=self.on_analyze_playlists)
     item.register('menubar-tools-menu')
     self.menu_items.append(item)
     
     item = menu.simple_menu_item('pz-run', ['export-files'], _('Analyze playlist'),
                                  callback=self.on_analyze_playlist)
     item.register('playlist-panel-context-menu')
     self.menu_items.append(item)
Ejemplo n.º 9
0
    def create_menu(self):

        sep = menu.simple_separator('furas-item-sep', ['properties'])
        #sep._pos = 'normal'
        self.provider_register(sep, 'playlist-context-menu')

        for n, (name, url) in enumerate(DATA):
            item = menu.simple_menu_item(
                'furas-item-%i' % n, # unique name
                ['furas-item-sep'], # after ie. [] or ['properties']
                name, # displayed text
                'gtk-save', # icon name # ie. 'document-properties'
                self.webbrowser_cb, # callback function
                callback_args=[url] # callback extra arguments
            )
            #print(dir(item))
            self.provider_register(item, 'playlist-context-menu')

        print '---------------------------------'
        print 'TESTING: register menu #1'
        
        ### submenu ###

        
        self.submenu = menu.Menu(self, inherit_context=True)
        
        for n, (name, url) in enumerate(DATA):
            self.submenu.add_item(menu.simple_menu_item(
                'furas-item-sub-%i' % n, # unique name
                [], # after ie. [] or ['properties']
                name, # displayed text
                'gtk-save', # icon name # ie. 'document-properties'
                self.webbrowser_cb, # callback function
                callback_args=[url] # callback extra arguments
            ))

        item = menu.simple_menu_item(
                'furas-item-sub', # unique name
                ['furas-item-sep'], # after ie. [] or ['properties']
                'Szukaj',
                submenu=self.submenu)
        
        self.provider_register(item, 'playlist-context-menu')
                
                
        print 'TESTING: self.submenu._items:'
        print self.submenu._items
        print '---------------------------------'
        print 'TESTING: register menu #2'

        for p in providers.get('playlist-context-menu'):
            print 'TESTING:  -> menu:', p.name, p._pos, p.after
        print '---------------------------------'
Ejemplo n.º 10
0
    def create_menu(self):

        sep = menu.simple_separator('furas-item-sep', ['properties'])
        #sep._pos = 'normal'
        self.provider_register(sep, 'playlist-context-menu')

        for n, (name, url) in enumerate(DATA):
            item = menu.simple_menu_item(
                'furas-item-%i' % n,  # unique name
                ['furas-item-sep'],  # after ie. [] or ['properties']
                name,  # displayed text
                'gtk-save',  # icon name # ie. 'document-properties'
                self.webbrowser_cb,  # callback function
                callback_args=[url]  # callback extra arguments
            )
            #print(dir(item))
            self.provider_register(item, 'playlist-context-menu')

        print '---------------------------------'
        print 'TESTING: register menu #1'

        ### submenu ###

        self.submenu = menu.Menu(self, inherit_context=True)

        for n, (name, url) in enumerate(DATA):
            self.submenu.add_item(
                menu.simple_menu_item(
                    'furas-item-sub-%i' % n,  # unique name
                    [],  # after ie. [] or ['properties']
                    name,  # displayed text
                    'gtk-save',  # icon name # ie. 'document-properties'
                    self.webbrowser_cb,  # callback function
                    callback_args=[url]  # callback extra arguments
                ))

        item = menu.simple_menu_item(
            'furas-item-sub',  # unique name
            ['furas-item-sep'],  # after ie. [] or ['properties']
            'Szukaj',
            submenu=self.submenu)

        self.provider_register(item, 'playlist-context-menu')

        print 'TESTING: self.submenu._items:'
        print self.submenu._items
        print '---------------------------------'
        print 'TESTING: register menu #2'

        for p in providers.get('playlist-context-menu'):
            print 'TESTING:  -> menu:', p.name, p._pos, p.after
        print '---------------------------------'
Ejemplo n.º 11
0
    def create_test_menu(self):
        
        self.item = menu.simple_menu_item('furas-item', # name
            ['properties'], # after ie. [] or ['properties']
            'Testowy', # display text
            'gtk-save', # icon name # ie. 'document-properties'
            self.test_callback, # callback function
            callback_args=[] # callback extra arguments
        )
                
        #self.item_register(self.item, 'track-panel-menu')
        #self.item_register(self.item, 'playlist-panel-menu')
        #self.item_register(self.item, 'playlist-panel-context-menu')
        #self.item_register(self.item, 'collection-panel-context-menu')
        #self.item_register(self.item, 'files-panel-context-menu')
        #self.item_register(self.item, 'radio-panel-menu')
        
        #providers.register('menubar-file-menu', item)
        #providers.register('menubar-edit-menu', item)
        #providers.register('menubar-playlist-menu', item)
        #providers.register('menubar-playlist-menu', item)
        #providers.register('menubar-tools-menu', item)
        #providers.register('menubar-help-menu', item)
        
        #self.item.register('main-panel')        

        self.provider_register(self.item, 'playlist-context-menu')
Ejemplo n.º 12
0
    def create_menu(self):
        print 'SearchOnInternetPlugin : create menu'

        # list of registered items - to unregister on exit/teardown
        self._items = []

        # create separator (after 'properties')
        sep = menu.simple_separator(
            'soi-sep',     # unique name/ID in menu
            ['properties'] # put after (ie. [] or ['properties'])
        )
        # add separator to menu
        sep.register('playlist-context-menu')
        # add separtor to list
        self._items.append(sep)

        for n, (name, url) in enumerate(DATA):
            # create item (after separator 'soi-sep')
            item = menu.simple_menu_item(
                'soi-%i' % n, # unique name/ID in menu
                ['soi-sep'],  # put after (ie. [] or ['properties'])
                'Search on %s' % name, # displayed text
                'gtk-save',   # icon name (ie. 'document-properties', 'applications-internet', 'edit-find')
                self.webbrowser_cb, # callback function name
                callback_args=[url] # callback extra arguments
            )
            # add item to menu
            item.register('playlist-context-menu')
            # add item to list
            self._items.append(item)
Ejemplo n.º 13
0
    def create_menu(self):
        print 'SearchOnInternetPlugin : create menu'

        # list of registered items - to unregister on exit/teardown
        self._items = []

        # create separator (after 'properties')
        sep = menu.simple_separator(
            'soi-sep',  # unique name/ID in menu
            ['properties']  # put after (ie. [] or ['properties'])
        )
        # add separator to menu
        sep.register('playlist-context-menu')
        # add separtor to list
        self._items.append(sep)

        for n, (name, url) in enumerate(DATA):
            # create item (after separator 'soi-sep')
            item = menu.simple_menu_item(
                'soi-%i' % n,  # unique name/ID in menu
                ['soi-sep'],  # put after (ie. [] or ['properties'])
                'Search on %s' % name,  # displayed text
                'gtk-save',  # icon name (ie. 'document-properties', 'applications-internet', 'edit-find')
                self.webbrowser_cb,  # callback function name
                callback_args=[url]  # callback extra arguments
            )
            # add item to menu
            item.register('playlist-context-menu')
            # add item to list
            self._items.append(item)
Ejemplo n.º 14
0
    def create_test_menu(self):

        self.item = menu.simple_menu_item(
            'furas-item',  # name
            ['properties'],  # after ie. [] or ['properties']
            'Testowy',  # display text
            'gtk-save',  # icon name # ie. 'document-properties'
            self.test_callback,  # callback function
            callback_args=[]  # callback extra arguments
        )

        #self.item_register(self.item, 'track-panel-menu')
        #self.item_register(self.item, 'playlist-panel-menu')
        #self.item_register(self.item, 'playlist-panel-context-menu')
        #self.item_register(self.item, 'collection-panel-context-menu')
        #self.item_register(self.item, 'files-panel-context-menu')
        #self.item_register(self.item, 'radio-panel-menu')

        #providers.register('menubar-file-menu', item)
        #providers.register('menubar-edit-menu', item)
        #providers.register('menubar-playlist-menu', item)
        #providers.register('menubar-playlist-menu', item)
        #providers.register('menubar-tools-menu', item)
        #providers.register('menubar-help-menu', item)

        #self.item.register('main-panel')

        self.provider_register(self.item, 'playlist-context-menu')
Ejemplo n.º 15
0
 def __create_pre_init_menu_item(self):
     self.premenu=menu.simple_menu_item('Connect to Douban.fm',[],_('_Connect to Douban.fm'),
                                        gtk.STOCK_ADD, lambda e,r,t,y:self.do_init(),
                                        accelerator='<Control>C')
     self.accelerator_pre = Accelerator('<Control>C',lambda e,r,t,y:self.do_init())
     providers.register('menubar-file-menu',self.premenu)
     providers.register('mainwindow-accelerators', self.accelerator_pre)
Ejemplo n.º 16
0
 def __create_pre_init_menu_item(self):
     self.premenu=menu.simple_menu_item('Connect to Douban.fm',[],_('_Connect to Douban.fm'),
                                        gtk.STOCK_ADD, lambda e,r,t,y:self.do_init(),
                                        accelerator='<Control>C')
     self.accelerator_pre = Accelerator('<Control>C',lambda e,r,t,y:self.do_init())
     providers.register('menubar-file-menu',self.premenu)
     providers.register('mainwindow-accelerators', self.accelerator_pre)
Ejemplo n.º 17
0
def AppendMenuItem(name, after, get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(name,
                                 after,
                                 _("_Append to Current"),
                                 'list-add',
                                 _append_cb,
                                 callback_args=[get_tracks_func])
Ejemplo n.º 18
0
def EnqueueMenuItem(name, after, get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(name,
                                 after,
                                 _("En_queue"),
                                 'list-add',
                                 _enqueue_cb,
                                 callback_args=[get_tracks_func])
Ejemplo n.º 19
0
    def on_gui_loaded(self):

        # add a thing to the view menu
        self.menu = menu.simple_menu_item(
            'developer', '', _('Developer Tools'), callback=self.on_view_menu
        )

        providers.register('menubar-tools-menu', self.menu)
Ejemplo n.º 20
0
def ExportPlaylistMenuItem(name, after, get_pl_func=generic_get_playlist_func):
    return menu.simple_menu_item(
        name,
        after,
        _("Export Playlist"),
        "gtk-save",
        lambda w, n, o, c: dialogs.export_playlist_dialog(get_pl_func(o, c)),
    )
Ejemplo n.º 21
0
def StopMenuItem(name, player, after):
    return menu.simple_menu_item(
        name,
        after,
        _("_Stop"),
        'media-playback-stop',
        callback=lambda *args: player.stop(),
    )
Ejemplo n.º 22
0
def ExportPlaylistFilesMenuItem(name, after, get_pl_func=generic_get_playlist_func):
    return menu.simple_menu_item(
        name,
        after,
        _('Export _Files'),
        'document-save-as',
        lambda w, n, o, c: dialogs.export_playlist_files(get_pl_func(o, c)),
    )
Ejemplo n.º 23
0
def StopMenuItem(name, player, after):
    return menu.simple_menu_item(
        name,
        after,
        _("_Stop"),
        'media-playback-stop',
        callback=lambda *args: player.stop(),
    )
Ejemplo n.º 24
0
def NextMenuItem(name, player, after):
    return menu.simple_menu_item(
        name,
        after,
        _("_Next Track"),
        'media-skip-forward',
        callback=lambda *args: player.queue.next(),
    )
Ejemplo n.º 25
0
def DeletePlaylistMenuItem(name, after, get_pl_func=generic_get_playlist_func):
    return menu.simple_menu_item(
        name,
        after,
        _('_Delete Playlist'),
        'edit-delete',
        lambda w, n, o, c: o.remove_playlist(get_pl_func(o, c)),
    )
Ejemplo n.º 26
0
    def on_gui_loaded(self):

        # add a thing to the view menu
        self.menu = menu.simple_menu_item(
            'developer', '', _('Developer Tools'), callback=self.on_view_menu
        )

        providers.register('menubar-tools-menu', self.menu)
Ejemplo n.º 27
0
def PrevMenuItem(name, player, after):
    return menu.simple_menu_item(
        name,
        after,
        _("_Previous Track"),
        'media-skip-backward',
        callback=lambda *args: player.queue.prev(),
    )
Ejemplo n.º 28
0
def NextMenuItem(name, player, after):
    return menu.simple_menu_item(
        name,
        after,
        _("_Next Track"),
        'media-skip-forward',
        callback=lambda *args: player.queue.next(),
    )
Ejemplo n.º 29
0
def PrevMenuItem(name, player, after):
    return menu.simple_menu_item(
        name,
        after,
        _("_Previous Track"),
        'media-skip-backward',
        callback=lambda *args: player.queue.prev(),
    )
Ejemplo n.º 30
0
def EditPlaylistMenuItem(name, after, get_pl_func=generic_get_playlist_func):
    return menu.simple_menu_item(
        name,
        after,
        _('_Edit'),
        'accessories-text-editor',
        lambda w, n, o, c: o.edit_smart_playlist(get_pl_func(o, c)),
        condition_fn=lambda n, p, c: isinstance(c['selected-playlist'],
                                                playlist.SmartPlaylist))
Ejemplo n.º 31
0
def AppendMenuItem(name, after, get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(
        name,
        after,
        _("_Append to Current"),
        'list-add',
        _append_cb,
        callback_args=[get_tracks_func],
    )
Ejemplo n.º 32
0
def ReplaceCurrentMenuItem(name, after, get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(
        name,
        after,
        _("_Replace Current"),
        None,
        _append_cb,
        callback_args=[get_tracks_func, True],
    )
Ejemplo n.º 33
0
def EnqueueMenuItem(name, after, get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(
        name,
        after,
        _("En_queue"),
        'list-add',
        _enqueue_cb,
        callback_args=[get_tracks_func],
    )
Ejemplo n.º 34
0
    def __init__(self, exaile):
        """
            Sets up the mini mode main window and
            options to access it
        """
        Gtk.Window.__init__(self)
        self.set_title('Exaile Mini Mode')
        self.set_resizable(False)

        self.exaile_window = exaile.gui.main.window

        controls.register()

        self.box = controls.ControlBox()
        self.box.set_spacing(3)
        self.border_frame = Gtk.Frame()
        self.border_frame.add(self.box)
        self.add(self.border_frame)

        self.accelerator = Accelerator('<Primary><Alt>M', _('Mini Mode'),
                                       self.on_menuitem_activate)

        self.menuitem = menu.simple_menu_item('minimode', ['clear-playlist'],
                                              icon_name='exaile-minimode',
                                              callback=self.accelerator)

        providers.register('menubar-view-menu', self.menuitem)
        providers.register('mainwindow-accelerators', self.accelerator)

        self.mainbutton = Gtk.Button(label=_('Mini Mode'))
        self.mainbutton.set_image(
            Gtk.Image.new_from_icon_name('exaile-minimode',
                                         Gtk.IconSize.BUTTON))
        self.mainbutton.connect('clicked', self.on_mainbutton_clicked)
        action_area = exaile.gui.main.info_area.get_action_area()
        action_area.pack_end(self.mainbutton, False, False, 6)

        self.__active = False
        self.__dirty = True
        # XXX: Until defaults are implemented in xl.settings
        self.__defaults = {
            'plugin/minimode/always_on_top': True,
            'plugin/minimode/show_in_panel': False,
            'plugin/minimode/on_all_desktops': True,
            'plugin/minimode/display_window_decorations': True,
            'plugin/minimode/window_decoration_type': 'full',
            'plugin/minimode/use_alpha': False,
            'plugin/minimode/transparency': 0.3,
            'plugin/minimode/horizontal_position': 10,
            'plugin/minimode/vertical_position': 10
        }

        exaile.gui.main.connect('main-visible-toggle',
                                self.on_main_visible_toggle)
        event.add_ui_callback(self.on_option_set, 'plugin_minimode_option_set')
        self.on_option_set('plugin_minimode_option_set', settings,
                           'plugin/minimode/button_in_mainwindow')
Ejemplo n.º 35
0
def OpenDirectoryMenuItem(name,
                          after,
                          get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(name,
                                 after,
                                 _("_Open Directory"),
                                 'folder-open',
                                 _open_directory_cb,
                                 callback_args=[get_tracks_func])
Ejemplo n.º 36
0
    def _init_gui(self):
    
        self.pane = gtk.HPaned()
        
        # stolen from main
        self.info_area = main.MainWindowTrackInfoPane(self.player)
        self.info_area.set_auto_update(True)
        self.info_area.set_padding(3, 3, 3, 3)
        self.info_area.hide_all()
        self.info_area.set_no_show_all(True)

        volume_control = playback.VolumeControl(self.player)
        self.info_area.get_action_area().pack_start(volume_control)
        
        self.playpause_button = gtk.Button()
        self.playpause_button.set_relief(gtk.RELIEF_NONE)
        self._on_playback_end(None, None, None)
        self.playpause_button.connect('button-press-event', self._on_playpause_button_clicked)
        
        progress_bar = playback.SeekProgressBar(self.player, use_markers=False)
        
        play_toolbar = gtk.HBox()
        play_toolbar.pack_start(self.playpause_button, expand=False, fill=False)
        play_toolbar.pack_start(progress_bar)
        
        # stick our player controls into this box
        self.pane1_box = gtk.VBox()
        
        self.pane2_box = gtk.VBox()
        self.pane2_box.pack_start(self.info_area, expand=False, fill=False)
        self.pane2_box.pack_start(play_toolbar, expand=False, fill=False) 
        
        self.pane.pack1(self.pane1_box, resize=True, shrink=True)
        self.pane.pack2(self.pane2_box, resize=True, shrink=True)
        
        # setup menus
        
        # add menu item to 'view' to display our playlist 
        self.menu = menu.check_menu_item('preview_player', '', _('Preview Player'), \
            lambda *e: self.hooked, self._on_view )
            
        providers.register('menubar-view-menu', self.menu)
        
        self.preview_menuitem = menu.simple_menu_item('_preview', ['enqueue'], 
                _('Preview'), callback=self._on_preview,
                condition_fn=lambda n,p,c: not c['selection-empty'])
        
        # TODO: Setup on other context menus
        self.preview_provides = [ 'track-panel-menu',
                                  'playlist-context-menu']
        
        for provide in self.preview_provides:
            providers.register(provide, self.preview_menuitem)
        
        self._on_option_set('gui_option_set', settings, 'gui/show_info_area')
        self._on_option_set('gui_option_set', settings, 'gui/show_info_area_covers')
        event.add_callback(self._on_option_set, 'option_set')
Ejemplo n.º 37
0
def EditPlaylistMenuItem(name, after, get_pl_func=generic_get_playlist_func):
    return menu.simple_menu_item(
        name,
        after,
        _("Edit"),
        "gtk-edit",
        lambda w, n, o, c: o.edit_smart_playlist(get_pl_func(o, c)),
        condition_fn=lambda n, p, c: isinstance(c["selected-playlist"], playlist.SmartPlaylist),
    )
Ejemplo n.º 38
0
    def __init__(self, parent):
        menu.Menu.__init__(self, parent)

        self.add_item(
            menu.simple_menu_item(
                'append', [],
                _('Append to Current'),
                'gtk-add',
                callback=lambda *args: parent.add_to_playlist()))
Ejemplo n.º 39
0
 def factory(name, after, player):
     if player.is_playing():
         icon_name = 'media-playback-pause'
         label = _("_Pause")
     else:
         icon_name = 'media-playback-start'
         label = _("P_lay")
     return menu.simple_menu_item(name, after, label, icon_name,
         callback=lambda *args: playpause(player) )
Ejemplo n.º 40
0
def PropertiesMenuItem(name, after, get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(
        name,
        after,
        _("_Track Properties"),
        'document-properties',
        _properties_cb,
        callback_args=[get_tracks_func],
    )
Ejemplo n.º 41
0
def OpenDirectoryMenuItem(name, after, get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(
        name,
        after,
        _("_Open Directory"),
        'folder-open',
        _open_directory_cb,
        callback_args=[get_tracks_func],
    )
Ejemplo n.º 42
0
def ReplaceCurrentMenuItem(name,
                           after,
                           get_tracks_func=generic_get_tracks_func):
    return menu.simple_menu_item(name,
                                 after,
                                 _("_Replace Current"),
                                 None,
                                 _append_cb,
                                 callback_args=[get_tracks_func, True])
Ejemplo n.º 43
0
 def factory(name, after, player):
     if player.is_playing():
         icon_name = 'media-playback-pause'
         label = _("_Pause")
     else:
         icon_name = 'media-playback-start'
         label = _("P_lay")
     return menu.simple_menu_item(
         name, after, label, icon_name, callback=lambda *args: playpause(player)
     )
Ejemplo n.º 44
0
 def on_gui_loaded(self):
     providers.register('mainwindow-info-area-widget', self)
     
     if autodetect_enabled:
         self.menuitem = menu.simple_menu_item('_bpm', ['enqueue'],
             _('Autodetect BPM'), callback=self.on_auto_menuitem,
             condition_fn=lambda n, p, c: not c['selection-empty'])
         
         for p in menu_providers:
             providers.register(p, self.menuitem)
Ejemplo n.º 45
0
    def __create_menu_item__(self):
        providers.unregister("menubar-file-menu", self.premenu)

        self.menu = gtk.Menu()
        for channel_name in self.channels.keys():
            menuItem = gtk.MenuItem(_(channel_name))

            menuItem.connect("activate", self.active_douban_radio, self.channels[channel_name])
            self.menu.append(menuItem)
            menuItem.show()
        self.premenu = menu.simple_menu_item("Open Douban.fm", [], _("_Open Douban.fm"), None, None, [], self.menu)
        providers.register("menubar-file-menu", self.premenu)

        self.modemenu = menu.simple_menu_item(
            "DoubanFM Mode", [], _("_DoubanFM Mode"), gtk.STOCK_FULLSCREEN, self.show_mode, accelerator="<Control>D"
        )
        self.accelerator_mode = Accelerator("<Control>D", self.show_mode)
        providers.register("menubar-view-menu", self.modemenu)
        providers.register("mainwindow-accelerators", self.accelerator_mode)
Ejemplo n.º 46
0
    def __create_menu_item__(self):
        providers.unregister('menubar-file-menu',self.premenu)

        self.menu=gtk.Menu()
        for channel_name  in self.channels.keys():
            menuItem = gtk.MenuItem(_(channel_name))

            menuItem.connect('activate', self.active_douban_radio, self.channels[channel_name])
            self.menu.append(menuItem)
            menuItem.show()
        self.premenu=menu.simple_menu_item('Open Douban.fm',[],_('_Open Douban.fm'),
                                           None, None,[],self.menu)
        providers.register('menubar-file-menu',self.premenu)

        self.modemenu=menu.simple_menu_item('DoubanFM Mode',[],_('_DoubanFM Mode'),
                                            gtk.STOCK_FULLSCREEN,self.show_mode,
                                            accelerator='<Control>D')
        self.accelerator_mode = Accelerator('<Control>D',self.show_mode)
        providers.register('menubar-view-menu',self.modemenu)
        providers.register('mainwindow-accelerators', self.accelerator_mode)
Ejemplo n.º 47
0
def PropertiesMenuItem(
    name, after, get_tracks_func=generic_get_tracks_func, dialog_parent=None
):
    return menu.simple_menu_item(
        name,
        after,
        _("_Track Properties"),
        'document-properties',
        _properties_cb,
        callback_args=[get_tracks_func, dialog_parent],
    )
Ejemplo n.º 48
0
def EditPlaylistMenuItem(name, after, get_pl_func=generic_get_playlist_func):
    return menu.simple_menu_item(
        name,
        after,
        _('_Edit'),
        'accessories-text-editor',
        lambda w, n, o, c: o.edit_smart_playlist(get_pl_func(o, c)),
        condition_fn=lambda n, p, c: isinstance(
            c['selected-playlist'], playlist.SmartPlaylist
        ),
    )
Ejemplo n.º 49
0
    def __create_menu_item__(self):
        providers.unregister('menubar-file-menu',self.premenu)

        self.menu=gtk.Menu()
        for channel_name  in self.channels.keys():
            menuItem = gtk.MenuItem(_(channel_name))

            menuItem.connect('activate', self.active_douban_radio, self.channels[channel_name])
            self.menu.append(menuItem)
            menuItem.show()
        self.premenu=menu.simple_menu_item('Open Douban.fm',[],_('_Open Douban.fm'),
                                           None, None,[],self.menu)
        providers.register('menubar-file-menu',self.premenu)

        self.modemenu=menu.simple_menu_item('DoubanFM Mode',[],_('_DoubanFM Mode'),
                                            gtk.STOCK_FULLSCREEN,self.show_mode,
                                            accelerator='<Control>D')
        self.accelerator_mode = Accelerator('<Control>D',self.show_mode)
        providers.register('menubar-view-menu',self.modemenu)
        providers.register('mainwindow-accelerators', self.accelerator_mode)
Ejemplo n.º 50
0
    def on_gui_loaded(self):
        """
            Called when Exaile finished loading its GUI
        """
        # Trigger initial setup through options:
        if xl_settings.get_option('plugin/ipconsole/autostart', False):
            self.__show_console()

        # add menuitem to tools menu
        item = menu.simple_menu_item('ipconsole', ['plugin-sep'], _('Show _IPython Console'),
                                     callback=lambda *_args: self.__show_console())
        providers.register('menubar-tools-menu', item)
Ejemplo n.º 51
0
def TrashMenuItem(name,
                  after,
                  get_tracks_func=generic_get_tracks_func,
                  trash_tracks_func=generic_trash_tracks_func,
                  delete_tracks_func=generic_delete_tracks_func):
    return menu.simple_menu_item(
        name,
        after,
        _('_Move to Trash'),
        'user-trash',
        _on_trash_tracks,
        callback_args=[get_tracks_func, trash_tracks_func, delete_tracks_func])
Ejemplo n.º 52
0
 def on_gui_loaded(self):
     """
     Called when the player is loaded.
     """
     # add menu item to tools menu
     self.__menu_item = menu.simple_menu_item(
         'equalizer',
         ['plugin-sep'],
         _('_Equalizer'),
         callback=lambda *x: self.__show_gui(),
     )
     providers.register('menubar-tools-menu', self.__menu_item)
Ejemplo n.º 53
0
def _enable(exaile):
    """
        Enable plugin.
            Create menu item.
    """
    # add menuitem to tools menu
    item = menu.simple_menu_item('ipconsole', ['plugin-sep'], _('Show _IPython Console'),
        callback=lambda *x: show_console(exaile)) 
    providers.register('menubar-tools-menu', item)
    
    if settings.get_option('plugin/ipconsole/autostart', False):
        show_console(exaile)
Ejemplo n.º 54
0
 def on_gui_loaded(self):
     """
         Called when the player is loaded.
     """
     # add menu item to tools menu
     self.__menu_item = menu.simple_menu_item(
         'equalizer',
         ['plugin-sep'],
         _('_Equalizer'),
         callback=lambda *x: self.__show_gui(),
     )
     providers.register('menubar-tools-menu', self.__menu_item)
Ejemplo n.º 55
0
def _enable(exaile):
    """
        Enable plugin.
            Create menu item.
    """
    # add menuitem to tools menu
    item = menu.simple_menu_item('ipconsole', ['plugin-sep'], _('Show _IPython Console'),
        callback=lambda *x: show_console(exaile)) 
    providers.register('menubar-tools-menu', item)
    
    if settings.get_option('plugin/ipconsole/autostart', False):
        show_console(exaile)
Ejemplo n.º 56
0
    def __init__(self, parent):
        menu.Menu.__init__(self, parent)

        self.add_item(
            menu.simple_menu_item(
                'append',
                [],
                _('Append to Current'),
                'gtk-add',
                callback=lambda *args: parent.add_to_playlist(),
            )
        )
Ejemplo n.º 57
0
def __create_playlist_panel_menus():

    # w, n, o, c: window, name, parent, context

    menu.simple_menu_item(
        'new-playlist',
        [],
        _('_New Playlist'),
        'tab-new',
        lambda w, n, o, c: o.add_new_playlist(),
    ).register('playlist-panel-menu')

    menu.simple_menu_item(
        'new-smart-playlist',
        ['new-playlist'],
        _('New _Smart Playlist'),
        'tab-new',
        lambda w, n, o, c: o.add_smart_playlist(),
    ).register('playlist-panel-menu')

    menu.simple_menu_item(
        'import-playlist',
        ['new-smart-playlist'],
        _('_Import Playlist'),
        'document-open',
        lambda w, n, o, c: o.import_playlist(),
    ).register('playlist-panel-menu')

    menu.simple_separator('top-sep', after=['import-playlist'
                                            ]).register('playlist-panel-menu')