Esempio n. 1
0
def _register_builtin_panels(exaile, window):

    from xlgui.panel import collection, radio, playlists, files

    logger.info("Loading panels...")

    providers.register(
        'main-panel',
        collection.CollectionPanel(window,
                                   exaile.collection,
                                   'collection',
                                   _show_collection_empty_message=True))

    providers.register(
        'main-panel',
        radio.RadioPanel(window, exaile.collection, exaile.radio,
                         exaile.stations, 'radio'))

    providers.register(
        'main-panel',
        playlists.PlaylistsPanel(window, exaile.playlists,
                                 exaile.smart_playlists, exaile.collection,
                                 'playlists'))

    providers.register('main-panel',
                       files.FilesPanel(window, exaile.collection, 'files'))

    providers.register('main-panel', lyrics.LyricsPanel(window, 'lyrics'))
Esempio n. 2
0
    def __init__(self, exaile):
        """
            Initializes the GUI

            @param exaile: The Exaile instance
        """
        from xlgui import main, panel, tray, progress
        from xlgui.panel import collection, radio, playlists, files

        gtk.gdk.set_program_class("Exaile")

        self.exaile = exaile
        self.first_removed = False
        self.tray_icon = None
        self.panels = {}
        self.builder = gtk.Builder()
        self.builder.add_from_file(xdg.get_data_path("ui/main.ui"))
        self.progress_box = self.builder.get_object('progress_box')
        self.progress_manager = progress.ProgressManager(self.progress_box)

        icons.MANAGER.add_icon_name_from_directory('exaile',
                                                   xdg.get_data_path('images'))
        gtk.window_set_default_icon_name('exaile')
        icons.MANAGER.add_icon_name_from_directory('exaile-pause',
                                                   xdg.get_data_path('images'))
        icons.MANAGER.add_icon_name_from_directory('exaile-play',
                                                   xdg.get_data_path('images'))

        for name in ('dynamic', 'repeat', 'shuffle'):
            icon_name = 'media-playlist-%s' % name
            icons.MANAGER.add_icon_name_from_directory(
                icon_name, xdg.get_data_path('images'))

        logger.info("Loading main window...")
        self.main = main.MainWindow(self, self.builder, exaile.collection,
                                    exaile.player, exaile.queue,
                                    covers.MANAGER)
        self.panel_notebook = self.builder.get_object('panel_notebook')
        self.play_toolbar = self.builder.get_object('play_toolbar')

        logger.info("Loading panels...")
        self.panels['collection'] = collection.CollectionPanel(
            self.main.window,
            exaile.collection,
            _show_collection_empty_message=True)
        self.panels['radio'] = radio.RadioPanel(self.main.window,
                                                exaile.collection,
                                                exaile.radio, exaile.stations)
        self.panels['playlists'] = playlists.PlaylistsPanel(
            self.main.window, exaile.playlists, exaile.smart_playlists,
            exaile.collection)
        self.panels['files'] = files.FilesPanel(self.main.window,
                                                exaile.collection)

        for panel in ('collection', 'radio', 'playlists', 'files'):
            self.add_panel(*self.panels[panel].get_panel())

        # add the device panels
        for device in self.exaile.devices.list_devices():
            if device.connected:
                self.add_device_panel(None, None, device)

        logger.info("Connecting panel events...")
        self.main._connect_panel_events()

        if settings.get_option('gui/use_tray', False):
            self.tray_icon = tray.TrayIcon(self.main)

        self.device_panels = {}
        event.add_callback(self.add_device_panel, 'device_connected')
        event.add_callback(self.remove_device_panel, 'device_disconnected')
        event.add_callback(self.on_gui_loaded, 'gui_loaded')

        logger.info("Done loading main window...")
        Main._main = self