def next_btn_clicked(self): """ :return: """ self.file_path = self.file_txt.text() if self.file_path == None or self.file_path == "": display_error_message("No path was chosen!", "No file path was chosen.", "Please choose an existing path!") return # print "OS=" + str(self.system) try: self.create_executable() except IOError: # Test for spaces... self.file_path = self.file_path.replace(" ", "\\ ") try: self.create_executable() except IOError: try: self.create_executable() except IOError: self.file_path = self.file_path.replace() display_error_message("Invalid Path!", "The path location you chose is invalid.", "Please choose an existing path") self.open_next_window()
def determine_errors(self): """ Determines if there are any UI form errors. Displays an error message if true, and Returns True Returns False otherwise. :return: True if errors exist, otherwise False. """ error_msg = "" has_error = True # Determine Error Message if self.category is None or not self.category: error_msg += "ERROR: Category field incomplete." if self.name is None or not self.name: error_msg += "\nERROR: Entry Name is incomplete." # Errors for 'known' if self.category is "known": if self.composition is None or not self.composition: error_msg += "\nERROR: Composition is incomplete." # Determine if valid file if is_valid_file(self.file_path) is False: error_msg += "\n" + get_file_error_message(self.file_path) if error_msg is "": # If error Message is empty, then error is false. has_error = False else: # If error exists, display error message window display_error_message("Invalid input.", "Be sure to check that all fields are complete.", error_msg) # If valid fields, then # determine if there is a duplicate molecule entry if has_error is False: if molecule_entry_exists(conn, self.name, self.category): error_msg = "ERROR: Molecule entry already exists with that category and name.\n" \ "Please choose another name, or go to 'Manage Database' " \ "to update the existing entry." display_error_message("Duplicate database entry.", "Please choose another name for your entry.", error_msg) has_error = True self.close() return has_error
def next_btn_action(self): error = None if self.create_database_btn.isChecked(): msg = self.create_new_database() elif self.import_database_btn.isChecked(): self.file_path = str(self.file_txt.text()) if is_file(self.file_path): msg = self.import_database() else: error = "Invalid file selection!" msg = "Please select a valid database file." else: error = "Please choose an option to continue." msg = "Choose an option to create a new or import an existing database." if error is None: self.open_next_window() else: display_error_message(error, msg, msg)
def determine_errors(self): """ Determines if there are any UI form errors. Displays an error message if true, and Returns True Returns False otherwise. :return: True if errors exist, otherwise False. """ error_msg = "" has_error = True # Determine Error Message if self.file_path is None or not self.file_path: error_msg += "ERROR: File Path incomplete." if self.experiment_name is None or not self.experiment_name: error_msg += "\nERROR: Experiment Name is incomplete." if self.composition is None or not self.composition: error_msg += "\nERROR: Composition is incomplete." # Determine if valid file if error.is_valid_file(self.file_path) is False: error_msg += "\n" + error.get_file_error_message(self.file_path) # If error Message is empty, then error is false. if error_msg is "": has_error = False # If error exists, display error message window if has_error is True: display_error_message("Invalid input.", "Be sure to check that all fields are complete.", error_msg) else: if molecules_table.name_exists(conn, str(self.experiment_name)): has_error = True display_error_message("Invalid Experiment Name", "Be sure to create a unique experiment name, or delete the existing entry.", "\n ERROR: Molecule Name already exists.") return has_error
def OK(self): type_index = self.ui.type_cmbobx.currentIndex() format_index = self.ui.format_cmbobx.currentIndex() option = self.option if type_index == -1: display_error_message( "Invalid input.", "Be sure to check that all fields are complete.", "Missing: File Type") return elif format_index == -1: display_error_message( "Invalid input.", "Be sure to check that all fields are complete.", "Missing: File Format") return self.type = self.selected_type self.format = EXPORT_FILE_TYPES[ self.selected_type].formats[format_index] if option is not None: print "NOT NONE" if isinstance(option, self.FTBOption): print "FTB TYPE" self.shots = option.get_shots() if self.shots is None: display_error_message( "Invalid input.", "Be sure to check that all fields are complete.", "Missing: Shots") return elif isinstance(option, self.DelimiterOption): print "DELIMITER TYPE" self.delimiter = option.get_delimiter() if self.delimiter is None: display_error_message( "Invalid input.", "Be sure to check that all fields are complete.", "Missing: Delimiter") return self.accept()
def OK(self): type_index = self.ui.type_cmbobx.currentIndex() format_index = self.ui.format_cmbobx.currentIndex() option = self.option if type_index == -1: display_error_message("Invalid input.", "Be sure to check that all fields are complete.", "Missing: File Type") return elif format_index == -1: display_error_message("Invalid input.", "Be sure to check that all fields are complete.", "Missing: File Format") return self.type = self.selected_type self.format = EXPORT_FILE_TYPES[self.selected_type].formats[format_index] if option is not None: print "NOT NONE" if isinstance(option, self.FTBOption): print "FTB TYPE" self.shots = option.get_shots() if self.shots is None: display_error_message("Invalid input.", "Be sure to check that all fields are complete.", "Missing: Shots") return elif isinstance(option, self.DelimiterOption): print "DELIMITER TYPE" self.delimiter = option.get_delimiter() if self.delimiter is None: display_error_message("Invalid input.", "Be sure to check that all fields are complete.", "Missing: Delimiter") return self.accept()
def throw_no_export_error(self, info, detail): text = "Error: Cannot do export_cleaned_lines!" display_error_message(text,info, detail)