def __init__(self, exaile): """ Initializes the GUI @param exaile: The Exaile instance """ from xlgui import icons, main, panels, tray, progress Gdk.set_program_class("Exaile") self.exaile = exaile self.first_removed = False self.tray_icon = None 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) for name in ('exaile', 'exaile-pause', 'exaile-play', 'folder-music', 'audio-x-generic', 'office-calendar', 'extension', 'music-library', 'artist', 'genre'): icons.MANAGER.add_icon_name_from_directory( name, xdg.get_data_path('images')) Gtk.Window.set_default_icon_name('exaile') 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) if self.exaile.options.StartMinimized: self.main.window.iconify() self.play_toolbar = self.builder.get_object('play_toolbar') panel_notebook = self.builder.get_object('panel_notebook') self.panel_notebook = panels.PanelNotebook(exaile, self) self.device_panels = {} # 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() guiutil.gtk_widget_replace(panel_notebook, self.panel_notebook) self.panel_notebook.get_parent() \ .child_set_property(self.panel_notebook, 'shrink', False) if settings.get_option('gui/use_tray', False): if tray.is_supported(): self.tray_icon = tray.TrayIcon(self.main) else: settings.set_option('gui/use_tray', False) logger.warn( "Tray icons are not supported on your platform. Disabling tray icon." ) from xl import event event.add_ui_callback(self.add_device_panel, 'device_connected') event.add_ui_callback(self.remove_device_panel, 'device_disconnected') event.add_ui_callback(self.on_gui_loaded, 'gui_loaded') logger.info("Done loading main window...") Main._main = self
def __init__(self, preferences, widget): widgets.CheckPreference.__init__(self, preferences, widget) widgets.Conditional.__init__(self) if not tray.is_supported(): self.widget.set_tooltip_text( _("Tray icons are not supported on your platform"))
def on_check_condition(self): return tray.is_supported()
def __init__(self, exaile): """ Initializes the GUI @param exaile: The Exaile instance """ from xlgui import icons, main, panels, tray, progress Gdk.set_program_class("Exaile") # For GNOME Shell # https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/Clients/ApplicationProperties/ GLib.set_application_name("Exaile") os.environ['PULSE_PROP_media.role'] = 'music' self.exaile = exaile self.first_removed = False self.tray_icon = None 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) add_icon = icons.MANAGER.add_icon_name_from_directory images_dir = xdg.get_data_path('images') exaile_icon_path = add_icon('exaile', images_dir) Gtk.Window.set_default_icon_name('exaile') if xdg.local_hack: # PulseAudio also attaches the above name to streams. However, if # Exaile is not installed, any app trying to display the icon won't # be able to find it just by name. The following is a hack to tell # PA the icon file path instead of the name; this only works on # some clients, e.g. pavucontrol. os.environ['PULSE_PROP_application.icon_name'] = exaile_icon_path for name in ('exaile-pause', 'exaile-play', 'folder-music', 'audio-x-generic', 'office-calendar', 'extension', 'music-library', 'artist', 'genre'): add_icon(name, images_dir) for name in ('dynamic', 'repeat', 'shuffle'): add_icon('media-playlist-' + name, images_dir) logger.info("Loading main window...") self.main = main.MainWindow(self, self.builder, exaile.collection) if self.exaile.options.StartMinimized: self.main.window.iconify() self.play_toolbar = self.builder.get_object('play_toolbar') panel_notebook = self.builder.get_object('panel_notebook') self.panel_notebook = panels.PanelNotebook(exaile, self) self.device_panels = {} # 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() guiutil.gtk_widget_replace(panel_notebook, self.panel_notebook) self.panel_notebook.get_parent() \ .child_set_property(self.panel_notebook, 'shrink', False) if settings.get_option('gui/use_tray', False): if tray.is_supported(): self.tray_icon = tray.TrayIcon(self.main) else: settings.set_option('gui/use_tray', False) logger.warn( "Tray icons are not supported on your platform. Disabling tray icon." ) from xl import event event.add_ui_callback(self.add_device_panel, 'device_connected') event.add_ui_callback(self.remove_device_panel, 'device_disconnected') event.add_ui_callback(self.on_gui_loaded, 'gui_loaded') logger.info("Done loading main window...") Main._main = self if sys.platform == 'darwin': self._setup_osx()
def __init__(self, exaile): """ Initializes the GUI @param exaile: The Exaile instance """ from xlgui import icons, main, panels, tray, progress Gdk.set_program_class("Exaile") self.exaile = exaile self.first_removed = False self.tray_icon = None 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) for name in ('exaile', 'exaile-pause', 'exaile-play', 'folder-music', 'audio-x-generic', 'office-calendar', 'extension', 'music-library', 'artist', 'genre'): icons.MANAGER.add_icon_name_from_directory(name, xdg.get_data_path('images')) Gtk.Window.set_default_icon_name('exaile') 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) if self.exaile.options.StartMinimized: self.main.window.iconify() self.play_toolbar = self.builder.get_object('play_toolbar') panel_notebook = self.builder.get_object('panel_notebook') self.panel_notebook = panels.PanelNotebook(exaile, self) self.device_panels = {} # 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() guiutil.gtk_widget_replace(panel_notebook, self.panel_notebook) self.panel_notebook.get_parent() \ .child_set_property(self.panel_notebook, 'shrink', False) if settings.get_option('gui/use_tray', False): if tray.is_supported(): self.tray_icon = tray.TrayIcon(self.main) else: settings.set_option('gui/use_tray', False) logger.warn("Tray icons are not supported on your platform. Disabling tray icon.") from xl import event event.add_ui_callback(self.add_device_panel, 'device_connected') event.add_ui_callback(self.remove_device_panel, 'device_disconnected') event.add_ui_callback(self.on_gui_loaded, 'gui_loaded') logger.info("Done loading main window...") Main._main = self
def __init__(self, preferences, widget): widgets.CheckPreference.__init__(self, preferences, widget) widgets.Conditional.__init__(self) if not tray.is_supported(): self.widget.set_tooltip_text(_("Tray icons are not supported on your platform"))
def __init__(self, exaile): """ Initializes the GUI @param exaile: The Exaile instance """ from xlgui import icons, main, panels, tray, progress Gdk.set_program_class("Exaile") # For GNOME Shell # https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/Clients/ApplicationProperties/ GLib.set_application_name("Exaile") os.environ['PULSE_PROP_media.role'] = 'music' self.exaile = exaile self.first_removed = False self.tray_icon = None 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) add_icon = icons.MANAGER.add_icon_name_from_directory images_dir = xdg.get_data_path('images') exaile_icon_path = add_icon('exaile', images_dir) Gtk.Window.set_default_icon_name('exaile') if xdg.local_hack: # PulseAudio also attaches the above name to streams. However, if # Exaile is not installed, any app trying to display the icon won't # be able to find it just by name. The following is a hack to tell # PA the icon file path instead of the name; this only works on # some clients, e.g. pavucontrol. os.environ['PULSE_PROP_application.icon_name'] = exaile_icon_path for name in ( 'exaile-pause', 'exaile-play', 'office-calendar', 'extension', 'music-library', 'artist', 'genre', ): add_icon(name, images_dir) for name in ('dynamic', 'repeat', 'shuffle'): add_icon('media-playlist-' + name, images_dir) logger.info("Loading main window...") self.main = main.MainWindow(self, self.builder, exaile.collection) if self.exaile.options.StartMinimized: self.main.window.iconify() self.play_toolbar = self.builder.get_object('play_toolbar') panel_notebook = self.builder.get_object('panel_notebook') self.panel_notebook = panels.PanelNotebook(exaile, self) self.device_panels = {} # 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() guiutil.gtk_widget_replace(panel_notebook, self.panel_notebook) self.panel_notebook.get_parent().child_set_property( self.panel_notebook, 'shrink', False ) if settings.get_option('gui/use_tray', False): if tray.is_supported(): self.tray_icon = tray.TrayIcon(self.main) else: settings.set_option('gui/use_tray', False) logger.warn( "Tray icons are not supported on your platform. Disabling tray icon." ) from xl import event event.add_ui_callback(self.add_device_panel, 'device_connected') event.add_ui_callback(self.remove_device_panel, 'device_disconnected') event.add_ui_callback(self.on_gui_loaded, 'gui_loaded') logger.info("Done loading main window...") Main._main = self if sys.platform == 'darwin': self._setup_osx()