def removeCode(self): if len(self.currentFolder.childFilesNames) > 0: choiceFileName = qs.listChoice(self.currentFolder.childFilesNames) choiceFile = self.currentFolder.childFiles[choiceFileName] choiceFile.removeCode() else: print("You have no files")
def changeFolder(self): print(self.currentFolder.childFoldersNames) if len(self.currentFolder.childFoldersNames) > 0: changeFolder = qs.listChoice(self.currentFolder.childFoldersNames) self.previousFolder = self.currentFolder self.currentFolder = self.currentFolder.childFolders[changeFolder] else: print("You have no other folders in here")
def editCode(self): codeToEdit = qs.listChoice(self.codeList) indexToChange = self.codeList.index(codeToEdit) self.code[codeToEdit].data = qs.editQuestion( self.code[codeToEdit].data).rstrip() nameOfEdit = self.code[codeToEdit].data[0:10] self.codeList[indexToChange] = f"{nameOfEdit}..." self.code[f"{nameOfEdit}..."] = self.code[codeToEdit] self.code[f"{nameOfEdit}..."].regenerateCode() del self.code[codeToEdit]
def removeCode(self): codeToRemove = qs.listChoice(self.codeList) del self.code[codeToRemove] self.codeList.remove(codeToRemove)
from WebsiteClass import Website import questions as qs initialChoices = ['New Website', 'Load Website'] initialAction = qs.listChoice(initialChoices) posibleChoices = [ 'createFolder', 'goBackAFolder', 'createFile', 'checkEntireStructure', 'checkCurrentFolder', 'editCode', 'addCode', 'checkFile', 'removeCode', 'changeFolder', 'endEditing', ] folderRelatedCommands = [ 'createFolder', 'goBackAFolder', 'checkCurrentFolder', 'changeFolder' ] fileRelatedCommands = [ 'createFile', 'checkFile', 'addCode', 'removeCode', 'editCode' ] otherRelatedCommands = ['checkEntireStructure', 'endEditing'] dicitionaryOfChoiches = { 'folderRelated': folderRelatedCommands, 'fileRelated': fileRelatedCommands, 'other': otherRelatedCommands