def deleteCharacter(self): tsYes = _("Yes") q = Dialogs.chooseItem(self.engine, [tsYes, _("No")], _("Are you sure you want to delete this player?")) if q == tsYes: if self.player: Player.deletePlayer(self.player) self.engine.view.popLayer(self) self.engine.input.removeKeyListener(self)
def checkCmdPlay(self): info = song.loadSongInfo(self.engine, self.songName, library = self.libraryName) guitars = [] drums = [] vocals = [] autoPart = None for part in info.parts: if part.id == 4 or part.id == 7: drums.append(part) elif part.id == 5: vocals.append(part) else: guitars.append(part) if self.engine.cmdPlay == 2 and self.engine.cmdPart is not None and len(self.playerList) == 1: if self.engine.cmdPart == part.id: log.debug("Command-line mode: Part found!") if part.id == 4 and self.engine.input.gameDrums > 0: autoPart = part.id elif part.id == 5 and self.engine.input.gameMics > 0: autoPart = part.id elif self.engine.input.gameGuitars > 0: autoPart = part.id if autoPart is None: if len(drums) == 0 and self.engine.input.gameDrums > 0: if self.splash: Dialogs.hideLoadingSplashScreen(self.engine, self.splash) self.splash = None Dialogs.showMessage(self.engine, _("There are no drum parts in this song. Change your controllers to play.")) if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 return False if len(guitars) == 0 and self.engine.input.gameGuitars > 0: if self.splash: Dialogs.hideLoadingSplashScreen(self.engine, self.splash) self.splash = None Dialogs.showMessage(self.engine, _("There are no guitar parts in this song. Change your controllers to play.")) if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 return False if len(vocals) == 0 and self.engine.input.gameMics > 0: if self.splash: Dialogs.hideLoadingSplashScreen(self.engine, self.splash) self.splash = None Dialogs.showMessage(self.engine, _("There are no vocal parts in this song. Change your controllers to play.")) if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 return False # Make sure the difficulty we chose is available p = self.playerList[0].part player = self.playerList[0] if self.engine.cmdDiff is not None: diff = song.difficulties[self.engine.cmdDiff] if diff in info.partDifficulties[p.id]: self.playerList[0].difficulty = diff else: self.playerList[0].difficulty = info.partDifficulties[p.id][0] else: if self.splash: Dialogs.hideLoadingSplashScreen(self.engine, self.splash) self.splash = None self.playerList[0].difficulty = Dialogs.chooseItem(self.engine, info.partDifficulties[p.id], "%s \n %s" % (song.removeSongOrderPrefixFromName(info.name), _("%s Choose a difficulty:") % player.name), selected = player.difficulty) return True