コード例 #1
0
    def __init__(self, parent, stack_list):
        super().__init__(parent)
        compile_ui('gui/ui/save_dialog.ui', self)

        self.browseButton.clicked.connect(
            lambda: select_directory(self.savePath, "Browse"))

        self.buttonBox.button(
            QDialogButtonBox.StandardButton.SaveAll).clicked.connect(
                self.save_all)

        # dynamically add all the supported formats
        formats = supported_formats()
        self.formats.addItems(formats)

        # set the default to tiff
        self.formats.setCurrentIndex(formats.index(DEFAULT_IO_FILE_FORMAT))

        if stack_list:  # we will just show an empty drop down if no stacks
            # Sort stacknames using Recon and Tomo as preference
            user_friendly_stack_list = sorted(stack_list,
                                              key=sort_by_tomo_and_recon)
            # the stacklist is created in the main windows presenter and has
            # format [(uuid, title)...], doing zip(*stack_list) unzips the
            # tuples into separate lists
            self.stack_uuids, user_friendly_names = zip(
                *user_friendly_stack_list)

            self.stackNames.addItems(user_friendly_names)

        self.selected_stack = None
コード例 #2
0
    def __init__(self, parent, ui_file=None):
        super(BaseDialogView, self).__init__(parent)

        if ui_file is not None:
            compile_ui(ui_file, self)

        self.setAttribute(Qt.Qt.WA_DeleteOnClose)
コード例 #3
0
ファイル: view.py プロジェクト: JackEAllen/mantidimaging
    def __init__(self, parent):
        super(MWLoadDialog, self).__init__(parent)
        compile_ui('gui/ui/load_dialog.ui', self)

        self.parent_view = parent
        self.presenter = LoadPresenter(self)

        self.tree.header().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.tree.header().setSectionResizeMode(1, QHeaderView.Stretch)
        self.tree.header().setStretchLastSection(False)
        self.tree.setTabKeyNavigation(True)

        self.sample, self.select_sample = self.create_file_input(0)
        self.select_sample.clicked.connect(lambda: self.presenter.notify(Notification.UPDATE_ALL_FIELDS))

        self.flat, self.select_flat = self.create_file_input(1)
        self.select_flat.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_OTHER, field=self.flat, name="Flat"))

        self.dark, self.select_dark = self.create_file_input(2)
        self.select_dark.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_OTHER, field=self.dark, name="Dark"))

        self.proj_180deg, self.select_proj_180deg = self.create_file_input(3)
        self.sample_log, self.select_sample_log = self.create_file_input(4)
        self.flat_log, self.select_flat_log = self.create_file_input(5)

        self.step_all.clicked.connect(self._set_all_step)
        self.step_preview.clicked.connect(self._set_preview_step)
        # if accepted load the stack
        self.accepted.connect(self.parent_view.execute_load)

        # remove the placeholder text from QtCreator
        self.expectedResourcesLabel.setText("")
コード例 #4
0
    def __init__(self, parent):
        super().__init__(parent)
        compile_ui("gui/ui/nexus_load_dialog.ui", self)

        self.parent_view = parent
        self.presenter = NexusLoadPresenter(self)
        self.tree.expandItem(self.tree.topLevelItem(1))
        self.checkboxes = dict()

        self.tree.header().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.tree.header().setSectionResizeMode(2, QHeaderView.Stretch)

        self.chooseFileButton.clicked.connect(self.choose_nexus_file)
        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)

        self.start_widget = QSpinBox()
        self.stop_widget = QSpinBox()
        self.step_widget = QSpinBox()

        self.start_widget.setMinimum(0)
        self.stop_widget.setMinimum(1)
        self.step_widget.setMinimum(1)

        self.increment_widget = QWidget()
        h_layout = QHBoxLayout()
        h_layout.addWidget(QLabel("Start"))
        h_layout.addWidget(self.start_widget)
        h_layout.addWidget(QLabel("Stop"))
        h_layout.addWidget(self.stop_widget)
        h_layout.addWidget(QLabel("Increment"))
        h_layout.addWidget(self.step_widget)
        self.increment_widget.setLayout(h_layout)
        self.increment_widget.setEnabled(False)

        section: QTreeWidgetItem = self.tree.topLevelItem(2)
        child = section.child(0).child(0)
        self.tree.setItemWidget(child, 2, self.increment_widget)
        self.tree.setItemWidget(child, 0, QLabel("Indices"))

        self.accepted.connect(self.parent_view.execute_nexus_load)

        self.previewPushButton.clicked.connect(self._set_preview_step)
        self.allPushButton.clicked.connect(self._set_all_step)
        self.n_proj = 0
コード例 #5
0
    def __init__(self, parent, ui_file=None):
        super(BaseMainWindowView, self).__init__(parent)

        if ui_file is not None:
            compile_ui(ui_file, self)
コード例 #6
0
ファイル: view.py プロジェクト: Pasarus/mantidimaging
    def __init__(self, parent):
        super(MWLoadDialog, self).__init__(parent)
        compile_ui('gui/ui/load_dialog.ui', self)

        self.parent_view = parent
        self.presenter = LoadPresenter(self)

        self.tree.header().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.tree.header().setSectionResizeMode(1, QHeaderView.Stretch)
        self.tree.header().setStretchLastSection(False)
        self.tree.setTabKeyNavigation(True)

        self.sample, self.select_sample = self.create_file_input(0)
        self.select_sample.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_ALL_FIELDS))

        self.flat_before, self.select_flat_before = self.create_file_input(1)
        self.select_flat_before.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_FLAT_OR_DARK,
                                          field=self.flat_before,
                                          name="Flat",
                                          suffix="Before"))

        self.flat_after, self.select_flat_after = self.create_file_input(2)
        self.select_flat_after.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_FLAT_OR_DARK,
                                          field=self.flat_after,
                                          name="Flat",
                                          suffix="After"))

        self.dark_before, self.select_dark_before = self.create_file_input(3)
        self.select_dark_before.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_FLAT_OR_DARK,
                                          field=self.dark_before,
                                          name="Dark",
                                          suffix="Before"))

        self.dark_after, self.select_dark_after = self.create_file_input(4)
        self.select_dark_after.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_FLAT_OR_DARK,
                                          field=self.dark_after,
                                          name="Dark",
                                          suffix="After"))

        self.proj_180deg, self.select_proj_180deg = self.create_file_input(5)
        self.select_proj_180deg.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_SINGLE_FILE,
                                          field=self.proj_180deg,
                                          name="180 degree",
                                          is_image_file=True))

        self.sample_log, self.select_sample_log = self.create_file_input(6)
        self.select_sample_log.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_SAMPLE_LOG,
                                          field=self.sample_log,
                                          name="Sample Log",
                                          is_image_file=False))

        self.flat_before_log, self.select_flat_before_log = self.create_file_input(
            7)
        self.select_flat_before_log.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_SINGLE_FILE,
                                          field=self.flat_before_log,
                                          name="Flat Before Log",
                                          image_file=False))

        self.flat_after_log, self.select_flat_after_log = self.create_file_input(
            8)
        self.select_flat_after_log.clicked.connect(
            lambda: self.presenter.notify(Notification.UPDATE_SINGLE_FILE,
                                          field=self.flat_after_log,
                                          name="Flat After Log",
                                          image_file=False))

        self.step_all.clicked.connect(self._set_all_step)
        self.step_preview.clicked.connect(self._set_preview_step)
        # if accepted load the stack
        self.accepted.connect(self.parent_view.execute_load)

        # remove the placeholder text from QtCreator
        self.expectedResourcesLabel.setText("")
コード例 #7
0
ファイル: view.py プロジェクト: mantidproject/mantidimaging
    def __init__(self, parent, ui_file=None):
        super().__init__(parent)

        if ui_file is not None:
            compile_ui(ui_file, self)