Skip to content

Commit

Permalink
Make 'up a dir' show the library we came from
Browse files Browse the repository at this point in the history
  • Loading branch information
wrzwicky committed Nov 15, 2017
1 parent 7fcb4ac commit f7a40e1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fofix/game/SongChoosingScene.py
Expand Up @@ -264,6 +264,7 @@ def resetQueueVars(self):
self.loadLibrary()

def loadLibrary(self):
# self.libraries receives a list[LibraryInfo]
log.debug("Loading libraries in %s" % self.library)
self.loaded = False
self.tiersPresent = False
Expand All @@ -275,6 +276,7 @@ def loadLibrary(self):
self.engine.resource.load(self, "libraries", lambda: song.getAvailableLibraries(self.engine, self.library), onLoad=self.loadSongs, synch=True)

def loadSongs(self, libraries):
# self.songs receives a list[SongInfo]
log.debug("Loading songs in %s" % self.library)
self.engine.resource.load(self, "songs", lambda: song.getAvailableSongsAndTitles(self.engine, self.library, progressCallback=self.progressCallback), onLoad=self.prepareSetlist, synch=True)

Expand Down Expand Up @@ -373,7 +375,7 @@ def prepareSetlist(self, songs):
if isinstance(item, song.SongInfo) and self.startingSelected == item.songName: # TODO: SongDB
self.selectedIndex = i
break
elif isinstance(item, song.LibraryInfo) and self.startingSelected == item.libraryName:
elif isinstance(item, song.LibraryInfo) and self.startingSelected == item.name:
self.selectedIndex = i
break

Expand All @@ -387,6 +389,7 @@ def prepareSetlist(self, songs):
self.selectedIndex += 1
if self.selectedIndex >= len(self.items):
self.selectedIndex = 0
break

self.itemRenderAngles = [0.0] * len(self.items)
self.itemLabels = [None] * len(self.items)
Expand Down Expand Up @@ -751,9 +754,9 @@ def keyPressed(self, key, isUnicode):
return
else:
# else go up a directory
self.library = os.path.dirname(self.library)
self.selectedItem = None
self.loadLibrary()
self.library,self.startingSelected = os.path.split(self.library)
self.selectedItem = None
self.loadLibrary()
else:
self.quit()
elif (c in Player.menuYes and c not in Player.starts) or key == pygame.K_RETURN:
Expand Down

0 comments on commit f7a40e1

Please sign in to comment.