Beispiel #1
0
    def show_open_dialog(self, directory=False):
        dialog = FileOperator.get_open_dialog(directory_mode=directory,
                                              parent=self,
                                              name_filter="full")
        if dialog.exec_():
            try:
                file_names = dialog.selectedFiles()
                folders = [
                    folder for folder in file_names if os.path.isdir(folder)
                ]

                if len(folders) > 0:
                    folder = folders[0]
                    for f in self.signal_tab_controller.signal_frames:
                        self.close_signal_frame(f)

                    self.project_manager.set_project_folder(folder)
                else:
                    self.setCursor(Qt.WaitCursor)
                    file_names = FileOperator.uncompress_archives(
                        file_names, QDir.tempPath())
                    self.add_files(file_names)
                    self.unsetCursor()
            except Exception as e:
                Errors.generic_error(self.tr("Failed to open"), str(e),
                                     traceback.format_exc())
                self.unsetCursor()
 def on_btn_open_clicked(self):
     dialog = FileOperator.get_open_dialog(directory_mode=False,
                                           parent=self,
                                           name_filter="fuzz")
     if dialog.exec_():
         for filename in dialog.selectedFiles():
             self.load_from_file(filename)
Beispiel #3
0
 def on_compare_frame_controller_load_protocol_clicked(self):
     dialog = FileOperator.get_open_dialog(directory_mode=False,
                                           parent=self,
                                           name_filter="proto")
     if dialog.exec_():
         for filename in dialog.selectedFiles():
             self.add_protocol_file(filename)
Beispiel #4
0
    def show_open_dialog(self, directory=False):
        dialog = FileOperator.get_open_dialog(directory_mode=directory, parent=self, name_filter="full")
        if dialog.exec_():
            try:
                file_names = dialog.selectedFiles()
                folders = [folder for folder in file_names if os.path.isdir(folder)]

                if len(folders) > 0:
                    folder = folders[0]
                    for f in self.signal_tab_controller.signal_frames:
                        self.close_signal_frame(f)

                    self.project_manager.set_project_folder(folder)
                else:
                    self.setCursor(Qt.WaitCursor)
                    file_names = FileOperator.uncompress_archives(file_names, QDir.tempPath())
                    self.add_files(file_names)
                    self.unsetCursor()
            except Exception as e:
                Errors.generic_error(self.tr("Failed to open"), str(e), traceback.format_exc())
                self.unsetCursor()
 def on_btn_load_clicked(self):
     dialog = FileOperator.get_open_dialog(False,
                                           parent=self,
                                           name_filter="simulator")
     if dialog.exec_():
         self.load_simulator_file(dialog.selectedFiles()[0])
Beispiel #6
0
    def test_get_open_dialog(self):
        d1 = FileOperator.get_open_dialog(directory_mode=False)
        self.assertEqual(d1.fileMode(), QFileDialog.ExistingFiles)

        d2 = FileOperator.get_open_dialog(directory_mode=True)
        self.assertEqual(d2.fileMode(), QFileDialog.Directory)
Beispiel #7
0
 def on_compare_frame_controller_load_protocol_clicked(self):
     dialog = FileOperator.get_open_dialog(directory_mode=False, parent=self, name_filter="proto")
     if dialog.exec_():
         for filename in dialog.selectedFiles():
             self.add_protocol_file(filename)
Beispiel #8
0
 def on_btn_load_clicked(self):
     dialog = FileOperator.get_open_dialog(False, parent=self, name_filter="simulator")
     if dialog.exec_():
         self.load_simulator_file(dialog.selectedFiles()[0])
Beispiel #9
0
 def on_btn_open_clicked(self):
     dialog = FileOperator.get_open_dialog(directory_mode=False, parent=self, name_filter="fuzz")
     if dialog.exec_():
         for filename in dialog.selectedFiles():
             self.load_from_file(filename)
Beispiel #10
0
    def test_get_open_dialog(self):
        d1 = FileOperator.get_open_dialog(directory_mode=False)
        self.assertEqual(d1.fileMode(), QFileDialog.ExistingFiles)

        d2 = FileOperator.get_open_dialog(directory_mode=True)
        self.assertEqual(d2.fileMode(), QFileDialog.Directory)