Esempio n. 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()
Esempio n. 2
0
    def on_rescan_button_clicked(self, widget):
        """
            Triggers rescanning the collection
        """

        from xlgui import main
        main.mainwindow().controller.on_rescan_collection()
Esempio n. 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()
Esempio n. 4
0
 def on_rescan_button_clicked(self, widget):
     """
         Triggers rescanning the collection
     """
     
     from xlgui import main
     main.mainwindow().controller.on_rescan_collection()
Esempio n. 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')
Esempio n. 6
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')
Esempio n. 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)
Esempio n. 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)
Esempio n. 9
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)
Esempio n. 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)
Esempio n. 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
Esempio n. 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)
Esempio n. 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
Esempio n. 14
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
Esempio n. 15
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)
Esempio n. 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)
Esempio n. 17
0
def get_main():
    from xlgui import main
    return main.mainwindow()
Esempio n. 18
0
def exaile_ready(event, exaile, nothing):
    global PODCASTS

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

    if not PODCASTS:
        PODCASTS = PodcastPanel(main.mainwindow().window)
        providers.register("main-panel", PODCASTS)
Esempio n. 20
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)
Esempio n. 21
0
def get_main():
    from xlgui import main
    return main.mainwindow()