예제 #1
0
    def __init__(self, exaile):
        self.exaile = exaile
        self.do_shutdown = False

        # add menuitem to tools menu
        providers.register(
            'menubar-tools-menu',
            menu.simple_separator('plugin-sep', ['track-properties']))

        item = menu.check_menu_item(
            'shutdown',
            ['plugin-sep'],
            _('Shutdown after Playback'),
            #   checked func                # callback func
            lambda *x: self.do_shutdown,
            lambda w, n, p, c: self.on_toggled(w))
        providers.register('menubar-tools-menu', item)

        self.countdown = None
        self.counter = 10

        self.message = dialogs.MessageBar(
            parent=exaile.gui.builder.get_object('player_box'),
            buttons=gtk.BUTTONS_CLOSE)
        self.message.connect('response', self.on_response)
예제 #2
0
파일: __init__.py 프로젝트: exaile/exaile
    def on_gui_loaded(self):
        save_on_exit = settings.get_option(
            'plugin/history/save_on_exit', history_preferences.save_on_exit_default
        )
        shown = settings.get_option('plugin/history/shown', False)

        # immutable playlist that stores everything we've played
        self.history_loc = os.path.join(xdg.get_data_dir(), 'history')

        self.history_playlist = HistoryPlaylist(player.PLAYER)

        if save_on_exit:
            self.history_playlist.load_from_location(self.history_loc)

        self.history_page = HistoryPlaylistPage(self.history_playlist, player.PLAYER)
        self.history_tab = NotebookTab(main.get_playlist_notebook(), self.history_page)

        # add menu item to 'view' to display our playlist
        self.menu = menu.check_menu_item(
            'history',
            '',
            _('Playback history'),
            lambda *e: self.is_shown(),
            self.on_playback_history,
        )

        providers.register('menubar-view-menu', self.menu)

        # add the history playlist to the primary notebook
        if save_on_exit and shown:
            self.show_history(True)
예제 #3
0
    def on_gui_loaded(self):
        save_on_exit = settings.get_option(
            'plugin/history/save_on_exit',
            history_preferences.save_on_exit_default)
        shown = settings.get_option('plugin/history/shown', False)

        # immutable playlist that stores everything we've played
        self.history_loc = os.path.join(xdg.get_data_dir(), 'history')

        self.history_playlist = HistoryPlaylist(player.PLAYER)

        if save_on_exit:
            self.history_playlist.load_from_location(self.history_loc)

        self.history_page = HistoryPlaylistPage(self.history_playlist,
                                                player.PLAYER)
        self.history_tab = NotebookTab(main.get_playlist_notebook(),
                                       self.history_page)

        # add menu item to 'view' to display our playlist
        self.menu = menu.check_menu_item(
            'history',
            '',
            _('Playback history'),
            lambda *e: self.is_shown(),
            self.on_playback_history,
        )

        providers.register('menubar-view-menu', self.menu)

        # add the history playlist to the primary notebook
        if save_on_exit and shown:
            self.show_history(True)
예제 #4
0
    def on_provider_added(self, provider):

        if provider.name is None:
            logger.warn("Ignoring improperly initialized panel provider: %s",
                        provider)
            return

        panel = provider.get_panel()
        panel.show()

        tab = notebook.NotebookTab(self, panel, vertical=True)
        tab.provider = provider

        item = menu.check_menu_item(
            provider.name, [], panel.get_page_name(),
            lambda *a: self.panels[provider.name].shown,
            lambda *a: self.toggle_panel(provider.name))

        providers.register('panel-tab-context', item)

        self.add_tab(tab, panel)
        self.panels[provider.name] = PanelData(tab, provider,
                                               self.get_n_pages() - 1, item)

        self.save_panel_settings()
예제 #5
0
파일: menu.py 프로젝트: thiblahute/exaile
def __create_view_menu():
    items = []
    accelerators = []

    def show_playing_track_cb(*args):
        get_main().playlist_container.show_current_track()
    items.append(menuitems.ShowCurrentTrackMenuItem('show-playing-track', [],
        show_playing_track_cb, accelerator='<Control>j'))
    accelerators.append(Accelerator('<Control>j', show_playing_track_cb))

    items.append(_sep('show-playing-track-sep', [items[-1].name]))

    def playlist_utilities_cb(widget, name, parent, context):
        settings.set_option('gui/playlist_utilities_bar_visible',
            widget.get_active())
    def playlist_utilities_is_checked(name, parent, context):
        return settings.get_option('gui/playlist_utilities_bar_visible', True)
    items.append(menu.check_menu_item('playlist-utilities', [items[-1].name],
        _("_Playlist Utilities Bar"), playlist_utilities_is_checked, playlist_utilities_cb))

    items.append(_smi('columns', [items[-1].name], _('_Columns'),
        submenu=menu.ProviderMenu('playlist-columns-menu', get_main())))

    def clear_playlist_cb(*args):
        page = get_main().get_selected_page()
        if page:
            page.playlist.clear()
    items.append(_smi('clear-playlist', [items[-1].name], _('C_lear playlist'),
         gtk.STOCK_CLEAR, clear_playlist_cb, accelerator='<Control>l'))
    accelerators.append(Accelerator('<Control>l', clear_playlist_cb))

    for item in items:
        providers.register('menubar-view-menu', item)
    for accelerator in accelerators:
        providers.register('mainwindow-accelerators', accelerator)
예제 #6
0
파일: panels.py 프로젝트: thiblahute/exaile
    def on_provider_added(self, provider):

        if provider.name is None:
            logger.warn("Ignoring improperly initialized panel provider: %s" %
                        provider)
            return

        panel = provider.get_panel()
        panel.show()

        tab = notebook.NotebookTab(self, panel, display_left=True)
        panel.tab_menu = self.view_menu
        tab.provider = provider

        item = menu.check_menu_item(
            provider.name, [], panel.get_page_name(),
            lambda *a: self.panels[provider.name].shown,
            lambda *a: self.toggle_panel(provider.name))

        self.view_menu.add_item(item)

        self.add_tab(tab, panel)
        self.panels[provider.name] = PanelData(tab, provider,
                                               self.get_n_pages() - 1, item)

        self.save_panel_settings()
예제 #7
0
파일: __init__.py 프로젝트: exaile/exaile
    def __init__(self, exaile):
        self.exaile = exaile
        self.do_shutdown = False

        # add menuitem to tools menu
        providers.register(
            'menubar-tools-menu',
            menu.simple_separator('plugin-sep', ['track-properties']),
        )

        item = menu.check_menu_item(
            'shutdown',
            ['plugin-sep'],
            _('Shutdown after Playback'),
            #   checked func                # callback func
            lambda *x: self.do_shutdown,
            lambda w, n, p, c: self.on_toggled(w),
        )
        providers.register('menubar-tools-menu', item)

        self.countdown = None
        self.counter = 10

        self.message = dialogs.MessageBar(
            parent=exaile.gui.builder.get_object('player_box'),
            buttons=Gtk.ButtonsType.CLOSE,
        )
        self.message.connect('response', self.on_response)
예제 #8
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')
예제 #9
0
def __create_view_menu():
    items = []
    accelerators = []

    def show_playing_track_cb(*args):
        get_main().playlist_container.show_current_track()

    def show_playing_track_sensitive():
        from xl import player
        return player.PLAYER.get_state() != 'stopped'

    accelerators.append(
        Accelerator('<Primary>j', _("_Show Playing Track"),
                    show_playing_track_cb))
    items.append(
        _smi('show-playing-track', [],
             icon_name='go-jump',
             callback=accelerators[-1],
             sensitive_cb=show_playing_track_sensitive))

    items.append(_sep('show-playing-track-sep', [items[-1].name]))

    def playlist_utilities_cb(widget, name, parent, context):
        settings.set_option('gui/playlist_utilities_bar_visible',
                            widget.get_active())

    def playlist_utilities_is_checked(name, parent, context):
        return settings.get_option('gui/playlist_utilities_bar_visible', True)

    items.append(
        menu.check_menu_item('playlist-utilities', [items[-1].name],
                             _("_Playlist Utilities Bar"),
                             playlist_utilities_is_checked,
                             playlist_utilities_cb))

    items.append(
        _smi('columns', [items[-1].name],
             _('C_olumns'),
             submenu=menu.ProviderMenu('playlist-columns-menu', get_main())))

    def clear_playlist_cb(*args):
        page = get_main().get_selected_page()
        if page:
            page.playlist.clear()

    accelerators.append(
        Accelerator('<Primary>l', _('_Clear playlist'), clear_playlist_cb))
    items.append(
        _smi('clear-playlist', [items[-1].name],
             icon_name='edit-clear-all',
             callback=accelerators[-1]))

    for item in items:
        providers.register('menubar-view-menu', item)
    for accelerator in accelerators:
        providers.register('mainwindow-accelerators', accelerator)
예제 #10
0
def __create_view_menu():
    items = []
    accelerators = []

    def show_playing_track_cb(*args):
        get_main().playlist_container.show_current_track()

    items.append(
        menuitems.ShowCurrentTrackMenuItem('show-playing-track', [],
                                           show_playing_track_cb,
                                           accelerator='<Control>j'))
    accelerators.append(Accelerator('<Control>j', show_playing_track_cb))

    items.append(_sep('show-playing-track-sep', [items[-1].name]))

    def playlist_utilities_cb(widget, name, parent, context):
        settings.set_option('gui/playlist_utilities_bar_visible',
                            widget.get_active())

    def playlist_utilities_is_checked(name, parent, context):
        return settings.get_option('gui/playlist_utilities_bar_visible', True)

    items.append(
        menu.check_menu_item('playlist-utilities', [items[-1].name],
                             _("_Playlist Utilities Bar"),
                             playlist_utilities_is_checked,
                             playlist_utilities_cb))

    items.append(
        _smi('columns', [items[-1].name],
             _('_Columns'),
             submenu=menu.ProviderMenu('playlist-columns-menu', get_main())))

    def clear_playlist_cb(*args):
        page = get_main().get_selected_page()
        if page:
            page.playlist.clear()

    items.append(
        _smi('clear-playlist', [items[-1].name],
             _('C_lear playlist'),
             gtk.STOCK_CLEAR,
             clear_playlist_cb,
             accelerator='<Control>l'))
    accelerators.append(Accelerator('<Control>l', clear_playlist_cb))

    for item in items:
        providers.register('menubar-view-menu', item)
    for accelerator in accelerators:
        providers.register('mainwindow-accelerators', accelerator)
예제 #11
0
 def on_provider_added(self, provider):
     
     if provider.name is None:
         logger.warn("Ignoring improperly initialized panel provider: %s" % provider)
         return
     
     panel = provider.get_panel()
     panel.show()
     
     tab = notebook.NotebookTab(self, panel, vertical=True)
     panel.tab_menu = self.view_menu
     tab.provider = provider
     
     item = menu.check_menu_item(provider.name, [], 
                                 panel.get_page_name(),
                                 lambda *a: self.panels[provider.name].shown,
                                 lambda *a: self.toggle_panel(provider.name))
     
     self.view_menu.add_item(item)
     
     self.add_tab(tab, panel)
     self.panels[provider.name] = PanelData(tab, provider, self.get_n_pages()-1, item)
     
     self.save_panel_settings()
예제 #12
0
파일: __init__.py 프로젝트: dangmai/exaile
    def __init__(self, exaile):
        self.exaile = exaile
        self.do_shutdown = False

        # add menuitem to tools menu
        providers.register("menubar-tools-menu", menu.simple_separator("plugin-sep", ["track-properties"]))

        item = menu.check_menu_item(
            "shutdown",
            ["plugin-sep"],
            _("Shutdown after Playback"),
            #   checked func                # callback func
            lambda *x: self.do_shutdown,
            lambda w, n, p, c: self.on_toggled(w),
        )
        providers.register("menubar-tools-menu", item)

        self.countdown = None
        self.counter = 10

        self.message = dialogs.MessageBar(
            parent=exaile.gui.builder.get_object("player_box"), buttons=Gtk.ButtonsType.CLOSE
        )
        self.message.connect("response", self.on_response)
예제 #13
0
    def _init_gui(self):
        self.pane = Gtk.Paned()

        # 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()
        self.info_area.set_no_show_all(True)

        volume_control = playback.VolumeControl(self.player)
        self.info_area.get_action_area().pack_start(volume_control, True, True,
                                                    0)

        self.playpause_button = Gtk.Button()
        self.playpause_button.set_relief(Gtk.ReliefStyle.NONE)
        self._on_playback_end(None, None, None)
        self.playpause_button.connect('button-press-event',
                                      self._on_playpause_button_clicked)

        self.progress_bar = playback.SeekProgressBar(self.player,
                                                     use_markers=False)

        play_toolbar = Gtk.Box()
        play_toolbar.pack_start(self.playpause_button, False, False, 0)
        play_toolbar.pack_start(self.progress_bar, True, True, 0)

        # stick our player controls into this box
        self.pane1_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        self.pane2_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.pane2_box.pack_start(self.info_area, False, False, 0)
        self.pane2_box.pack_start(play_toolbar, False, False, 0)

        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_ui_callback(self._on_option_set, 'option_set')
예제 #14
0
def __create_view_menu():
    items = []
    accelerators = []

    def show_playing_track_cb(*args):
        get_main().playlist_container.show_current_track()

    def show_playing_track_sensitive():
        from xl import player

        return player.PLAYER.get_state() != 'stopped'

    accelerators.append(
        Accelerator('<Primary>j', _("_Show Playing Track"), show_playing_track_cb)
    )
    items.append(
        _smi(
            'show-playing-track',
            [],
            icon_name='go-jump',
            callback=accelerators[-1],
            sensitive_cb=show_playing_track_sensitive,
        )
    )

    items.append(_sep('show-playing-track-sep', [items[-1].name]))

    def playlist_utilities_cb(widget, name, parent, context):
        settings.set_option('gui/playlist_utilities_bar_visible', widget.get_active())

    def playlist_utilities_is_checked(name, parent, context):
        return settings.get_option('gui/playlist_utilities_bar_visible', True)

    items.append(
        menu.check_menu_item(
            'playlist-utilities',
            [items[-1].name],
            _("_Playlist Utilities Bar"),
            playlist_utilities_is_checked,
            playlist_utilities_cb,
        )
    )

    items.append(
        _smi(
            'columns',
            [items[-1].name],
            _('C_olumns'),
            submenu=menu.ProviderMenu('playlist-columns-menu', get_main()),
        )
    )

    def clear_playlist_cb(*args):
        page = get_main().get_selected_page()
        if page:
            page.playlist.clear()

    accelerators.append(
        Accelerator('<Primary>l', _('_Clear playlist'), clear_playlist_cb)
    )
    items.append(
        _smi(
            'clear-playlist',
            [items[-1].name],
            icon_name='edit-clear-all',
            callback=accelerators[-1],
        )
    )

    for item in items:
        providers.register('menubar-view-menu', item)
    for accelerator in accelerators:
        providers.register('mainwindow-accelerators', accelerator)
예제 #15
0
파일: __init__.py 프로젝트: exaile/exaile
    def _init_gui(self):
        self.pane = Gtk.Paned()

        # stolen from main
        self.info_area = main.MainWindowTrackInfoPane(self.player)
        self.info_area.set_auto_update(True)
        self.info_area.set_border_width(3)
        self.info_area.hide()
        self.info_area.set_no_show_all(True)

        volume_control = playback.VolumeControl(self.player)
        self.info_area.get_action_area().pack_end(volume_control, False, False, 0)

        self.playpause_button = Gtk.Button()
        self.playpause_button.set_relief(Gtk.ReliefStyle.NONE)
        self._on_playback_end(None, None, None)
        self.playpause_button.connect(
            'button-press-event', self._on_playpause_button_clicked
        )

        self.progress_bar = playback.SeekProgressBar(self.player, use_markers=False)
        self.progress_bar.set_valign(Gtk.Align.CENTER)

        play_toolbar = Gtk.Box()
        play_toolbar.pack_start(self.playpause_button, False, False, 0)
        play_toolbar.pack_start(self.progress_bar, True, True, 0)
        play_toolbar.child_set_property(self.progress_bar, 'padding', 3)

        # stick our player controls into this box
        self.pane1_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        self.pane2_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.pane2_box.pack_start(self.info_area, False, False, 0)
        self.pane2_box.pack_start(play_toolbar, False, False, 0)

        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_ui_callback(self._on_option_set, 'option_set')