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

def AmpacheTools::AmpacheGUI::AmpacheGUI::artists_cursor_changed (   self,
  widget,
  data = None 
)

Selection Methods (Single Click)

The function that runs when the user clicks an artist.

Definition at line 1977 of file AmpacheGUI.py.

01977                                                          : 
            """The function that runs when the user clicks an artist."""
            cursor = widget.get_cursor()
            model  = widget.get_model()
            row    = cursor[0]
            
            artist_name = model[row][0]
            artist_id   = model[row][1]
            
            try:
                  if self.artist_id == artist_id and self.artist_name == artist_name:
                        return True # don't refresh if the user reclicks the artist
            except:
                  pass
            
            self.artist_id   = artist_id
            self.artist_name = artist_name
            
            self.album_id = None # this is the albums refresh
            
            # now display the albums
            model = self.album_list_store
            model.clear()
            self.check_and_populate_albums(self.artist_id)
            if self.artist_id == -1: # all artists
                  albums = self.albums
            else:
                  albums = dbfunctions.get_album_dict(self.db_session, self.artist_id)

            self.update_statusbar("Loading: " + self.artist_name.replace('<b>', '').replace('</b>', ''))
            model.append([_("<b>All Albums (%d)</b>") % (len(albums)), -1, -1, 0])
            for album in albums:
                  album_name     = albums[album]['name']
                  album_year     = albums[album]['year']
                  precise_rating = albums[album]['precise_rating']
                  album_id       = album
                  #self.update_statusbar(_("Fetching Album: ") + album_name)
                  album_string = album_name + ' (' + str(album_year) + ')'
                  if album_year == 0:
                        album_string = album_name
                  model.append([helperfunctions.convert_string_to_html(album_string), album_id, album_year, precise_rating])
            self.update_statusbar(self.artist_name.replace('<b>', '').replace('</b>', ''))
            


Generated by  Doxygen 1.6.0   Back to index