def init(self): """ Init main application """ self.settings = Settings.new() # Mount enclosing volume as soon as possible uris = self.settings.get_music_uris() try: for uri in uris: if uri.startswith("file:/"): continue f = Gio.File.new_for_uri(uri) f.mount_enclosing_volume(Gio.MountMountFlags.NONE, None, None, None) except Exception as e: print("Application::init():", e) self.__is_fs = False cssProviderFile = Lio.File.new_for_uri( "resource:///org/gnome/Lollypop/application.css") cssProvider = Gtk.CssProvider() cssProvider.load_from_file(cssProviderFile) screen = Gdk.Screen.get_default() styleContext = Gtk.StyleContext() styleContext.add_provider_for_screen(screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.db = Database() self.playlists = Playlists() # We store cursors for main thread SqlCursor.add(self.db) SqlCursor.add(self.playlists) self.albums = AlbumsDatabase() self.artists = ArtistsDatabase() self.genres = GenresDatabase() self.tracks = TracksDatabase() self.player = Player() self.scanner = CollectionScanner() self.art = Art() self.notify = NotificationManager() self.art.update_art_size() if self.settings.get_value("artist-artwork"): GLib.timeout_add(5000, self.art.cache_artists_info) if LastFM is not None: self.lastfm = LastFM() if not self.settings.get_value("disable-mpris"): from lollypop.mpris import MPRIS MPRIS(self) settings = Gtk.Settings.get_default() self.__gtk_dark = settings.get_property( "gtk-application-prefer-dark-theme") if not self.__gtk_dark: dark = self.settings.get_value("dark-ui") settings.set_property("gtk-application-prefer-dark-theme", dark) # Map some settings to actions self.add_action(self.settings.create_action("playback")) self.add_action(self.settings.create_action("shuffle")) self.db.upgrade()
def init(self): """ Init main application """ self.settings = Settings.new() # Mount enclosing volume as soon as possible uris = self.settings.get_music_uris() try: for uri in uris: if uri.startswith("file:/"): continue f = Gio.File.new_for_uri(uri) f.mount_enclosing_volume(Gio.MountMountFlags.NONE, None, None, None) except Exception as e: Logger.error("Application::init(): %s" % e) cssProviderFile = Gio.File.new_for_uri( "resource:///org/gnome/Lollypop/application.css") cssProvider = Gtk.CssProvider() cssProvider.load_from_file(cssProviderFile) screen = Gdk.Screen.get_default() styleContext = Gtk.StyleContext() styleContext.add_provider_for_screen(screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.db = Database() self.playlists = Playlists() self.albums = AlbumsDatabase() self.artists = ArtistsDatabase() self.genres = GenresDatabase() self.tracks = TracksDatabase() self.player = Player() self.inhibitor = Inhibitor() self.scanner = CollectionScanner() self.art = Art() self.notify = NotificationManager() self.art.update_art_size() self.task_helper = TaskHelper() self.art_helper = ArtHelper() self.spotify = SpotifyHelper() if not self.settings.get_value("disable-mpris"): from lollypop.mpris import MPRIS MPRIS(self) settings = Gtk.Settings.get_default() self.__gtk_dark = settings.get_property( "gtk-application-prefer-dark-theme") if not self.__gtk_dark: dark = self.settings.get_value("dark-ui") settings.set_property("gtk-application-prefer-dark-theme", dark) ApplicationActions.__init__(self) startup_one_ids = self.settings.get_value("startup-one-ids") startup_two_ids = self.settings.get_value("startup-two-ids") if startup_one_ids: self.settings.set_value("state-one-ids", startup_one_ids) self.settings.set_value("state-three-ids", GLib.Variant("ai", [])) if startup_two_ids: self.settings.set_value("state-two-ids", startup_two_ids)
def init(self): """ Init main application """ self.settings = Settings.new() # Mount enclosing volume as soon as possible uris = self.settings.get_music_uris() try: for uri in uris: if uri.startswith("file:/"): continue f = Gio.File.new_for_uri(uri) f.mount_enclosing_volume(Gio.MountMountFlags.NONE, None, None, None) except Exception as e: Logger.error("Application::init(): %s" % e) cssProviderFile = Gio.File.new_for_uri( "resource:///org/gnome/Lollypop/application.css") cssProvider = Gtk.CssProvider() cssProvider.load_from_file(cssProviderFile) screen = Gdk.Screen.get_default() styleContext = Gtk.StyleContext() styleContext.add_provider_for_screen(screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.db = Database() self.cache = CacheDatabase() self.playlists = Playlists() self.albums = AlbumsDatabase(self.db) self.artists = ArtistsDatabase(self.db) self.genres = GenresDatabase(self.db) self.tracks = TracksDatabase(self.db) self.player = Player() self.inhibitor = Inhibitor() self.scanner = CollectionScanner() self.notify = NotificationManager() self.task_helper = TaskHelper() self.art_helper = ArtHelper() self.art = Art() self.art.update_art_size() self.ws_director = DirectorWebService() self.ws_director.start() if not self.settings.get_value("disable-mpris"): from lollypop.mpris import MPRIS MPRIS(self) settings = Gtk.Settings.get_default() self.__gtk_dark = settings.get_property( "gtk-application-prefer-dark-theme") if not self.__gtk_dark: dark = self.settings.get_value("dark-ui") settings.set_property("gtk-application-prefer-dark-theme", dark) ApplicationActions.__init__(self) monitor = Gio.NetworkMonitor.get_default() if monitor.get_network_available() and\ not monitor.get_network_metered() and\ self.settings.get_value("recent-youtube-dl"): self.task_helper.run(install_youtube_dl)
def init(self): """ Init main application """ self.__is_fs = False if Gtk.get_minor_version() > 18: cssProviderFile = Gio.File.new_for_uri( 'resource:///org/gnome/Lollypop/application.css') else: cssProviderFile = Gio.File.new_for_uri( 'resource:///org/gnome/Lollypop/application-legacy.css') cssProvider = Gtk.CssProvider() cssProvider.load_from_file(cssProviderFile) screen = Gdk.Screen.get_default() styleContext = Gtk.StyleContext() styleContext.add_provider_for_screen(screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.settings = Settings.new() self.db = Database() self.playlists = Playlists() # We store cursors for main thread SqlCursor.add(self.db) SqlCursor.add(self.playlists) self.albums = AlbumsDatabase() self.artists = ArtistsDatabase() self.genres = GenresDatabase() self.tracks = TracksDatabase() self.player = Player() self.scanner = CollectionScanner() self.art = Art() self.art.update_art_size() if self.settings.get_value('artist-artwork'): GLib.timeout_add(5000, self.art.cache_artists_info) if LastFM is not None: self.lastfm = LastFM() if not self.settings.get_value('disable-mpris'): # Ubuntu > 16.04 if Gtk.get_minor_version() > 18: from lollypop.mpris import MPRIS # Ubuntu <= 16.04, Debian Jessie, ElementaryOS else: from lollypop.mpris_legacy import MPRIS MPRIS(self) if not self.settings.get_value('disable-notifications'): from lollypop.notification import NotificationManager self.notify = NotificationManager() settings = Gtk.Settings.get_default() dark = self.settings.get_value('dark-ui') settings.set_property('gtk-application-prefer-dark-theme', dark) self.__parser = TotemPlParser.Parser.new() self.__parser.connect('entry-parsed', self.__on_entry_parsed) self.add_action(self.settings.create_action('shuffle')) self.db.upgrade()
def init(self): """ Init main application """ cssProviderFile = Gio.File.new_for_uri( 'resource:///org/gnome/Lollypop/application.css') cssProvider = Gtk.CssProvider() cssProvider.load_from_file(cssProviderFile) screen = Gdk.Screen.get_default() styleContext = Gtk.StyleContext() styleContext.add_provider_for_screen(screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.settings = Settings.new() ArtSize.BIG = self.settings.get_value('cover-size').get_int32() if LastFM is not None: self.lastfm = LastFM() self.db = Database() self.playlists = Playlists() # We store cursors for main thread SqlCursor.add(self.db) SqlCursor.add(self.playlists) self.albums = AlbumsDatabase() self.artists = ArtistsDatabase() self.genres = GenresDatabase() self.tracks = TracksDatabase() self.player = Player() self.scanner = CollectionScanner() self.art = Art() if not self.settings.get_value('disable-mpris'): MPRIS(self) if not self.settings.get_value('disable-mpd'): self.mpd = MpdServerDaemon( self.settings.get_value('mpd-eth').get_string(), self.settings.get_value('mpd-port').get_int32()) if not self.settings.get_value('disable-notifications'): self.notify = NotificationManager() settings = Gtk.Settings.get_default() dark = self.settings.get_value('dark-ui') settings.set_property('gtk-application-prefer-dark-theme', dark) self._parser = TotemPlParser.Parser.new() self._parser.connect('entry-parsed', self._on_entry_parsed) self.add_action(self.settings.create_action('shuffle')) self._is_fs = False