def btnCreateClick(self): #First, some checks if the Entries given by the user are valid ourCASs = filter(lambda x: self.var_CASs[x].get() == "Yes",self.var_CASs.keys()) notAllCommandsThere = False for c in ourCASs: if self.entry_CASs[c].get().strip() == "": notAllCommandsThere = True if notAllCommandsThere: tkMessageBox.showerror(title = "Some commands missing", message="You must provide the commands for calling the computer algebra systems you want to call on your target machine.") elif self.entry_taskName.get().strip() == "": tkMessageBox.showerror(title = "No Taskname given", message="Your task must have a name.") elif self.entry_Time.get().strip() == "": tkMessageBox.showerror(title = "No time command given", message="You need to specify the time command on your target machine.") elif len(ourCASs)==0: tkMessageBox.showerror(title = "No Computer Algebra System selected", message="You have to select at least one computer algebra system") else: #Everything is fine. Start creating the Export Task folder exportFolder = tkFileDialog.askdirectory(mustexist = True, title = "Choose a directory where the Export Folder should be placed at.") theTask = Task(self.entry_taskName.get().strip(), self.cpInstance.getName(), map(lambda x: x.getName(),self.input_SDTables),self.input_problems,ourCASs) casDict = {} for c in ourCASs: casDict[c] = self.entry_CASs[c].get().strip() ms = MachineSettings(casDict, self.entry_Time.get().strip()) #Now we create the taskfolder. tf = TaskFolderCreator().create(theTask,self.__xmlres,ms) tf.write(exportFolder,self.__xmlres) tkMessageBox.showinfo(title="Successful", message = "The task was successfully created.") self.mainWindow.destroy()
def btnCreateClick(self): #First, some checks if the Entries given by the user are valid ourCASs = filter(lambda x: self.var_CASs[x].get() == "Yes", self.var_CASs.keys()) notAllCommandsThere = False for c in ourCASs: if self.entry_CASs[c].get().strip() == "": notAllCommandsThere = True if notAllCommandsThere: tkMessageBox.showerror( title="Some commands missing", message= "You must provide the commands for calling the computer algebra systems you want to call on your target machine." ) elif self.entry_taskName.get().strip() == "": tkMessageBox.showerror(title="No Taskname given", message="Your task must have a name.") elif self.entry_Time.get().strip() == "": tkMessageBox.showerror( title="No time command given", message= "You need to specify the time command on your target machine.") elif len(ourCASs) == 0: tkMessageBox.showerror( title="No Computer Algebra System selected", message= "You have to select at least one computer algebra system") else: #Everything is fine. Start creating the Export Task folder exportFolder = tkFileDialog.askdirectory( mustexist=True, title= "Choose a directory where the Export Folder should be placed at." ) theTask = Task(self.entry_taskName.get().strip(), self.cpInstance.getName(), map(lambda x: x.getName(), self.input_SDTables), self.input_problems, ourCASs) casDict = {} for c in ourCASs: casDict[c] = self.entry_CASs[c].get().strip() ms = MachineSettings(casDict, self.entry_Time.get().strip()) #Now we create the taskfolder. tf = TaskFolderCreator().create(theTask, self.__xmlres, ms) tf.write(exportFolder, self.__xmlres) tkMessageBox.showinfo(title="Successful", message="The task was successfully created.") self.mainWindow.destroy()
while (flag): CAS = raw_input("On which computer algebra system do you want to execute your calculation? ") while casList.count(CAS) == 0: print "Possible inputs:" print "\n".join(el for el in filter(lambda x: x not in CASs,casList)) CAS = raw_input("Choose your computer algebra system: ") if not CAS in CASs: CASs.append(CAS) tmp = raw_input("Type \"y\" if you want to add further computer algebra systems: ") if tmp !="y": flag = False name = raw_input("Please choose the name for that task: ") while name =="": print "The name shall not be the empty string!" name = raw_input("Please choose the name for that task: ") #Now, we have all information to create the task theTask = Task(name, cpInstance.getName(), map(lambda x: x.getName(),piSDTables),chosenProblemInstances,CASs) casDict = {} for c in CASs: command = raw_input("Command for executing %s on the target-machine: "%c) casDict[c] = command command = raw_input("The time command name on the target machine: ") ms = MachineSettings(casDict, command) #Now we create the taskfolder. tf = TaskFolderCreator().create(theTask,xmlres,ms) pathToSaveInp = raw_input("Now choose to which folder the taskfolder shall be exported: ") while not os.path.isdir(pathToSaveInp): pathToSaveInp = raw_input("Path not valid. Please choose another one: ") tf.write(pathToSaveInp,xmlres) print "Creation of task successful. Goodbye."
curses.echo() curses.endwin() if not CASs: sys.exit(0) # user has aborted print # following code is from Al, again no changes name = raw_input("Please choose the name for that task: ") while name == "": print "The name shall not be the empty string!" name = raw_input("Please choose the name for that task: ") #Now, we have all information to create the task theTask = Task(name, cpInstance.getName(), map(lambda x: x.getName(), piSDTables), chosenProblemInstances, CASs) casDict = {} for c in CASs: command = raw_input("Command for executing %s on the target-machine: " % c) casDict[c] = command command = raw_input("The time command name on the target machine: ") ms = MachineSettings(casDict, command) #Now we create the taskfolder. tf = TaskFolderCreator().create(theTask, xmlres, ms) pathToSaveInp = raw_input( "Now choose to which folder the taskfolder shall be exported: ") while not os.path.isdir(pathToSaveInp): pathToSaveInp = raw_input("Path not valid. Please choose another one: ") tf.write(pathToSaveInp, xmlres) print "Creation of task successful. Goodbye."