コード例 #1
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self,parent)
        self.ui = load_ui(__file__, 'converter.ui', baseinstance=self)
        self.ui.InputVal.setValidator(QDoubleValidator(self.ui.InputVal))
        self.ui.totalFlightPathInput.setValidator(QDoubleValidator(self.ui.totalFlightPathInput))
        self.ui.scatteringAngleInput.setValidator(QDoubleValidator(self.ui.scatteringAngleInput))
        self.ui.convertButton.clicked.connect(self.convert)
        self.ui.helpButton.clicked.connect(self.helpClicked)
        self.ui.inputUnits.currentIndexChanged.connect(self.setInstrumentInputs)
        self.ui.outputUnits.currentIndexChanged.connect(self.setInstrumentInputs)
        self.setInstrumentInputs()

        ##defaults
        self.flightpath = -1.0
        self.Theta = -1.0
        self.output = 0.0

        #help
        self.assistant_process = QtCore.QProcess(self)
        # pylint: disable=protected-access
        import mantid
        self.mantidplot_name='TOF Converter'
        self.collection_file = os.path.join(mantid._bindir, '../docs/qthelp/MantidProject.qhc')
        version = ".".join(mantid.__version__.split(".")[:2])
        self.qt_url = 'qthelp://org.sphinx.mantidproject.' + version + '/doc/interfaces/TOF Converter.html'
        self.external_url = 'http://docs.mantidproject.org/nightly/interfaces/TOF Converter.html'

        try:
            import mantid
            #register startup
            mantid.UsageService.registerFeatureUsage("Interface","TofConverter",False)
        except ImportError:
            pass
コード例 #2
0
    def __init__(self, parent=None):
        super(WaterfallPlotOffsetDialogView, self).__init__(parent=parent)

        self.ui = load_ui(__file__,
                          'waterfall_plot_offset_dialog.ui',
                          baseinstance=self)
        self.setWindowIcon(QIcon(':/images/MantidIcon.ico'))
        self.setModal(True)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
コード例 #3
0
ファイル: propertiesdialog.py プロジェクト: DanNixon/mantid
 def __init__(self, ui_file, canvas):
     """
     :param canvas: A reference to the canvas to be updated
     """
     super(PropertiesEditorBase, self).__init__()
     self.canvas = canvas
     self.ui = load_ui(__file__, ui_file, baseinstance=self)
     self.ui.buttonBox.accepted.connect(self.on_ok)
     self.ui.buttonBox.rejected.connect(self.reject)
コード例 #4
0
ファイル: view.py プロジェクト: stuartcampbell/mantid
    def __init__(self, parent=None):
        super(WaterfallPlotFillAreaDialogView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'waterfall_plot_fill_area_dialog.ui', baseinstance=self)
        self.setWindowIcon(QIcon(':/images/MantidIcon.ico'))
        self.setModal(True)
        self.colour_selector_widget = ColorSelector(parent=self)
        self.vertical_layout_2.replaceWidget(self.colour_selector_dummy_widget, self.colour_selector_widget)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
コード例 #5
0
 def __init__(self, ui_file, canvas):
     """
     :param canvas: A reference to the canvas to be updated
     """
     super(PropertiesEditorBase, self).__init__()
     self.canvas = canvas
     self.ui = load_ui(__file__, ui_file, baseinstance=self)
     self.ui.buttonBox.accepted.connect(self.on_ok)
     self.ui.buttonBox.rejected.connect(self.reject)
     self.ui.setWindowIcon(QIcon(':/images/MantidIcon.ico'))
コード例 #6
0
ファイル: view.py プロジェクト: yutiansut/mantid
    def __init__(self, parent=None):
        super(LineTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__,
                          'curves_tab_line_tab.ui',
                          baseinstance=self)
        self.color_selector_widget = ColorSelector(parent=self)
        self.grid_layout.replaceWidget(self.color_selector_dummy_widget,
                                       self.color_selector_widget)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
コード例 #7
0
ファイル: view.py プロジェクト: arezooamirpour/mantid
    def __init__(self, parent=None):
        super(AxesTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'axes_tab_widget.ui', baseinstance=self)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

        # Set validator for the axis limit spin boxes
        for limit in ['upper', 'lower']:
            line_edit = getattr(self, f'{limit}_limit_line_edit')
            validator = QDoubleValidator()
            line_edit.setValidator(validator)
コード例 #8
0
ファイル: view.py プロジェクト: MORTAL2000/mantid
    def __init__(self, parent=None):
        super(ImagesTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'images_tab.ui', baseinstance=self)
        self._populate_colormap_combo_box()
        self._populate_interpolation_combo_box()
        self._populate_scale_combo_box()

        self.set_min_max_ranges(self.get_scale())

        self.max_min_value_warning.setVisible(False)
コード例 #9
0
    def __init__(self, parent=None):
        super(PlotConfigDialogView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'plot_config_dialog.ui', baseinstance=self)
        self.setWindowIcon(QIcon(':/images/MantidIcon.ico'))
        self.setWindowModality(Qt.WindowModal)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

        self.errors_label = self.ui.errors
        self.minimum_errors_text = self.errors_label.text()
        self.errors_label.hide()
コード例 #10
0
    def __init__(self, parent=None):
        super(AxesTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'axes_tab_widget.ui', baseinstance=self)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

        # Set maxima and minima for the axis limit spin boxes
        for axis in ['x', 'y']:
            for limit in ['upper', 'lower']:
                spin_box = getattr(self, '%s%s_limit_spin_box' % (axis, limit))
                spin_box.setRange(finfo(float32).min, finfo(float32).max)
コード例 #11
0
ファイル: view.py プロジェクト: ethoeng/mantid
    def __init__(self, parent=None):
        super(CurvesTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'curves_tab.ui', baseinstance=self)
        self.line = LineTabWidgetView(parent=self)
        self.tab_container.addTab(self.line, "Line")
        self.marker = MarkerTabWidgetView(parent=self)
        self.tab_container.addTab(self.marker, "Marker")
        self.errorbars = ErrorbarsTabWidgetView(parent=self)
        self.tab_container.addTab(self.errorbars, "Errorbars")
        self.setAttribute(Qt.WA_DeleteOnClose, True)
コード例 #12
0
ファイル: view.py プロジェクト: ethoeng/mantid
 def _setup_ui(self, function_names):
     self.ui = load_ui(__file__, 'add_function_dialog.ui', self)
     if function_names:
         self.ui.functionBox.addItems(function_names)
     self.ui.functionBox.clearEditText()
     self.ui.functionBox.completer().setCompletionMode(
         QCompleter.PopupCompletion)
     self.ui.functionBox.completer().setFilterMode(Qt.MatchContains)
     self.ui.errorMessage.hide()
     # Monkey patch the functionBox keyPressEvent to make use of auto-completion.
     self.ui.functionBox.keyPressEvent = types.MethodType(
         keyPressEvent, self.ui.functionBox)
コード例 #13
0
    def __init__(self, presenter, parent=None):
        super(RecoveryFailureView, self).__init__(parent=parent)
        self.ui = load_ui(__file__, "RecoveryFailure.ui", baseinstance=self)
        self.ui.tableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.ui.tableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.presenter = presenter

        # Make sure the UI doesn't leak memory
        self.ui.setAttribute(Qt.WA_DeleteOnClose, True)

        # Set the table data
        self._add_data_to_table()
コード例 #14
0
    def __init__(self, parent):
        """
        initialization
        :param parent:
        """
        super(ScanPreProcessWindow, self).__init__(parent)

        # class variables
        self._myController = None
        self._myMergePeaksThread = None
        self._rowScanDict = dict()

        # mutex and data structure that can be in contention
        self._recordLogMutex = False
        self._scansToProcess = set()
        self._mdFileDict = dict()
        self._scanNumbersProcessed = set()

        # current experiment number in processing
        self._currExpNumber = None
        self._outputDir = None

        # define UI
        ui_path = "preprocess_window.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)
        self._promote_widgets()

        # initialize the widgets
        self.enable_calibration_settings(False)

        # detector sizes
        self.ui.comboBox_detSize.addItem('256 x 256')
        self.ui.comboBox_detSize.addItem('512 x 512')
        self.ui.comboBox_detSize.addItem('(512 x 9) x (512 x 9)')
        self.ui.comboBox_detSize.setCurrentIndex(0)

        self.ui.checkBox_saveToDataServer.setChecked(True)

        # initialize table
        self.ui.tableView_scanProcessState.setup()
        # try to make column nicer
        self.ui.tableView_scanProcessState.resizeColumnsToContents()

        # define event handling
        self.ui.pushButton_browseOutputDir.clicked.connect(
            self.do_browse_output_dir)
        self.ui.pushButton_preProcessScan.clicked.connect(
            self.do_start_pre_process)
        self.ui.pushButton_changeSettings.clicked.connect(
            self.do_change_calibration_settings)
        self.ui.pushButton_fixSettings.clicked.connect(
            self.do_fix_calibration_settings)
        self.ui.actionExit.triggered.connect(self.do_quit)
コード例 #15
0
    def __init__(self, presenter, parent=None):
        super(ProjectRecoveryWidgetView, self).__init__(parent=parent)
        self.ui = load_ui(__file__, "ProjectRecoveryWidget.ui", baseinstance=self)
        self.presenter = presenter

        # Make sure the UI doesn't leak memory
        self.ui.setAttribute(Qt.WA_DeleteOnClose, True)

        # Set up the ui
        self.ui.tableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.ui.tableWidget.verticalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.ui.progressBar.setMinimum(0)
        self._add_data_to_table()
コード例 #16
0
 def _setup_ui(self, function_names, default_function_name):
     self.ui = load_ui(__file__, 'add_function_dialog.ui', self)
     functionBox = self.ui.functionBox
     if function_names:
         functionBox.addItems(function_names)
     if default_function_name is not None and default_function_name in function_names:
         functionBox.lineEdit().setPlaceholderText(default_function_name)
     functionBox.clearEditText()
     functionBox.completer().setCompletionMode(QCompleter.PopupCompletion)
     functionBox.completer().setFilterMode(Qt.MatchContains)
     self._key_filter = ActivateCompleterOnReturn(functionBox)
     functionBox.installEventFilter(self._key_filter)
     self.ui.errorMessage.hide()
コード例 #17
0
            def __init__(self, instrument_list=None):
                QDialog.__init__(self)
                self.ui = load_ui(__file__, 'ui/instrument_dialog.ui', baseinstance=self)
                self.instrument_list = instrument_list
                self.instr_combo.clear()
                self.facility_combo.clear()
                instruments = sorted(INSTRUMENT_DICT.keys())
                instruments.reverse()
                for facility in instruments:
                    self.facility_combo.addItem(facility)

                self._facility_changed(instruments[0])
                self.facility_combo.activated.connect(self._facility_changed)
コード例 #18
0
ファイル: view.py プロジェクト: arezooamirpour/mantid
    def __init__(self, parent=None):
        super(MarkerTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__,
                          'curves_tab_marker_tab.ui',
                          baseinstance=self)
        self.face_color_selector_widget = ColorSelector(parent=self)
        self.grid_layout.replaceWidget(self.face_color_dummy_widget,
                                       self.face_color_selector_widget)
        self.edge_color_selector_widget = ColorSelector(parent=self)
        self.grid_layout.replaceWidget(self.edge_color_dummy_widget,
                                       self.edge_color_selector_widget)
        self.ui.marker_style_combo_box.addItems(MARKER_STYLES)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
コード例 #19
0
ファイル: view.py プロジェクト: yutiansut/mantid
    def __init__(self, parent=None):
        super(ErrorbarsTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__,
                          'curves_tab_errorbars_tab.ui',
                          baseinstance=self)
        self.color_selector_widget = ColorSelector(parent=self)
        self.layout.replaceWidget(self.color_dummy_widget,
                                  self.color_selector_widget)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

        # Disable errorbar fields when they are hidden
        self.hide_errorbars_tickbox.stateChanged.connect(
            lambda: self.set_fields_enabled(not self.get_hide()))
コード例 #20
0
            def __init__(self, instrument_list=None):
                QDialog.__init__(self)
                self.ui = load_ui(__file__, 'ui/instrument_dialog.ui', baseinstance=self)
                self.instrument_list = instrument_list
                self.instr_combo.clear()
                self.facility_combo.clear()
                facilities = sorted([fac for fac in INSTRUMENT_DICT.keys() if
                                     any([inst in INSTRUMENT_DICT[fac] for inst in instrument_list])])
                facilities.reverse()
                for facility in facilities:
                    self.facility_combo.addItem(facility)

                self._facility_changed(facilities[0])
                self.facility_combo.activated.connect(self._facility_changed)
コード例 #21
0
    def __init__(self, parent=None):
        super(ImagesTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'images_tab.ui', baseinstance=self)
        self._populate_colormap_combo_box()
        self._populate_interpolation_combo_box()
        self._populate_scale_combo_box()

        # Set maximum and minimum for the min/max spin boxes
        for bound in ['min', 'max']:
            spin_box = getattr(self, '%s_value_spin_box' % bound)
            spin_box.setRange(0, np.finfo(np.float32).max)

        self.max_min_value_warning.setVisible(False)
コード例 #22
0
ファイル: recoveryfailureview.py プロジェクト: ethoeng/mantid
    def __init__(self, presenter, parent=None):
        super(RecoveryFailureView, self).__init__(parent=parent)
        self.ui = load_ui(__file__, "RecoveryFailure.ui", baseinstance=self)
        self.ui.tableWidget.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)
        self.ui.tableWidget.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)
        self.presenter = presenter

        # Make sure the UI doesn't leak memory
        self.ui.setAttribute(Qt.WA_DeleteOnClose, True)

        # Set the table data
        self._add_data_to_table()
コード例 #23
0
    def __init__(self, parent):
        """
        initialization
        :param parent:
        """
        super(ScanPreProcessWindow, self).__init__(parent)

        # class variables
        self._myController = None
        self._myMergePeaksThread = None
        self._rowScanDict = dict()

        # mutex and data structure that can be in contention
        self._recordLogMutex = False
        self._scansToProcess = set()
        self._mdFileDict = dict()
        self._scanNumbersProcessed = set()

        # current experiment number in processing
        self._currExpNumber = None
        self._outputDir = None

        # define UI
        ui_path = "preprocess_window.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)
        self._promote_widgets()

        # initialize the widgets
        self.enable_calibration_settings(False)

        # detector sizes
        self.ui.comboBox_detSize.addItem('256 x 256')
        self.ui.comboBox_detSize.addItem('512 x 512')
        self.ui.comboBox_detSize.addItem('(512 x 9) x (512 x 9)')
        self.ui.comboBox_detSize.setCurrentIndex(0)

        self.ui.checkBox_saveToDataServer.setChecked(True)

        # initialize table
        self.ui.tableView_scanProcessState.setup()
        # try to make column nicer
        self.ui.tableView_scanProcessState.resizeColumnsToContents()

        # define event handling
        self.ui.pushButton_browseOutputDir.clicked.connect(self.do_browse_output_dir)
        self.ui.pushButton_preProcessScan.clicked.connect(self.do_start_pre_process)
        self.ui.pushButton_changeSettings.clicked.connect(self.do_change_calibration_settings)
        self.ui.pushButton_fixSettings.clicked.connect(self.do_fix_calibration_settings)
        self.ui.actionExit.triggered.connect(self.do_quit)
コード例 #24
0
    def __init__(self, parent):
        """Initialization

        :param parent: parent
        """
        super(ViewSpiceDialog, self).__init__()

        # define UI
        ui_path = "SpiceViewerDialog.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)

        # define event handlers
        self.ui.pushButton_close.clicked.connect(self.do_quit)

        return
コード例 #25
0
    def __init__(self, parent):
        """Initialization

        :param parent: parent
        """
        super(ViewSpiceDialog, self).__init__()

        # define UI
        ui_path = "SpiceViewerDialog.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)

        # define event handlers
        self.ui.pushButton_close.clicked.connect(self.do_quit)

        return
コード例 #26
0
ファイル: message_dialog.py プロジェクト: yutiansut/mantid
    def __init__(self, parent):
        """
        initialization of customized dialog box
        :param parent:
        :return:
        """
        super(MessageDialog, self).__init__(parent)

        # set up UI
        ui_path = "messagebox.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)

        # define operation
        self.ui.pushButton_close.clicked.connect(self.do_quit)

        return
コード例 #27
0
    def __init__(self, parent):
        """
        initialization of customized dialog box
        :param parent:
        :return:
        """
        super(MessageDialog, self).__init__(parent)

        # set up UI
        ui_path = "messagebox.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)

        # define operation
        self.ui.pushButton_close.clicked.connect(self.do_quit)

        return
コード例 #28
0
    def __init__(self, parent=None):
        super(ImagesTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'images_tab.ui', baseinstance=self)
        self._populate_colormap_combo_box()
        self._populate_interpolation_combo_box()
        self._populate_scale_combo_box()

        self.max_min_value_warning.setVisible(False)

        self.min_value_validator = LineEditDoubleValidator(
            self.min_value_line_edit, 0.0)
        self.max_value_validator = LineEditDoubleValidator(
            self.max_value_line_edit, 1.0)
        self.min_value_line_edit.setValidator(self.min_value_validator)
        self.max_value_line_edit.setValidator(self.max_value_validator)
コード例 #29
0
    def __init__(self, presenter, parent=None):
        super(SampleMaterialDialogView, self).__init__(parent=parent)

        self.ui = load_ui(__file__,
                          'samplematerialdialog.ui',
                          baseinstance=self)

        self.setWindowIcon(QIcon(':/images/MantidIcon.ico'))
        self.setModal(True)

        self.presenter = presenter

        self.setAttribute(Qt.WA_DeleteOnClose, True)

        # Top level items in the tree.
        self.formula_item = QTreeWidgetItem(self.material_properties_tree,
                                            ["Formula", ""])
        self.number_density_item = QTreeWidgetItem(
            self.material_properties_tree, ["Number Density", ""])
        self.temperature_item = QTreeWidgetItem(self.material_properties_tree,
                                                ["Temperature", ""])
        self.pressure_item = QTreeWidgetItem(self.material_properties_tree,
                                             ["Pressure", ""])
        self.cross_sections_item = QTreeWidgetItem(
            self.material_properties_tree, ["Cross Sections", ""])

        # Items under "Cross Section".
        self.absorption_item = QTreeWidgetItem(self.cross_sections_item,
                                               ["Absorption", ""])
        self.scattering_item = QTreeWidgetItem(self.cross_sections_item,
                                               ["Scattering", ""])

        # Items under "Scattering".
        self.total_item = QTreeWidgetItem(self.scattering_item, ["Total", ""])
        self.coherent_item = QTreeWidgetItem(self.scattering_item,
                                             ["Coherent", ""])
        self.incoherent_item = QTreeWidgetItem(self.scattering_item,
                                               ["Incoherent", ""])

        # Expand all items with child items.
        self.cross_sections_item.setExpanded(True)
        self.scattering_item.setExpanded(True)

        # Connect button signals.
        self.close_button.clicked.connect(self.close_request)
        self.copy_material_button.clicked.connect(self.copy_material_request)
        self.set_material_button.clicked.connect(self.set_material_request)
コード例 #30
0
 def _setup_ui(self, function_names, default_function_name, default_checkbox):
     self.ui = load_ui(__file__, 'add_function_dialog.ui', self)
     functionBox = self.ui.functionBox
     if function_names:
         functionBox.addItems(function_names)
     if default_function_name is not None and default_function_name in function_names:
         functionBox.lineEdit().setPlaceholderText(default_function_name)
     functionBox.clearEditText()
     functionBox.completer().setCompletionMode(QCompleter.PopupCompletion)
     functionBox.completer().setFilterMode(Qt.MatchContains)
     self._key_filter = ActivateCompleterOnReturn(functionBox)
     functionBox.installEventFilter(self._key_filter)
     self.ui.errorMessage.hide()
     # Add a checkbox so user is able to explicitly update the global settings.
     if default_checkbox:
         self._default_checkbox = QCheckBox("Set as global default")
         self.ui.verticalLayout_2.addWidget(self._default_checkbox)
コード例 #31
0
ファイル: FindUBUtility.py プロジェクト: yutiansut/mantid
    def __init__(self, parent):
        """
        initialization
        :param parent:
        """
        super(SelectUBMatrixScansDialog, self).__init__(parent)
        self._myParent = parent

        # set ui
        ui_path = "UBSelectPeaksDialog.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)

        # define event handling methods
        self.ui.pushButton_selectScans.clicked.connect(self.do_select_scans)
        self.ui.pushButton_revertCurrentSelection.clicked.connect(self.do_revert_selection)
        self.ui.pushButton_exportSelectedScans.clicked.connect(self.do_export_selected_scans)
        self.ui.pushButton_quit.clicked.connect(self.do_quit)
コード例 #32
0
    def __init__(self, parent=None):
        super(ImagesTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__, 'images_tab.ui', baseinstance=self)
        self._populate_colormap_combo_box()
        self._populate_interpolation_combo_box()
        self._populate_scale_combo_box()

        # Set maximum and minimum for the min/max spin boxes
        for bound in ['min', 'max']:
            spin_box = getattr(self, '%s_value_spin_box' % bound)
            spin_box.setRange(0, np.finfo(np.float32).max)

        # Make sure min scale value always less than max
        self.min_value_spin_box.valueChanged.connect(
            self._check_max_min_consistency_min_changed)
        self.max_value_spin_box.valueChanged.connect(
            self._check_max_min_consistency_max_changed)
コード例 #33
0
    def __init__(self, parent):
        """
        initialization
        :param parent:
        """
        super(GeneralPlotWindow, self).__init__(parent)

        # set up UI
        ui_path = "general1dviewer.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)
        self._promote_widgets()

        # set up the event handling
        self.ui.pushButton_exportPlot2File.clicked.connect(self.do_export_plot)
        self.ui.pushButton_quit.clicked.connect(self.do_quit)
        self.ui.actionReset.triggered.connect(self.reset_window)

        # class variables
        self._work_dir = os.getcwd()
コード例 #34
0
    def __init__(self, parent):
        """
        initialization
        :param parent:
        """
        super(GeneralPlotWindow, self).__init__(parent)

        # set up UI
        ui_path = "general1dviewer.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)
        self._promote_widgets()

        # set up the event handling
        self.ui.pushButton_exportPlot2File.clicked.connect(self.do_export_plot)
        self.ui.pushButton_quit.clicked.connect(self.do_quit)
        self.ui.actionReset.triggered.connect(self.reset_window)

        # class variables
        self._work_dir = os.getcwd()
コード例 #35
0
    def __init__(self, parent):
        """
        initialization
        :param parent:
        """
        super(PeaksIntegrationReportDialog, self).__init__(parent)

        # set up UI
        ui_path = "PeakIntegrationSpreadSheet.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)
        self._promote_widgets()

        # initialize widget
        self.ui.tableWidget_spreadsheet.setup()

        # set up handlers
        self.ui.pushButton_exportTable.clicked.connect(self.do_export_table)
        self.ui.pushButton_quit.clicked.connect(self.do_quit)

        return
コード例 #36
0
ファイル: plot3dwindow.py プロジェクト: robertapplin/mantid
    def __init__(self, parent=None):
        """
        Initialization
        :param parent:
        :return:
        """
        # Init
        QMainWindow.__init__(self, parent)

        ui_path = "View3DWidget.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)
        self._promote_widgets()

        # Initialize widgets
        self.ui.lineEdit_baseColorRed.setText('0.5')
        self.ui.lineEdit_baseColorGreen.setText('0.5')
        self.ui.lineEdit_baseColorBlue.setText('0.5')
        self.ui.lineEdit_countsThresholdLower.setText('0')
        self.ui.comboBox_scans.addItem('unclassified')

        # Event handling
        self.ui.pushButton_plot3D.clicked.connect(self.do_plot_3d)
        self.ui.pushButton_checkCounts.clicked.connect(self.do_check_counts)
        self.ui.pushButton_clearPlots.clicked.connect(self.do_clear_plots)
        self.ui.pushButton_quit.clicked.connect(self.do_quit)
        self.ui.comboBox_scans.currentIndexChanged.connect(
            self.evt_change_scan)

        # Set up
        # list of data keys for management
        self._dataKeyList = list()

        # dictionary for 3D data
        self._mergedDataDict = dict()

        # dictionary for group control, key = str(scan), value = list of data keys
        self._groupDict = dict()
        self._currSessionName = 'unclassified'
        self._groupDict['unclassified'] = []

        return
コード例 #37
0
ファイル: downloaddialog.py プロジェクト: robertapplin/mantid
    def __init__(self, parent):
        """
        initialization
        :param parent:
        """
        super(DataDownloadDialog, self).__init__(parent)

        # set up UI
        ui_path = "httpserversetup.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)

        # initialize widgets
        self._init_widgets()

        # define event handing
        self.ui.pushButton_testURLs.clicked.connect(self.do_test_url)

        self.ui.pushButton_downloadExpData.clicked.connect(
            self.do_download_spice_data)

        self.ui.pushButton_ListScans.clicked.connect(self.do_list_scans)

        self.ui.comboBox_mode.currentIndexChanged.connect(
            self.do_change_data_access_mode)

        self.ui.pushButton_browseLocalCache.clicked.connect(
            self.do_browse_local_cache_dir)

        # Set the URL red as it is better not check at this stage. Leave it to user
        self.ui.lineEdit_url.setStyleSheet("color: black;")

        # define class variable
        self._homeSrcDir = os.getcwd()
        try:
            self._myControl = None
            self._myControl = parent.controller
        except AttributeError as att_err:
            print(att_err)

        # experiment number
        self._expNumber = None
コード例 #38
0
    def __init__(self, parent=None):
        super(LegendTabWidgetView, self).__init__(parent=parent)

        self.ui = load_ui(__file__,
                          'legend_tab.ui',
                          baseinstance=self)
        self.background_color_selector_widget = ColorSelector(parent=self)
        self.edge_color_selector_widget = ColorSelector(parent=self)
        self.title_color_selector_widget = ColorSelector(parent=self)
        self.entries_color_selector_widget = ColorSelector(parent=self)
        self.grid_layout.replaceWidget(self.background_color_selector_dummy_widget,
                                       self.background_color_selector_widget)
        self.grid_layout.replaceWidget(self.edge_color_selector_dummy_widget,
                                       self.edge_color_selector_widget)
        self.grid_layout.replaceWidget(self.entries_color_selector_dummy_widget,
                                       self.entries_color_selector_widget)
        self.grid_layout.replaceWidget(self.title_color_selector_dummy_widget,
                                       self.title_color_selector_widget)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

        self.advanced_options = AdvancedLegendOptionsView(self)
コード例 #39
0
ファイル: plot3dwindow.py プロジェクト: mantidproject/mantid
    def __init__(self, parent=None):
        """
        Initialization
        :param parent:
        :return:
        """
        # Init
        QMainWindow.__init__(self, parent)

        ui_path ="View3DWidget.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)
        self._promote_widgets()

        # Initialize widgets
        self.ui.lineEdit_baseColorRed.setText('0.5')
        self.ui.lineEdit_baseColorGreen.setText('0.5')
        self.ui.lineEdit_baseColorBlue.setText('0.5')
        self.ui.lineEdit_countsThresholdLower.setText('0')
        self.ui.comboBox_scans.addItem('unclassified')

        # Event handling
        self.ui.pushButton_plot3D.clicked.connect(self.do_plot_3d)
        self.ui.pushButton_checkCounts.clicked.connect(self.do_check_counts)
        self.ui.pushButton_clearPlots.clicked.connect(self.do_clear_plots)
        self.ui.pushButton_quit.clicked.connect(self.do_quit)
        self.ui.comboBox_scans.currentIndexChanged.connect(self.evt_change_scan)

        # Set up
        # list of data keys for management
        self._dataKeyList = list()

        # dictionary for 3D data
        self._mergedDataDict = dict()

        # dictionary for group control, key = str(scan), value = list of data keys
        self._groupDict = dict()
        self._currSessionName = 'unclassified'
        self._groupDict['unclassified'] = []

        return
コード例 #40
0
ファイル: FindUBUtility.py プロジェクト: mantidproject/mantid
    def __init__(self, parent):
        """
        initialization
        :param parent: main GUI, reductionControl
        """
        super(AddScansForUBDialog, self).__init__(parent)
        self._myParent = parent

        # set up UI
        ui_path =  "AddUBPeaksDialog.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)

        # initialize widgets
        self.ui.checkBox_loadHKLfromFile.setChecked(True)

        self.ui.pushButton_findPeak.clicked.connect(self.do_find_peak)
        self.ui.pushButton_addPeakToCalUB.clicked.connect(self.do_add_single_scan)

        self.ui.pushButton_loadScans.clicked.connect(self.do_load_scans)
        self.ui.pushButton_addScans.clicked.connect(self.do_add_scans)

        self.ui.pushButton_quit.clicked.connect(self.do_quit)
コード例 #41
0
    def __init__(self, parent):
        """
        initialization
        :param parent:
        """
        super(DataDownloadDialog, self).__init__(parent)

        # set up UI
        ui_path = "httpserversetup.ui"
        self.ui = load_ui(__file__, ui_path, baseinstance=self)

        # initialize widgets
        self._init_widgets()

        # define event handing
        self.ui.pushButton_testURLs.clicked.connect(self.do_test_url)

        self.ui.pushButton_downloadExpData.clicked.connect(self.do_download_spice_data)

        self.ui.pushButton_ListScans.clicked.connect(self.do_list_scans)

        self.ui.comboBox_mode.currentIndexChanged.connect(self.do_change_data_access_mode)

        self.ui.pushButton_browseLocalCache.clicked.connect(self.do_browse_local_cache_dir)

        # Set the URL red as it is better not check at this stage. Leave it to user
        self.ui.lineEdit_url.setStyleSheet("color: black;")

        # define class variable
        self._homeSrcDir = os.getcwd()
        try:
            self._myControl = None
            self._myControl = parent.controller
        except AttributeError as att_err:
            print (att_err)

        # experiment number
        self._expNumber = None
コード例 #42
0
ファイル: hfir_detector.py プロジェクト: mantidproject/mantid
 def __init__(self, parent=None):
     QFrame.__init__(self, parent)
     self.ui = load_ui(__file__, '../../../ui/sans/hfir_detector.ui', baseinstance=self)
コード例 #43
0
 def __init__(self, parent=None):
     QDialog.__init__(self, parent)
     self.ui = load_ui(__file__, '../../../ui/diffraction/diffraction_info.ui', baseinstance=self)
コード例 #44
0
ファイル: masking_table.py プロジェクト: mantidproject/mantid
# SPDX - License - Identifier: GPL - 3.0 +
""" View for the masking table.

The view for the masking table displays all available masks for a SANS reduction. It also allows to display the moved
and masked SANS workspace.
"""

from __future__ import (absolute_import, division, print_function)

from abc import ABCMeta, abstractmethod
from qtpy import QtWidgets
from six import with_metaclass

from mantidqt.utils.qt import load_ui

Ui_MaskingTable, _ = load_ui(__file__, "masking_table.ui")


class MaskingTable(QtWidgets.QWidget, Ui_MaskingTable):
    class MaskingTableListener(with_metaclass(ABCMeta, object)):
        """
        Defines the elements which a presenter can listen to for the masking table
        """
        @abstractmethod
        def on_row_changed(self):
            pass

        @abstractmethod
        def on_update_rows(self):
            pass
コード例 #45
0
 def __init__(self, parent=None):
     QDialog.__init__(self, parent)
     self.ui = load_ui(__file__, '../../../ui/sans/eqsans_info.ui', baseinstance=self)
コード例 #46
0
 def __init__(self, parent=None):
     QFrame.__init__(self, parent)
     self.ui = load_ui(__file__, '../../../ui/sans/eqsans_instrument.ui', baseinstance=self)
コード例 #47
0
 def __init__(self, parent=None):
     QFrame.__init__(self, parent)
     self.ui = load_ui(__file__, '../../../ui/diffraction/diffraction_run_setup.ui', baseinstance=self)
コード例 #48
0
ファイル: output.py プロジェクト: mantidproject/mantid
 def __init__(self, parent=None):
     QFrame.__init__(self, parent)
     self.ui = load_ui(__file__, '../../ui/hfir_output.ui', baseinstance=self)
コード例 #49
0
ファイル: view.py プロジェクト: mantidproject/mantid
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
#     NScD Oak Ridge National Laboratory, European Spallation Source
#     & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
#  This file is part of the mantidqt package
from qtpy.QtCore import Qt

from mantidqt.icons import get_icon
from mantidqt.utils.qt import create_action, load_ui

DialogBase, DialogForm = load_ui(__file__, 'dialog.ui')


class FindReplaceOptions(object):
    def __init__(self, match_case, words, regex, wrap_around):
        self.match_case = match_case
        self.words = words
        self.regex = regex
        self.wrap_around = wrap_around


class EmbeddedFindReplaceDialogView(DialogBase, DialogForm):
    def __init__(self, parent, presenter):
        super(EmbeddedFindReplaceDialogView, self).__init__(parent)
        self.setupUi(self)
        self.resize(self.width(), 100)

        self.find.completer().setCaseSensitivity(Qt.CaseSensitive)
        self.replace.completer().setCaseSensitivity(Qt.CaseSensitive)
コード例 #50
0
    def __init__(self, parent=None):
        """ Initialization and set up
        """
        # Base class
        QMainWindow.__init__(self, parent)

        # Mantid configuration
        config = ConfigService.Instance()
        self._instrument = config["default.instrument"]

        # Central widget
        self.centralwidget = QWidget(self)

        # UI Window (from Qt Designer)
        self.ui = load_ui(__file__, 'MainWindow.ui', baseinstance=self)
        mpl_layout = QVBoxLayout()
        self.ui.graphicsView.setLayout(mpl_layout)
        self.fig = Figure()
        self.canvas = FigureCanvas(self.fig)
        self.ui.mainplot = self.fig.add_subplot(111, projection='mantid')
        mpl_layout.addWidget(self.canvas)

        # Do initialize plotting
        vecx, vecy, xlim, ylim = self.computeMock()

        self.mainline = self.ui.mainplot.plot(vecx, vecy, 'r-')

        leftx = [xlim[0], xlim[0]]
        lefty = [ylim[0], ylim[1]]
        self.leftslideline = self.ui.mainplot.plot(leftx, lefty, 'b--')
        rightx = [xlim[1], xlim[1]]
        righty = [ylim[0], ylim[1]]
        self.rightslideline = self.ui.mainplot.plot(rightx, righty, 'g--')
        upperx = [xlim[0], xlim[1]]
        uppery = [ylim[1], ylim[1]]
        self.upperslideline = self.ui.mainplot.plot(upperx, uppery, 'b--')
        lowerx = [xlim[0], xlim[1]]
        lowery = [ylim[0], ylim[0]]
        self.lowerslideline = self.ui.mainplot.plot(lowerx, lowery, 'g--')

        self.canvas.mpl_connect('button_press_event', self.on_mouseDownEvent)

        # Set up horizontal slide (integer) and string value
        self._leftSlideValue = 0
        self._rightSlideValue = 99

        self.ui.horizontalSlider.setRange(0, 100)
        self.ui.horizontalSlider.setValue(self._leftSlideValue)
        self.ui.horizontalSlider.setTracking(True)
        self.ui.horizontalSlider.setTickPosition(QSlider.NoTicks)
        self.ui.horizontalSlider.valueChanged.connect(self.move_leftSlider)

        self.ui.horizontalSlider_2.setRange(0, 100)
        self.ui.horizontalSlider_2.setValue(self._rightSlideValue)
        self.ui.horizontalSlider_2.setTracking(True)
        self.ui.horizontalSlider_2.setTickPosition(QSlider.NoTicks)
        self.ui.horizontalSlider_2.valueChanged.connect(self.move_rightSlider)

        # self.connect(self.ui.lineEdit_3, QtCore.SIGNAL("textChanged(QString)"),
        #         self.set_startTime)
        self.ui.lineEdit_3.setValidator(QDoubleValidator(self.ui.lineEdit_3))
        self.ui.pushButton_setT0.clicked.connect(self.set_startTime)
        # self.connect(self.ui.lineEdit_4, QtCore.SIGNAL("textChanged(QString)"),
        #         self.set_stopTime)
        self.ui.lineEdit_4.setValidator(QDoubleValidator(self.ui.lineEdit_4))
        self.ui.pushButton_setTf.clicked.connect(self.set_stopTime)

        # File loader
        self.scanEventWorkspaces()
        self.ui.pushButton_refreshWS.clicked.connect(self.scanEventWorkspaces)
        self.ui.pushButton_browse.clicked.connect(self.browse_File)
        self.ui.pushButton_load.clicked.connect(self.load_File)
        self.ui.pushButton_3.clicked.connect(self.use_existWS)

        # Set up time
        self.ui.lineEdit_3.setValidator(QDoubleValidator(self.ui.lineEdit_3))
        self.ui.lineEdit_4.setValidator(QDoubleValidator(self.ui.lineEdit_4))

        # Filter by time
        self.ui.pushButton_filterTime.clicked.connect(self.filterByTime)

        # Filter by log value
        self.ui.lineEdit_5.setValidator(QDoubleValidator(self.ui.lineEdit_5))
        self.ui.lineEdit_6.setValidator(QDoubleValidator(self.ui.lineEdit_6))
        self.ui.lineEdit_7.setValidator(QDoubleValidator(self.ui.lineEdit_7))
        self.ui.lineEdit_8.setValidator(QDoubleValidator(self.ui.lineEdit_8))
        self.ui.lineEdit_9.setValidator(QDoubleValidator(self.ui.lineEdit_9))

        self.ui.lineEdit_5.textChanged.connect(self.set_minLogValue)
        self.ui.lineEdit_6.textChanged.connect(self.set_maxLogValue)

        dirchangeops = ["Both", "Increase", "Decrease"]
        self.ui.comboBox_4.addItems(dirchangeops)

        logboundops = ["Centre", "Left"]
        self.ui.comboBox_5.addItems(logboundops)

        self.ui.pushButton_4.clicked.connect(self.plotLogValue)

        self.ui.pushButton_filterLog.clicked.connect(self.filterByLogValue)

        # Set up help button
        self.ui.helpBtn.clicked.connect(self.helpClicked)

        # Set up vertical slide
        self._upperSlideValue = 99
        self._lowerSlideValue = 0

        self.ui.verticalSlider.setRange(0, 100)
        self.ui.verticalSlider.setValue(self._upperSlideValue)
        self.ui.verticalSlider.setTracking(True)
        self.ui.verticalSlider.valueChanged.connect(self.move_upperSlider)

        self.ui.verticalSlider_2.setRange(0, 100)
        self.ui.verticalSlider_2.setValue(self._lowerSlideValue)
        self.ui.verticalSlider_2.setTracking(True)
        self.ui.verticalSlider_2.valueChanged.connect(self.move_lowerSlider)

        # Set up for filtering (advanced setup)
        self._tofcorrection = False
        self.ui.checkBox_fastLog.setChecked(False)
        self.ui.checkBox_filterByPulse.setChecked(False)
        self.ui.checkBox_from1.setChecked(False)
        self.ui.checkBox_groupWS.setChecked(True)

        self.ui.comboBox_tofCorr.currentIndexChanged.connect(self.showHideEi)
        self.ui.pushButton_refreshCorrWSList.clicked.connect(self._searchTableWorkspaces)

        self.ui.lineEdit_Ei.setValidator(QDoubleValidator(self.ui.lineEdit_Ei))

        self.ui.label_Ei.hide()
        self.ui.lineEdit_Ei.hide()
        self.ui.label_Ei_2.hide()
        self.ui.comboBox_corrWS.hide()
        self.ui.pushButton_refreshCorrWSList.hide()

        # Set up for workspaces
        self._dataWS = None
        self._sampleLogNames = []
        self._sampleLog = None

        # Side information
        self.ui.label_mean.hide()
        self.ui.label_meanvalue.hide()
        self.ui.label_avg.hide()
        self.ui.label_timeAvgValue.hide()
        self.ui.label_freq.hide()
        self.ui.label_freqValue.hide()
        self.ui.label_logname.hide()
        self.ui.label_lognamevalue.hide()
        self.ui.label_logsize.hide()
        self.ui.label_logsizevalue.hide()

        # Default
        self._defaultdir = os.getcwd()

        # register startup
        mantid.UsageService.registerFeatureUsage("Interface", "EventFilter", False)
コード例 #51
0
from mantidqt.utils.qt import load_ui

# Constants
RANGE_SPECIFIER = '-'
PLACEHOLDER_FORMAT = 'valid range: {}' + RANGE_SPECIFIER + '{}'
RED_ASTERISK = None


def red_asterisk():
    global RED_ASTERISK
    if RED_ASTERISK is None:
        RED_ASTERISK = get_icon('fa.asterisk', color='red', scale_factor=0.6)
    return RED_ASTERISK


SpectraSelectionDialogUI, SpectraSelectionDialogUIBase = load_ui(__file__, 'spectraselectordialog.ui')


class SpectraSelection(object):

    Individual = 0

    def __init__(self, workspaces):
        self.workspaces = workspaces
        self.wksp_indices = None
        self.spectra = None
        self.plot_type = SpectraSelection.Individual


class SpectraSelectionDialog(SpectraSelectionDialogUIBase):
コード例 #52
0
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
#     NScD Oak Ridge National Laboratory, European Spallation Source
#     & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, division, print_function)

from qtpy import QtGui, QtWidgets
from qtpy.QtCore import Signal, QSettings, QFileInfo

from mantidqt.widgets import manageuserdirectories
from mantidqt.utils.qt import load_ui

Ui_RunSelectorWidget, _ = load_ui(__file__, "run_selector_widget.ui")


class RunSelectorWidget(QtWidgets.QWidget, Ui_RunSelectorWidget):
    manageDirectories = Signal()
    browse = Signal()
    addRuns = Signal()
    removeRuns = Signal()
    removeAllRuns = Signal()

    def __init__(self, parent=None):
        super(RunSelectorWidget, self).__init__(parent)
        self.setupUi(self)
        self._connect_signals()

    def setupUi(self, other):
        Ui_RunSelectorWidget.setupUi(self, other)
コード例 #53
0
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
#     NScD Oak Ridge National Laboratory, European Spallation Source
#     & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, division, print_function)

from qtpy import QtWidgets
from qtpy.QtCore import Signal

from mantidqt.utils.qt import load_ui
from sans.common.enums import BinningType

Ui_SummationSettingsWidget, _ = load_ui(__file__, "summation_settings_widget.ui")


def set_checked_without_signal(checkable, should_be_checked):
    checkable.blockSignals(True)
    checkable.setChecked(should_be_checked)
    checkable.blockSignals(False)


class SummationSettingsWidget(QtWidgets.QWidget, Ui_SummationSettingsWidget):
    binningTypeChanged = Signal(int)
    preserveEventsChanged = Signal(bool)
    binSettingsChanged = Signal()
    additionalTimeShiftsChanged = Signal()
    sum = Signal()

    def __init__(self, parent=None):
コード例 #54
0
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
#     NScD Oak Ridge National Laboratory, European Spallation Source
#     & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, division, print_function)

from qtpy import QtWidgets, QtCore
from Muon.GUI.Common.utilities import table_utils
from Muon.GUI.Common.message_box import warning
from mantidqt.utils.qt import load_ui

ui_muon_phases_tab, _ = load_ui(__file__, "muon_phases_tab.ui")


class PhaseTableView(QtWidgets.QWidget, ui_muon_phases_tab):
    def __init__(self, parent=None):
        super(PhaseTableView, self).__init__(parent)
        self.setupUi(self)
        self._old_backward_index = 1
        self._old_forward_index = 0
        self.setup_phase_table_options_table()

        self.backward_group_combo.currentIndexChanged.connect(self.ensure_groups_different)
        self.forward_group_combo.currentIndexChanged.connect(self.ensure_groups_different)

    @property
    def first_good_time(self):
        return float(self.first_good_data_item.text())
コード例 #55
0
ファイル: view.py プロジェクト: mantidproject/mantid
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
#     NScD Oak Ridge National Laboratory, European Spallation Source
#     & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
#  This file is part of the mantid workbench
from __future__ import absolute_import, unicode_literals

from qtpy.QtCore import Qt
from qtpy.QtWidgets import QMessageBox

from mantidqt.utils.qt import load_ui

form, base = load_ui(__file__, "main.ui")


class SettingsView(base, form):
    def __init__(self, parent, presenter):
        super(SettingsView, self).__init__(parent)
        self.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

        self.presenter = presenter

        self.sections.currentRowChanged.connect(self.presenter.action_section_changed)

    def closeEvent(self, event):
        self.presenter.refresh_workspaces()
        self.deleteLater()
        super(SettingsView, self).closeEvent(event)
コード例 #56
0
 def __init__(self, parent=None):
     QFrame.__init__(self, parent)
     self.ui = load_ui(__file__, '../../../ui/inelastic/dgs_data_corrections.ui', baseinstance=self)
コード例 #57
0
from mantidqt.utils.qt import load_ui
from mantidqt.widgets.workspacewidget import workspacetreewidget
from sans.common.enums import SaveType

from qtpy import PYQT4
if PYQT4:
    IN_MANTIDPLOT = False
    try:
        from pymantidplot import proxies
        IN_MANTIDPLOT = True
    except ImportError:
        pass


Ui_SaveOtherDialog, _ = load_ui(__file__, "save_other_dialog.ui")


class SANSSaveOtherDialog(QtWidgets.QDialog, Ui_SaveOtherDialog):
    def __init__(self, parent_widget=None):
        super(QtWidgets.QDialog, self).__init__(parent=parent_widget)
        self.subscribers = []
        self.setup_view()

    def setup_view(self):
        self.setupUi(self)
        self.filename_lineEdit.textChanged.connect(self.on_file_name_changed)
        self.browse_pushButton.pressed.connect(self.on_browse_clicked)
        self.save_button.pressed.connect(self.on_save_clicked)
        self.help_button.clicked.connect(self._on_help_button_clicked)
        self.cancel_button.pressed.connect(self.on_cancel_clicked)
コード例 #58
0
    def __init__(self, instrument=None, instrument_list=None):
        QMainWindow.__init__(self)
        self.ui = load_ui(__file__, 'ui/reduction_main.ui', baseinstance=self)

        if STARTUP_WARNING:
            message = "The reduction application has problems starting:\n\n"
            message += STARTUP_WARNING
            QMessageBox.warning(self, "WARNING", message)

        # Application settings
        settings = QSettings()

        # Name handle for the instrument
        if instrument is None:
            instrument = unicode(settings.value("instrument_name", ''))
            if instrument_list is not None and instrument not in instrument_list:
                instrument = None

        self._instrument = instrument
        self._facility = None

        # List of allowed instrument
        self._instrument_list = instrument_list

        # Reduction interface
        self._interface = None

        # Recent files
        self._recent_files = settings.value("recent_files", [])
        if self._recent_files is None:  # An empty list saved to QSettings comes back as 'None'
            self._recent_files = []

        # Folder to open files in
        self._last_directory = unicode(settings.value("last_directory", '.'))
        self._last_export_directory = unicode(settings.value("last_export_directory", '.'))

        # Current file name
        self._filename = None

        # Cluster credentials and options
        self._cluster_details_set = False
        self._number_of_nodes = 1
        self._cores_per_node = 16
        self._compute_resources = ['Fermi']
        if CAN_REDUCE and hasattr(ConfigService.Instance().getFacility(), "computeResources"):
            self._compute_resources = ConfigService.Instance().getFacility().computeResources()

        # Internal flag for clearing all settings and restarting the application
        self._clear_and_restart = False

        # General settings shared by all widgets
        self.general_settings = GeneralSettings(settings)

        # Event connections
        if not CAN_REDUCE:
            self.reduce_button.hide()
        self.export_button.clicked.connect(self._export)
        self.reduce_button.clicked.connect(self.reduce_clicked)
        self.save_button.clicked.connect(self._save)
        self.interface_chk.clicked.connect(self._interface_choice)

        self.interface_chk.setChecked(self.general_settings.advanced)

        self.general_settings.progress.connect(self._progress_updated)
コード例 #59
0
 def __init__(self, parent=None):
     QFrame.__init__(self, parent)
     self.ui = load_ui(__file__, '../../../ui/inelastic/dgs_diagnose_detectors.ui', baseinstance=self)