Пример #1
0
    def data_browse_button_clicked(self):
        file_dialog = QtImport.QFileDialog(self)

        try:
            base_image_dir = os.path.dirname(
                str(self.results_widget.data_path_ledit.text()))
        except:
            base_image_dir = os.environ["HOME"]

        selected_filename = str(
            file_dialog.getOpenFileName(self, "Select an image",
                                        base_image_dir))
        self.results_widget.data_path_ledit.setText(selected_filename)

        ff_path = selected_filename[:selected_filename.rindex("/") +
                                    1] + "ff_" + selected_filename[
                                        selected_filename.rindex("/") + 1:]
        self.results_widget.ff_path_ledit.setText(ff_path)

        #TODO move this to hwobj
        config_path = selected_filename.replace("mnt/beegfs/P14",
                                                "data/ispyb/p14")[:-4] + "json"

        if os.path.exists(config_path):
            self.results_widget.config_path_ledit.setText(config_path)
Пример #2
0
 def open_file_dialog(self):
     start_path = os.path.dirname(
         ConvertUtils.text_type(self.filepath.text()))
     if not os.path.exists(start_path):
         start_path = ""
     path = QtImport.QFileDialog(self).getOpenFileName(directory=start_path)
     if not path.isNull():
         self.filepath.setText(path)
Пример #3
0
    def config_browse_button_clicked(self):
        file_dialog = QtImport.QFileDialog(self)
        base_image_dir = os.environ["HOME"]

        selected_filename = str(
            file_dialog.getOpenFileName(self, "Select a configuration file",
                                        base_image_dir))
        self.results_widget.config_path_ledit.setText(selected_filename)
Пример #4
0
    def _browse_clicked(self):
        file_dialog = QtImport.QFileDialog(self)

        pdb_filename = str(
            file_dialog.getOpenFileName(self, "Select a PDB file",
                                        expanduser("~")))
        self._model.pdb_file = pdb_filename
        self.processing_widget.pdb_file_ledit.setText(pdb_filename)
Пример #5
0
    def _browse_clicked(self):
        file_dialog = QtImport.QFileDialog(self)
        file_dialog.setNameFilter("%s*" % self._base_image_dir)

        selected_dir = str(
            file_dialog.getExistingDirectory(
                self, "Select a directory", str(self._base_image_dir),
                QtImport.QFileDialog.ShowDirsOnly))
        if selected_dir is not None and len(
                selected_dir) > 0 and selected_dir.startswith(
                    self._base_image_dir):
            self.set_directory(selected_dir)
        else:
            msg = "Selected directory do not start " +\
                  "with the base directory %s" % self._base_image_dir
            logging.getLogger("GUI").error(msg)
Пример #6
0
    def select_file_path_button_clicked(self):
        """
        open file dialog to select a valid folder
        """

        file_dialog = QtImport.QFileDialog(self)

        old_folder_path = self.ui_widgets_manager.export_folder_path_tbox.text(
        ).strip()

        if not os.path.exists(old_folder_path):
            old_folder_path = "/"
        selected_dir = str(
            file_dialog.getExistingDirectory(
                self, "Select a directory", old_folder_path,
                QtImport.QFileDialog.ShowDirsOnly))

        if selected_dir is not None and len(selected_dir) > 0:
            self.ui_widgets_manager.export_folder_path_tbox.setText(
                selected_dir)