示例#1
0
 def _handle_load_clicked(self):
     # path = QFileDialog.getOpenFileName(self, self.tr('Load from File'), '.', self.tr('Bag files {.bag} (*.bag)'))
     # path = str(QFileDialog.getExistingDirectory(self, "Select Directory"))
     import inspect
     filepath = os.path.dirname(
         os.path.abspath(inspect.getfile(
             inspect.currentframe()))) + "/log/select_bag.log"
     current_directory = self.get_current_opened_directory(filepath)
     fd = QFileDialog(self)
     wc = "Bag files {.bag} (*.bag)"
     path, filter = fd.getOpenFileNamesAndFilter(
         filter=wc, initialFilter=('*.bag'), directory=current_directory)
     # print path
     if len(path) != 0:
         with open(filepath, "w") as f:
             f.write(path[0])
     # if path[0][-4:] == ".bag":   # file
     #     print "True"
     #     self.load_bag(path[0])
     #     files = [path[0]]
     # else: #dir
     #     print "Else " + path
     #     path = path + "/"
     #     files = self.get_bag_files(path)
     #     print files
     #
     # # files = self.get_bag_files("/home/lab/bagfiles/")
     if path:
         self.get_features_from_bags(path)
示例#2
0
    def onButtonClicked(self):
        import inspect, os
        filepath = os.path.dirname(
            os.path.abspath(inspect.getfile(
                inspect.currentframe()))) + "/log/select_history.log"
        fd = QFileDialog(self)
        wc = "Csv files {.csv} (*.csv)"
        self.files = []
        current_directory = self.get_current_opened_directory(filepath)
        tmp_pathes, filter = fd.getOpenFileNamesAndFilter(
            filter=wc, initialFilter=('*.csv'), directory=current_directory)
        for path in tmp_pathes:
            self.files.append(path.encode("utf-8"))
        # print self.files
        if len(self.files) != 0:
            self.get_min_rows_csv(tmp_pathes)
            self.select_path.setText(self.files[0])
            with open(filepath, "w") as f:
                f.write(self.files[0])

                # handler = logging.FileHandler(filepath, mode='w')
                # logger_topic.addHandler(handler)
                # logger_topic.info(self.files[0])
        else:
            self.select_path.setText("")
示例#3
0
 def onPlpClicked(self):
     import inspect, os
     filepath = os.path.dirname(
         os.path.abspath(inspect.getfile(
             inspect.currentframe()))) + "/log/save_plp.log"
     current_directory = self.get_current_opened_directory(filepath)
     fd = QFileDialog(self)
     wc = "Csv files {.py} (*.py)"
     # print current_directory
     filename, filter = fd.getOpenFileNamesAndFilter(
         filter=wc, initialFilter=('*.py'), directory=current_directory)
     if len(filename):
         self.plp_filename = filename[0]
         with open(filepath, "w") as f:
             f.write(self.plp_filename)
         self.select_path.setText(self.plp_filename)