示例#1
0
    def on_force_rescan_button_clicked(self, widget):
        """
            Triggers a slow rescan of the collection
        """

        from xlgui import main
        main.mainwindow().controller.on_rescan_collection_forced()
示例#2
0
    def on_rescan_button_clicked(self, widget):
        """
            Triggers rescanning the collection
        """

        from xlgui import main
        main.mainwindow().controller.on_rescan_collection()
示例#3
0
 def on_force_rescan_button_clicked(self, widget):
     """
         Triggers a slow rescan of the collection
     """
     
     from xlgui import main
     main.mainwindow().controller.on_rescan_collection_forced()
示例#4
0
 def on_rescan_button_clicked(self, widget):
     """
         Triggers rescanning the collection
     """
     
     from xlgui import main
     main.mainwindow().controller.on_rescan_collection()
示例#5
0
    def _destroy_gui_hooks(self):
        '''
            Removes any hooks from the main Exaile GUI
        '''

        if not self.hooked:
            return

        info_area = main.mainwindow().info_area
        play_toolbar = main.mainwindow().builder.get_object('play_toolbar')

        # detach main GUI elements
        parent = play_toolbar.get_parent()
        parent.remove(play_toolbar)

        parent = info_area.get_parent()
        parent.remove(info_area)

        # detach the element we added to hold them
        parent = self.pane.get_parent()
        parent.remove(self.pane)

        # reattach
        parent.pack_start(info_area, False, False, 0)
        parent.reorder_child(info_area, 0)
        parent.pack_start(play_toolbar, False, False, 0)

        # remove player events
        self._setup_events(event.remove_callback)

        self.hooked = False
        settings.set_option('plugin/previewdevice/shown', False)
        logger.debug('Preview device unhooked')
示例#6
0
文件: __init__.py 项目: che2/exaile
    def _destroy_gui_hooks(self):
        '''
            Removes any hooks from the main Exaile GUI
        '''

        if not self.hooked:
            return

        info_area = main.mainwindow().info_area
        play_toolbar = main.mainwindow().builder.get_object('play_toolbar')

        # detach main GUI elements
        parent = play_toolbar.get_parent()
        parent.remove(play_toolbar)

        parent = info_area.get_parent()
        parent.remove(info_area)

        # detach the element we added to hold them
        parent = self.pane.get_parent()
        parent.remove(self.pane)

        # reattach
        parent.pack_start(info_area, False, False, 0)
        parent.reorder_child(info_area, 0)
        parent.pack_start(play_toolbar, False, False, 0)

        # remove player events
        self._setup_events(event.remove_callback)

        self.hooked = False
        settings.set_option('plugin/previewdevice/shown', False)
        logger.debug('Preview device unhooked')
示例#7
0
    def __init__(self, panel_notebook):
        """
            Adds the button to the main window
            and moves the main menu items
        """
        Gtk.ToggleButton.__init__(self)
        notebook.NotebookAction.__init__(self, panel_notebook)

        self.set_image(
            Gtk.Image.new_from_icon_name('exaile', Gtk.IconSize.BUTTON))
        self.set_tooltip_text(_('Main Menu'))
        self.set_focus_on_click(True)
        self.set_relief(Gtk.ReliefStyle.NONE)

        accessible = self.get_accessible()
        accessible.set_role(Atk.Role.MENU)
        accessible.set_name(_('Main Menu'))

        builder = main.mainwindow().builder

        # Move menu items of the main menu to the internal menu
        self.mainmenu = builder.get_object('mainmenu')
        self.menu = Gtk.Menu()
        self.menu.attach_to_widget(self, lambda *args: False)
        self.menu.connect('deactivate', self.on_menu_deactivate)

        for menuitem in self.mainmenu:
            menuitem.reparent(self.menu)

        self.menu.show_all()
        self.show_all()

        self.connect('toggled', self.on_toggled)
示例#8
0
    def __init__(self, panel_notebook):
        """
            Adds the button to the main window
            and moves the main menu items
        """
        Gtk.ToggleButton.__init__(self)
        notebook.NotebookAction.__init__(self, panel_notebook)

        self.set_image(Gtk.Image.new_from_icon_name('exaile', Gtk.IconSize.BUTTON))
        self.set_tooltip_text(_('Main Menu'))
        self.set_focus_on_click(True)
        self.set_relief(Gtk.ReliefStyle.NONE)

        accessible = self.get_accessible()
        accessible.set_role(Atk.Role.MENU)
        accessible.set_name(_('Main Menu'))

        builder = main.mainwindow().builder

        # Move menu items of the main menu to the internal menu
        self.mainmenu = builder.get_object('mainmenu')
        self.menu = Gtk.Menu()
        self.menu.attach_to_widget(self, lambda *args: False)
        self.menu.connect('deactivate', self.on_menu_deactivate)

        for menuitem in self.mainmenu:
            menuitem.reparent(self.menu)

        self.menu.show_all()
        self.show_all()

        self.connect('toggled', self.on_toggled)
示例#9
0
文件: __init__.py 项目: che2/exaile
    def _init_gui_hooks(self):
        '''
            Initializes any hooks into the main Exaile GUI

            Note that this is rather ugly, but currently exaile doesn't really
            have a better way to do this, and there isn't a better place to
            stick our gui objects.
        '''

        if self.hooked:
            return

        # the info_area will be where we sit, and the info_area
        # will be duplicated for two sides

        # need to move the play_toolbar, and duplicate it
        # also once for each side

        info_area = main.mainwindow().info_area
        play_toolbar = main.mainwindow().builder.get_object('play_toolbar')

        parent = play_toolbar.get_parent()
        parent.remove(play_toolbar)

        parent = info_area.get_parent()
        parent.remove(info_area)

        parent.pack_start(self.pane, False, False, 0)
        parent.reorder_child(self.pane, 0)

        # stick the main player controls into this box
        self.pane1_box.pack_start(info_area, False, False, 0)
        self.pane1_box.pack_start(play_toolbar, False, False, 0)

        # and do it
        self.pane.show_all()

        # add player events
        self._setup_events(event.add_ui_callback)

        self.hooked = True
        settings.set_option('plugin/previewdevice/shown', True)

        logger.debug("Preview device gui hooked")
        event.log_event('preview_device_enabled', self, None)
示例#10
0
    def _init_gui_hooks(self):
        '''
            Initializes any hooks into the main Exaile GUI

            Note that this is rather ugly, but currently exaile doesn't really
            have a better way to do this, and there isn't a better place to
            stick our gui objects.
        '''

        if self.hooked:
            return

        # the info_area will be where we sit, and the info_area
        # will be duplicated for two sides

        # need to move the play_toolbar, and duplicate it
        # also once for each side

        info_area = main.mainwindow().info_area
        play_toolbar = main.mainwindow().builder.get_object('play_toolbar')

        parent = play_toolbar.get_parent()
        parent.remove(play_toolbar)

        parent = info_area.get_parent()
        parent.remove(info_area)

        parent.pack_start(self.pane, False, False, 0)
        parent.reorder_child(self.pane, 0)

        # stick the main player controls into this box
        self.pane1_box.pack_start(info_area, False, False, 0)
        self.pane1_box.pack_start(play_toolbar, False, False, 0)

        # and do it
        self.pane.show_all()

        # add player events
        self._setup_events(event.add_ui_callback)

        self.hooked = True
        settings.set_option('plugin/previewdevice/shown', True)

        logger.debug("Preview device gui hooked")
        event.log_event('preview_device_enabled', self, None)
示例#11
0
    def get_track(self, track_id, filename):
        """
            Save the track with track_id to filename
        """
        for t in self.tracks:
            if t.id == track_id:
                try:
                    t.save(filename)
                except httplib.CannotSendRequest:
                    Gtk.MessageDialog(
                        main.mainwindow().window, Gtk.DialogFlags.MODAL,
                        Gtk.MessageType.INFO, Gtk.ButtonsType.OK,
                        _("""This server does not support multiple connections.
You must stop playback before downloading songs."""))
                    return
示例#12
0
    def save_selected(self, widget=None, event=None):
        """
            Save the selected tracks to disk.
        """
        items = self.get_selected_items()
        dialog = Gtk.FileChooserDialog(
            _("Select a Location for Saving"),
            main.mainwindow().window, Gtk.FileChooserAction.SELECT_FOLDER,
            (Gtk.STOCK_OPEN, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL,
             Gtk.ResponseType.CANCEL))
        dialog.set_current_folder(xdg.get_last_dir())
        dialog.set_select_multiple(False)
        result = dialog.run()
        dialog.hide()

        if result == Gtk.ResponseType.OK:
            folder = dialog.get_current_folder()
            self.save_items(items, folder)
示例#13
0
    def get_track(self, track_id, filename):
        """
        Save the track with track_id to filename
        """
        for t in self.tracks:
            if t.id == track_id:
                try:
                    t.save(filename)
                except http.client.CannotSendRequest:
                    Gtk.MessageDialog(
                        buttons=Gtk.ButtonsType.OK,
                        message_type=Gtk.MessageType.INFO,
                        modal=True,
                        text=
                        _("""This server does not support multiple connections.
You must stop playback before downloading songs."""),
                        transient_for=main.mainwindow().window,
                    )
                    return
示例#14
0
文件: __init__.py 项目: exaile/exaile
    def get_track(self, track_id, filename):
        """
            Save the track with track_id to filename
        """
        for t in self.tracks:
            if t.id == track_id:
                try:
                    t.save(filename)
                except httplib.CannotSendRequest:
                    Gtk.MessageDialog(
                        main.mainwindow().window,
                        Gtk.DialogFlags.MODAL,
                        Gtk.MessageType.INFO,
                        Gtk.ButtonsType.OK,
                        _(
                            """This server does not support multiple connections.
You must stop playback before downloading songs."""
                        ),
                    )
                    return
示例#15
0
文件: __init__.py 项目: exaile/exaile
    def save_selected(self, widget=None, event=None):
        """
            Save the selected tracks to disk.
        """
        items = self.get_selected_items()
        dialog = Gtk.FileChooserDialog(
            _("Select a Location for Saving"),
            main.mainwindow().window,
            Gtk.FileChooserAction.SELECT_FOLDER,
            (
                Gtk.STOCK_OPEN,
                Gtk.ResponseType.OK,
                Gtk.STOCK_CANCEL,
                Gtk.ResponseType.CANCEL,
            ),
        )
        dialog.set_current_folder(xdg.get_last_dir())
        dialog.set_select_multiple(False)
        result = dialog.run()
        dialog.hide()

        if result == Gtk.ResponseType.OK:
            folder = dialog.get_current_folder()
            self.save_items(items, folder)
示例#16
0
 def _on_playback_error(self, type, player, message):
     """
         Called when there has been a playback error
     """
     main.mainwindow().message.show_error(_('Playback error encountered!'),
                                          message)
示例#17
0
文件: menu.py 项目: thiblahute/exaile
def get_main():
    from xlgui import main
    return main.mainwindow()
示例#18
0
def exaile_ready(event, exaile, nothing):
    global PODCASTS

    if not PODCASTS:
        PODCASTS = PodcastPanel(main.mainwindow().window)
        providers.register('main-panel', PODCASTS)
示例#19
0
def exaile_ready(event, exaile, nothing):
    global PODCASTS

    if not PODCASTS:
        PODCASTS = PodcastPanel(main.mainwindow().window)
        providers.register("main-panel", PODCASTS)
示例#20
0
文件: __init__.py 项目: che2/exaile
 def _on_playback_error(self, type, player, message):
     """
         Called when there has been a playback error
     """
     main.mainwindow().message.show_error(
         _('Playback error encountered!'), message)
示例#21
0
def get_main():
    from xlgui import main
    return main.mainwindow()