def stop(self): machine_status = resultByIDDao.ResultByIDDao.get_test_status(settings.test_number)[0] if(machine_status == 0 or machine_status == 3 or machine_status == 4): misc.createPopup(settings.languageList[20][settings.language], "390x150") elif(machine_status == 1): resultByIDDao.ResultByIDDao.setTestStatus(2) self.status = self.getStatus() self.progress_label.configure(text=settings.languageList[1][settings.language] + ' ' + self.status) else: misc.createPopup(settings.languageList[28][settings.language], "390x150")
def reset(self): machine_status = resultByIDDao.ResultByIDDao.get_test_status(settings.test_number)[0] if(machine_status == 1 or machine_status == 2): resultByIDDao.ResultByIDDao.setTestStatus(0) self.status = self.getStatus() self.progress_label.configure(text=settings.languageList[1][settings.language] + ' ' + self.status) elif(machine_status == 0): misc.createPopup(settings.languageList[13][settings.language] + '!', "340x140") else: resultByIDDao.ResultByIDDao.setNewRow() settings.test_number += 1 self.status = self.getStatus() self.progress_label.configure(text=settings.languageList[1][settings.language] + ' ' + self.status)
def start(self): machine_status = resultByIDDao.ResultByIDDao.get_test_status(settings.test_number)[0] if(machine_status == 1): misc.createPopup(settings.languageList[27][settings.language], "310x100") elif(machine_status == 2): resultByIDDao.ResultByIDDao.setTestStatus(1) #In Progress self.status = self.getStatus() self.progress_label.configure(text=settings.languageList[1][settings.language] + ' ' + self.status) #motorRoutine.fakeMotorRoutine(self) TODO: modify this after testing elif(machine_status == 0): self.win = tk.Toplevel(self) self.win.config(bd=5, relief='raised') #self.win.config(cursor="none") if(settings.language==2): self.win.geometry("600x250") else: self.win.geometry("450x250") misc.center(self.win) self.win.wm_title(settings.languageList[21][settings.language]) idLabelTitle = Label(self.win, text=settings.languageList[22][settings.language]) idLabelTitle.config(font=("Arial", 17, 'bold')) idLabelTitle.grid(row=0, columnspan=2) idLabel = Label(self.win, text=settings.languageList[23][settings.language]) idLabel.config(font=("Arial", 17)) idLabel.grid(sticky=E, row=1, column=0, padx=10, pady=50) self.e1 = Entry(self.win, font=("Arial", 18)) self.e1.bind('<Button-1>', self.keyboard) self.e1.grid(sticky=E, row=1, column=1) quitButton = Button(self.win, borderwidth=5, text=settings.languageList[25][settings.language], command=self.win.destroy, bg="red") quitButton.config(font=("Arial", 20)) quitButton.grid(row=2, column=1, sticky=E, pady=5, padx=10) submitButton = Button(self.win, borderwidth=5, text=settings.languageList[24][settings.language], command=self.submit, bg='green3') submitButton.config(font=("Arial", 20)) submitButton.grid(row=2, column=0, sticky=W, pady=5, padx=10) else: resultByIDDao.ResultByIDDao.setNewRow() settings.test_number += 1 resultByIDDao.ResultByIDDao.setTestStatus(0) #Ready to start self.status = self.getStatus() self.progress_label.configure(text=settings.languageList[1][settings.language] + ' ' + self.status) self.start()
def findPressureError(detailed_id, test_section, test_number, message): retval = False pressure_vals = detailedResultsDao.DetailedResultsDao.get_pressure_by_test_section( test_number, test_section) for pressure in pressure_vals: if (pressure > 0): time = detailedResultsDao.DetailedResultsDao.get_time_by_id( detailed_id)[0] velocity = detailedResultsDao.DetailedResultsDao.get_velocity_by_id( detailed_id)[0] message += (test_section + '\n' + '\n' + settings.languageList[33][settings.language] + ' ' + settings.languageList[37][settings.language] + '\n' + settings.languageList[34][settings.language] + ' ' + str(time) + ' s ' + settings.languageList[35][settings.language] + ' ' + str(velocity) + ' m/s ') misc.createPopup(message, "600x300") retval = True break detailed_id += 1 return retval
def destroyPage(w, b): f = b.get_data("file") buf = b.get_data("buffer") if misc.bufferModified(buf, f) is True: if f is None: f = _("Untitled") save = misc.createPopup(_("Save document"), mainwin, \ _("Save changes to document \"%s\"\n before closing?") % os.path.basename(f)) if save == gtk.RESPONSE_YES: if csave(None, False) is False: return False if save == gtk.RESPONSE_CANCEL or save == gtk.RESPONSE_DELETE_EVENT: return False nb.remove_page(nb.page_num(b)) if nb.get_n_pages() < 1: createPage(nb) return True
def destroyPage(w, b): f = b.get_data("file") buf = b.get_data("buffer") if misc.bufferModified(buf, f) is True: if f is None: f = _("Untitled") save = misc.createPopup(_("Save document"), mainwin, \ _("Save changes to document \"%s\"\n before closing?") % os.path.basename(f)) if save == gtk.RESPONSE_YES: if csave(None, False) is False: return False if save == gtk.RESPONSE_CANCEL or save == gtk.RESPONSE_DELETE_EVENT: return False nb.remove_page(nb.page_num(b)) if nb.get_n_pages() < 1: createPage(nb) else: mainwin.set_title(getCurrentPage().get_data("title")) return True
def getFailureInfo(self, isPrevious): if (isPrevious): test_number = settings.test_number - 1 else: test_number = settings.test_number message = settings.languageList[40][settings.language] + ' ' failure_mode = resultByIDDao.ResultByIDDao.get_failure_mode(test_number)[0] detailed_id = detailedResultsDao.DetailedResultsDao.get_first_id_by_test_id( test_number)[0] if (failure_mode == 1): #overheat overheat_vals = detailedResultsDao.DetailedResultsDao.get_overheat( test_number) for val in overheat_vals: if (val > 0): test_section = detailedResultsDao.DetailedResultsDao.get_test_section_by_id( detailed_id)[0] time = detailedResultsDao.DetailedResultsDao.get_time_by_id( detailed_id)[0] velocity = detailedResultsDao.DetailedResultsDao.get_velocity_by_id( detailed_id)[0] message += (test_section + '\n' + '\n' + settings.languageList[33][settings.language] + ' ' + settings.languageList[36][settings.language] + '\n' + settings.languageList[34][settings.language] + ' ' + str(time) + ' s ' + settings.languageList[35][settings.language] + ' ' + str(velocity) + ' m/s ') misc.createPopup(message, "600x300") break detailed_id += 1 elif (failure_mode == 2): #Air Leak or Device Activation errorFound = False sectionList = ['1A', '1B', '4A', '4B'] for test_section in sectionList: detailed_id = detailedResultsDao.DetailedResultsDao.get_first_id_by_test_section( test_number, test_section)[0] errorFound = findPressureError(detailed_id, test_section, test_number, message) if (errorFound): break elif (failure_mode == 3): #Failure to Exhaust Air sectionList = ['2A', '2B', '3A', '3B'] for test_section in sectionList: detailed_id = detailedResultsDao.DetailedResultsDao.get_first_id_by_test_section( test_number, test_section)[0] errorFound = findNoExhaustError(detailed_id, test_section, test_number, message) if (errorFound): break elif (failure_mode == 4): #Failure to Exhaust Air sectionList = ['2A', '2B', '3A', '3B'] for test_section in sectionList: detailed_id = detailedResultsDao.DetailedResultsDao.get_first_id_by_test_section( test_number, test_section)[0] errorFound = findOverExhaustError(detailed_id, test_section, test_number, message) if (errorFound): break
def csvExport(self): misc.csvExport() misc.createPopup(settings.languageList[32][settings.language], "150x120")