def loadFromFiles(self, dirName, pausing=True): #get backup location backupPath = self.game.backupLocation + "\\" + dirName #restore from backup to save game location if (copy_tree(backupPath, self.game.saveLocation)): print("Loaded backup: \'" + dirName + '\'') if (pausing): pause()
def addToEvidence(i): if (len(possibleEvidence) < 3): print() if (Evidence[i] in eliminated): eliminated.remove(Evidence[i]) if (Evidence[i] not in possibleEvidence): possibleEvidence.append(Evidence[i]) else: print('Already there') pause()
def hotkeySaving(self): #starts listnening when any keyboard key gets released listener = keyboard.Listener(on_release=self.on_release) listener.start() #on pressing enter it stops the listener print( 'F5 to save, F9 to load, Press Enter while the terminal is focused to stop' ) pause(text='') listener.stop()
def updateDescription(): sMenu.description = '\n' possibleGhosts = [] eliminatedGhosts = [] neededList = [] #counts the number of possible evidence in each ghost evidence #if all of them are present the ghost is added to possibleGhosts for ghost in ghostList: evidenceLen = 0 for e in possibleEvidence: if (ghost.evidence_present(e)): evidenceLen += 1 if (evidenceLen == len(possibleEvidence)): possibleGhosts.append(ghost) #if ghost contains eliminated evidence it is added to eliminatedGhosts for evidence in eliminated: for ghost in possibleGhosts: if (ghost.evidence_present(evidence) and ghost not in eliminatedGhosts): #for duplicates eliminatedGhosts.append(ghost) eliminatedGhostsTable = printableTable() eliminatedGhostsTable.style_differentColumns() eliminatedGhostsTable.addRow(['Ghost', 'Evidence', 'Desc']) possibleGhostsTable = printableTable() possibleGhostsTable.setTo(eliminatedGhostsTable) eliminatedGhostsTable.middleAllign.append(0) #adds ghost to it's proper table for ghost in possibleGhosts: if ghost in eliminatedGhosts: eliminatedGhostsTable.addRow( [ghost.name, ghost.Evidence, ghost.desc]) else: possibleGhostsTable.addRow( [ghost.name, ghost.Evidence, ghost.desc]) #adds evidence need to identify for evidence in ghost.Evidence: #evidence possible #duplicates #evidence not eliminated if (evidence not in possibleEvidence and evidence not in neededList and evidence not in eliminated): neededList.append(evidence) if (len(possibleGhosts) > 0): #if present print needed evidence table if (len(neededList) > 0): newTable = printableTable() newTable.drawTitleSeperator = False newTable.addRow(neededList) sMenu.description += '\n' + newTable.getTableTitleFormat( 'Needed Evidence', alignment='left') + '\n' sMenu.description += newTable.getTable() #if present print possible evidence if (len(possibleEvidence) > 0): newTable = printableTable() newTable.drawTitleSeperator = False newTable.addRow(possibleEvidence) sMenu.description += '\n' + newTable.getTableTitleFormat( 'Current Evidence', alignment='left') + '\n' sMenu.description += newTable.getTable() #if present print current eliminated evidence table if (len(eliminated) > 0 and len(possibleEvidence) != 3): newTable = printableTable() newTable.drawTitleSeperator = False newTable.addRow(eliminated) sMenu.description += '\n' + newTable.getTableTitleFormat( 'Eliminated Evidence', alignment='left') + '\n' sMenu.description += newTable.getTable() #if present print current eliminated ghosts table if (len(eliminatedGhosts) > 0): sMenu.description += '\n' + newTable.getTableTitleFormat( 'Eliminated Ghosts', alignment='left') + '\n' sMenu.description += eliminatedGhostsTable.getTable() #print possible ghosts table titleForPossibleTable = 'Possible Ghosts' #if there is only one change the title from possible to confirmed if (len(possibleGhosts) == 1): titleForPossibleTable = 'Confirmed Ghost' sMenu.description += '\n' + newTable.getTableTitleFormat( titleForPossibleTable, alignment='left') + '\n' sMenu.description += possibleGhostsTable.getTable() #no ghosts possible remove last evidence else: possibleEvidence.pop() print('Last added evidence not possible') pause()
def save(self): #call backup with True so user can make a custom note self.backup(True) pause()
def option_1(): print('You have selected the First option') pause()
def option_customKey(): print('You have selected the option with the letter e') pause()
def option_args(args): print('You have selected the second option') print('arg1 is \'' + args[0] + '\' , arg2 is \'' + args[1] + '\'') pause()
def option_2(): print('You have selected the Second option') pause()
def openAuto( self ): #TODO print('auto not available yet') pause() pass