def check_files_amount(self): flag = True if len(self.files) <= 0: QMessageBox.about(self, "Load CSV", "One file at least should be chosen") flag = False return flag
def check_choose(self): flag = True temp = [] for item in self.group_selected_items.values(): if item: for i in item: temp.append(i) if len(temp) == 0: QMessageBox.about(self, "Features", "One feature at least should be chosen") flag = False return flag
def check_int(self, number, condition, title, message_body): try: # print type(number) val = int(number) if val <= condition: QMessageBox.about(self, title, "The number should > %s" % condition) return False except ValueError: QMessageBox.about(self, title, message_body) return False return True
def createTimeSeriesFeatures(self, files, saved_dir, window, group_selected_items, step): import TimeSeriesFeatures as TS # saved_dir = saved_dir[0].encode('utf-8') for input_path in files: output_path = generate_csv_from_bag(saved_dir, input_path) print "++++++++++++++++++++++++++ ", output_path print "in = %s out = %s " % (input_path, output_path) print "step = %s" % step ts = TS.TimeSeries(input_path, output_path, window, group_selected_items, step) ts.generate_time_series_features() QMessageBox.about(self, "csv save", "csv was saved successfuly")
def check_validation(self): flag = self.check_files_amount() flag = flag & self.check_choose() flag = flag & self.check_int(self.window.text(), 2, "Error in Window Time", "That's not a number!") flag = flag & self.check_int(self.step.text(), 0, "Error in Step", "That's not a integer!") # TODO selected topic not empty if self.saved_dir == []: QMessageBox.about(self, "Save CSV", "Select path for saving") flag = False return flag
def help(self): ''' Prints out the help dialogue ''' helpDialog = QMessageBox.about( self._widget, "About RecordUI", "This is RecordUI, a tool to record robot animations.\n \n Keyboard shortcuts: \n \n \ New: Ctrl + N \n \ Open: Ctrl + O \n \ Save: Ctrl + S \n \ Save as: Ctrl + Shift + S \n \n \ Play Init: Ctrl + I \n \ Play Frame: Ctrl + P \n \ Play Next: Alt + P \n \ Play Animation: Ctrl + Shift + P \n \ Play Until: Ctrl + Alt + P \n \n \ Record Frame: Space \n \ Duplicate Frame: '+' \n \ Delete Frame: '-' \n \ Undo: Ctrl + Z \n \ Redo: Ctrl + Y \n \ Help: Ctrl + H \n \n \ Mirror to Left: Ctrl + Left Arrow \n \ Mirror to Right: Ctrl + Right Arrow \n \ Invert: Ctrl + Down Arrow")
def onButtonClicked(self): import inspect, os filepath = os.path.dirname( os.path.abspath(inspect.getfile( inspect.currentframe()))) + "/log/save_csv.log" current_directory = self.get_current_opened_directory(filepath) window = self.window.text() try: val = float(window) except ValueError: QMessageBox.about(self, "Error in Window Time", "That's not a number!") return if val >= self.duration: QMessageBox.about( self, "Error in Window Time", "time need to be smaller than: " + str(self.duration)) return # filename = QFileDialog.getSaveFileName(self, self.tr('csv File'), current_directory, self.tr('csv (*.csv)')) saved_dir = str( QFileDialog.getExistingDirectory(self, "Select Directory", current_directory)) # if filename[0] != '': # with open(filepath, "w") as f: # f.write(filename[0]) if saved_dir != '': with open(filepath, "w") as f: f.write(saved_dir) topics = self.selected_bag_topics specific_features_selection = self.selected_specific_features general_features_selection = self.selected_general_features with open(get_path() + 'logger.log', "w") as f: for topic in topics: f.write(topic + "\n") for topic1 in specific_features_selection: f.write(topic1 + "\n") for topic2 in general_features_selection: f.write(topic2 + "\n") ef = E.ExtractFeatures(topics, float(window), specific_features_selection, general_features_selection) counter = 0 for bag_file in self.bag_files: df = ef.generate_features(bag_file) if len(self.bag_files) == 1: counter = -1 # temp = filename + "/" + # temp = get_corrent_file_name(filename[0], ".csv", counter) csv_path = generate_csv_from_bag(saved_dir, bag_file) # temp = "%s_%s%s" % (filename[0],counter,".csv") E.write_to_csv(csv_path, df) counter = counter + 1 QMessageBox.about(self, "csv export", "csv was exported successfuly")
def onButtonClicked(self): counter = 0 for item in self.client_answers_items: try: val = float(item.text()) except ValueError: QMessageBox.about(self, "Error in data", "That's not a number!") return if item.text() == "": QMessageBox.about(self, "Missing data", "Fill the missing data") return condition = self.greather_conditions[counter][1] param = self.greather_conditions[counter][0] print "condition = %s param = %s val = %s" % (condition, param, val) # print param if not condition == NO_COND: if val <= float(condition): QMessageBox.about(self, "Missing match condition", "the condition must be satisfied: %s > %s" % (param, condition)) return counter = counter + 1 self.button_clicked = True self.close() self.ParamsSelected.emit(self.client_answers_items, self.label_items, self.id_radio)
def showError(self, message): QMessageBox.about(self, "ERROR", message)
def _update_popup(self): QMessageBox.about(self, "Record", "record successfuly")
def displayMessage(self, message): QMessageBox.about(self, "Result", message)