Пример #1
0
    def onSaveClicked(self):
        import inspect, os
        filepath = os.path.dirname(
            os.path.abspath(inspect.getfile(
                inspect.currentframe()))) + "/log/save_history.log"
        # print self.files
        # print self.window.text()
        # print self.group_selected_items.values()

        # print self.group_selected_items
        current_directory = self.get_current_opened_directory(filepath)
        # print current_directory
        # self._to_save_filename = QFileDialog.getSaveFileName(self, self.tr('csv File'), current_directory,
        #                                                      self.tr('csv (*.csv)'))
        self.saved_dir = str(
            QFileDialog.getExistingDirectory(self, "Select Directory",
                                             current_directory))
        # if self._to_save_filename[0] != "":
        #     with open(filepath, "w") as f:
        #         f.write(self._to_save_filename[0])
        if self.saved_dir != "":
            with open(filepath, "w") as f:
                f.write(self.saved_dir)

                # handler = logging.FileHandler(filepath, mode='w')
                # logger_topic.addHandler(handler)
                # print self._to_save_filename[0]
                # logger_topic.info()
        # self.save_path.setText(get_corrent_file_name(self._to_save_filename[0], ".csv"))
        self.save_path.setText(self.saved_dir)
Пример #2
0
 def save_as(self):
     '''
     Saves all currently recorded frames into a json file, which is saved at a user specified location
     '''
     self.treeModeChanged(self._previousTreeMode)
     self._saveDir = QFileDialog.getExistingDirectory()
     self._recorder.save_animation(self._saveDir, self._widget.lineAnimationName.text(), self._checkBoxesSave)
Пример #3
0
 def open_directory_dialogue(self):
     return QFileDialog.getExistingDirectory(
         None,
         "Select a directory to save gaits. Directory must be "
         "a subdirectory of march_gait_files or be named resources.",
         os.path.join(self.march_path, "ros2", "src", "gaits",
                      "march_gait_files"),
     )
Пример #4
0
 def save(self):
     '''
     Saves all currently recorded frames into a json file
     '''
     self.treeModeChanged(self._previousTreeMode)
     self.set_metadata()
     if not self._saveDir:
         self._saveDir = QFileDialog.getExistingDirectory()
     status = self._recorder.save_animation(self._saveDir, self._widget.lineAnimationName.text(), self._checkBoxesSave)
     self._widget.statusBar.showMessage(status)
Пример #5
0
 def change_gait_directory(self):
     self.gait_directory = str(
         QFileDialog.getExistingDirectory(
             None, 'Select a directory to save gaits'))
     if self.gait_directory == '':  # If directory dialogue is canceled
         self.gait_directory = None
         self.change_gait_directory_button.setText(
             'Select a gait directory...')
     else:
         self.change_gait_directory_button.setText(self.gait_directory)
Пример #6
0
 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")
Пример #7
0
    def _add_algorithm(self, file_name=None):
        if file_name is None:
            file_name = QFileDialog.getExistingDirectory(
                self._widget, self.tr('Upload Algorithm'), None,
                QFileDialog.ShowDirsOnly)
            if file_name is None or file_name == '':
                return

        path = home + '/deploy/algorithms.txt'
        if file_name:
            file_object = open(path, 'a')
            file_object.write(file_name + '\n')
            file_object.close()
            print("Added Algorithm ")
Пример #8
0
 def save_as(self):
     '''
     Saves all currently recorded frames into a json file, which is saved at a user specified location
     '''
     if self._recorder.get_animation_state():
         self.treeModeChanged(self._previousTreeMode)
         rp = rospkg.RosPack()
         self._saveDir = QFileDialog.getExistingDirectory(directory=str(
             rp.get_path('wolfgang_animations') + "/animations"))
         self._recorder.save_animation(
             self._saveDir, self._widget.lineAnimationName.text(),
             self._checkBoxesSave)
     else:
         self._widget.statusBar.showMessage("There is nothing to save!")
         return
Пример #9
0
 def handle_select(self):
     # TODO(lucasw) have a parameter define which kind of dialog to use
     file_dir = self.current_line_edit.text()
     new_file_dir = None
     if self.mode == "file_save":
         new_file_dir, tmp = QFileDialog.getSaveFileName(caption="Select a save file",
                                                         directory=os.path.dirname(file_dir))
     elif self.mode == "file_open":
         new_file_dir, tmp = QFileDialog.getOpenFileName(caption="Select a file",
                                                         directory=os.path.dirname(file_dir))
     else:  # elif mode == "dir":
         new_file_dir = QFileDialog.getExistingDirectory(caption="Select a directory",
                                                         directory=os.path.dirname(file_dir))
     if new_file_dir is not None and new_file_dir != "":
         self.current_line_edit.setText(new_file_dir)
         self.publish()
Пример #10
0
 def save(self):
     '''
     Saves all currently recorded frames into a json file
     '''
     if self._recorder.get_animation_state():
         self.treeModeChanged(self._previousTreeMode)
         self.set_metadata()
         if not self._saveDir:
             rp = rospkg.RosPack()
             #QFileDialogue throws a gtk warning, that can not be suppressed or fixed. Should be ignored.
             self._saveDir = QFileDialog.getExistingDirectory(directory=str(
                 rp.get_path('wolfgang_animations') + "/animations"))
         status = self._recorder.save_animation(
             self._saveDir, self._widget.lineAnimationName.text(),
             self._checkBoxesSave)
         self._widget.statusBar.showMessage(status)
     else:
         self._widget.statusBar.showMessage("There is nothing to save!")
         return
 def open_directory_dialogue(self):
     return QFileDialog.getExistingDirectory(None, 'Select a directory to save gaits')
Пример #12
0
 def on_qt_fileopen_btn_clicked(self):
     dir = QFileDialog.getExistingDirectory(self, 'Open a folder',
                                            self._path_model.cur_dir)
     self._update_cur_dir(dir)
     self._update_bagbtn_enable()