Logo Search packages:      
Sourcecode: viridian version File versions  Download package

def AmpacheTools::AmpacheGUI::AmpacheGUI::main_gui_callback (   self )
Function that gets called after GUI has loaded.
This loads all user variables into memory.

Definition at line 832 of file AmpacheGUI.py.

                                 :
00834             """Function that gets called after GUI has loaded.
00835             This loads all user variables into memory."""
            ### Display Notifications ###
00837             self.display_notifications = self.db_session.variable_get('display_notifications', True)
            ### Automatically Update Cache ###
            self.automatically_update = self.db_session.variable_get('automatically_update', False)
00840             ### Is first time closing application (alert user it is in status bar) ###
            self.first_time_closing = self.db_session.variable_get('first_time_closing', True)
            ### Status tray variables ###
            self.quit_when_window_closed = self.db_session.variable_get('quit_when_window_closed', False)
            ### Downloads Directory ###
            # first check if xdg_downloads exists, if not then check if 
            # ~/Downloads exist, then fallback to ~ (only if the user hasn't set one)
            download_dir = os.path.expanduser("~")
            if GLIB_AVAILABLE: # first try to set the Downloads dir to the users locale Download dir
                  xdg_download_dir = glib.get_user_special_dir(glib.USER_DIRECTORY_DOWNLOAD)
                  if not xdg_download_dir is None: # xdg was set
                        download_dir = xdg_download_dir
                  elif os.path.exists(os.path.join(download_dir, 'Downloads')):
                        download_dir = os.path.join(download_dir, 'Downloads')
            else: # no glib.. try to set it to ~/Downloads
                  if os.path.exists(os.path.join(download_dir, 'Downloads')):
                        download_dir = os.path.join(download_dir, 'Downloads')
            self.downloads_directory = self.db_session.variable_get('downloads_directory', download_dir)
                  
            ### Alternate Row Colors ###
            playlist = self.db_session.variable_get('playlist', True)
            downloads = self.db_session.variable_get('downloads', True)
            artists = self.db_session.variable_get('artists', False)
            albums = self.db_session.variable_get('albums', False)
            songs = self.db_session.variable_get('songs', True)

            self.tree_view_dict['playlist'].set_rules_hint(playlist)
            self.tree_view_dict['downloads'].set_rules_hint(downloads)
            self.tree_view_dict['artists'].set_rules_hint(artists)
            self.tree_view_dict['albums'].set_rules_hint(albums)
            self.tree_view_dict['songs'].set_rules_hint(songs)
                  
            ### Check for credentials and login ###
            username = self.db_session.variable_get('credentials_username')
            password = self.db_session.variable_get('credentials_password')
            url      = self.db_session.variable_get('credentials_url')
            
            self.ampache_conn.set_credentials(username, password, url)
            if self.ampache_conn.has_credentials():
                  self.go_to_ampache_menu_item.set_sensitive(True)
                  self.update_statusbar(_("Attempting to authenticate..."))
                  if self.login_and_get_artists("First"):
                        list = self.db_session.variable_get('current_playlist', None)
                        if list != None:
                              self.load_playlist(list)
                              #self.update_playlist_window()
            else:
                  self.update_statusbar(_("Set Ampache information by going to Edit -> Preferences")) 
                  if self.is_first_time:
                        self.create_dialog_alert("info", _("""This looks like the first time you are running Viridian.  To get started, go to Edit -> Preferences and set your account information."""), True)
            
            if self.db_session.variable_get('enable_xmlrpc_server', False): # start the xmlrpc server
                  self.start_xml_server()
                  


Generated by  Doxygen 1.6.0   Back to index