Exemple #1
0
 def __init__(self, parent=None, *args, **kwargs):
     QWidget.__init__(self, parent, *args, **kwargs)
     load_ui(__file__, 'powder.ui', self)
     self.btnPowderCalculateProjection.clicked.connect(self._btn_clicked)
     self._presenter = PowderProjectionPresenter(self, MantidProjectionCalculator())
     self.cmbPowderU1.currentIndexChanged.connect(self._u1_changed)
     self.cmbPowderU2.currentIndexChanged.connect(self._u2_changed)
Exemple #2
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        load_ui(__file__, 'dataloader.ui', self)

        self.file_system = QFileSystemModel()
        self.directory = QDir(os.path.expanduser('~'))
        path = self.directory.absolutePath()
        self.root_path = path
        self.file_system.setRootPath(path)
        self.file_system.setNameFilters(MSLICE_EXTENSIONS)
        self.file_system.setNameFilterDisables(False)
        self.table_view.setModel(self.file_system)
        self.table_view.setRootIndex(self.file_system.index(path))
        self.txtpath.setText(path)
        self.table_view.setColumnWidth(0, 320)
        self.table_view.setColumnWidth(1, 0)
        self.table_view.setColumnWidth(3, 140)
        self.table_view.setSelectionBehavior(QAbstractItemView.SelectRows)
        self._presenter = DataLoaderPresenter(self)
        self.btnload.setEnabled(False)
        self.btnmerge.setEnabled(False)

        self.table_view.activated.connect(self.activated)
        self.table_view.clicked.connect(self.validate_selection)
        self.txtpath.editingFinished.connect(self.refresh)
        self.btnback.clicked.connect(self.back)
        self.sort.currentIndexChanged.connect(self.sort_files)
        self.btnhome.clicked.connect(self.go_to_home)
        self.btnload.clicked.connect(partial(self.load, False))
        self.btnmerge.clicked.connect(partial(self.load, True))
Exemple #3
0
 def __init__(self, parent=None, *args, **kwargs):
     QWidget.__init__(self, parent, *args, **kwargs)
     load_ui(__file__, 'powder.ui', self)
     self.btnPowderCalculateProjection.clicked.connect(self._btn_clicked)
     self._presenter = PowderProjectionPresenter(
         self, MantidProjectionCalculator())
     self.cmbPowderU1.currentIndexChanged.connect(self._u1_changed)
     self.cmbPowderU2.currentIndexChanged.connect(self._u2_changed)
Exemple #4
0
    def __init__(self, in_mantidplot=False):
        QMainWindow.__init__(self)
        load_ui(__file__, 'mainwindow.ui', self)
        self.init_ui()

        self.tabs = [self.wgtSlice, self.wgtCut, self.wgtPowder]
        self.tabs_to_show = {TAB_2D: [TAB_POWDER],
                             TAB_EVENT: [TAB_SLICE, TAB_CUT],
                             TAB_HISTO: [],
                             TAB_NONPSD: [TAB_SLICE, TAB_CUT]}

        self.buttons_to_enable = {TAB_2D: [self.btnAdd, self.btnSubtract],
                                  TAB_EVENT: [self.btnMerge],
                                  TAB_HISTO: [self.btnPlot, self.btnOverplot],
                                  TAB_NONPSD: [self.btnAdd, self.btnSubtract]}
        if in_mantidplot:
            self.buttons_to_enable[TAB_HISTO] += [self.btnSaveToADS]

        self.workspace_presenter = self.wgtWorkspacemanager.get_presenter()
        self.dataloader_presenter = self.data_loading.get_presenter()
        self.slice_plotter_presenter = SlicePlotterPresenter()
        slice_widget_presenter = self.wgtSlice.get_presenter()
        slice_widget_presenter.set_slice_plotter_presenter(self.slice_plotter_presenter)
        self.powder_presenter = self.wgtPowder.get_presenter()
        self.cut_plotter_presenter = CutPlotterPresenter()
        self.cut_widget_presenter = self.wgtCut.get_presenter()
        self.cut_widget_presenter.set_cut_plotter_presenter(self.cut_plotter_presenter)
        self._presenter = MainPresenter(self, self.workspace_presenter, self.dataloader_presenter,
                                        slice_widget_presenter, self.powder_presenter, self.cut_widget_presenter,
                                        self.slice_plotter_presenter, self.cut_plotter_presenter)

        self.wgtWorkspacemanager.tab_changed.connect(self.ws_tab_changed)
        self.setup_save()
        self.btnSave.clicked.connect(self.button_save)
        self.btnAdd.clicked.connect(self.button_add)
        self.btnRename.clicked.connect(self.button_rename)
        self.btnSubtract.clicked.connect(self.button_subtract)
        self.btnDelete.clicked.connect(self.button_delete)
        self.btnMerge.clicked.connect(self.button_merge)
        self.btnPlot.clicked.connect(self.button_plot)
        self.btnOverplot.clicked.connect(self.button_overplot)
        self.btnSaveToADS.clicked.connect(self.button_savetoads)
        self.btnHistory.hide()
        self.ws_tab_changed(0)

        self.wgtCut.error_occurred.connect(self.show_error)
        self.wgtSlice.error_occurred.connect(self.show_error)
        self.wgtWorkspacemanager.error_occurred.connect(self.show_error)
        self.wgtPowder.error_occurred.connect(self.show_error)
        self.data_loading.error_occurred.connect(self.show_error)
        self.wgtCut.busy.connect(self.show_busy)
        self.wgtSlice.busy.connect(self.show_busy)
        self.wgtWorkspacemanager.busy.connect(self.show_busy)
        self.wgtPowder.busy.connect(self.show_busy)
        self.data_loading.busy.connect(self.show_busy)
        self.action_quit.triggered.connect(self.close)
Exemple #5
0
    def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        load_ui(__file__, 'plot_options.ui', self)

        self.lneFigureTitle.editingFinished.connect(self.titleEdited)
        self.lneXAxisLabel.editingFinished.connect(self.xLabelEdited)
        self.lneYAxisLabel.editingFinished.connect(self.yLabelEdited)
        self.lneXMin.editingFinished.connect(self.xRangeEdited)
        self.lneXMax.editingFinished.connect(self.xRangeEdited)
        self.lneYMin.editingFinished.connect(self.yRangeEdited)
        self.lneYMax.editingFinished.connect(self.yRangeEdited)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.chkXGrid.stateChanged.connect(self.xGridEdited)
        self.chkYGrid.stateChanged.connect(self.yGridEdited)
Exemple #6
0
    def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        load_ui(__file__, 'plot_options.ui', self)

        self.lneFigureTitle.editingFinished.connect(self.titleEdited)
        self.lneXAxisLabel.editingFinished.connect(self.xLabelEdited)
        self.lneYAxisLabel.editingFinished.connect(self.yLabelEdited)
        self.lneXMin.editingFinished.connect(self.xRangeEdited)
        self.lneXMax.editingFinished.connect(self.xRangeEdited)
        self.lneYMin.editingFinished.connect(self.yRangeEdited)
        self.lneYMax.editingFinished.connect(self.yRangeEdited)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.chkXGrid.stateChanged.connect(self.xGridEdited)
        self.chkYGrid.stateChanged.connect(self.yGridEdited)
Exemple #7
0
 def __init__(self, parent=None, *args, **kwargs):
     QWidget.__init__(self, parent, *args, **kwargs)
     load_ui(__file__, 'cut.ui', self)
     self._command_lookup = {
         self.btnCutPlot: Command.Plot,
         self.btnCutPlotOver: Command.PlotOver,
         self.btnCutSaveToWorkspace: Command.SaveToWorkspace
     }
     for button in self._command_lookup.keys():
         button.clicked.connect(self._btn_clicked)
     self._presenter = CutWidgetPresenter(self)
     self.cmbCutAxis.currentIndexChanged.connect(self.axis_changed)
     self._minimumStep = None
     self.lneCutStep.editingFinished.connect(self._step_edited)
     self.enable_integration_axis(False)
     self.set_validators()
Exemple #8
0
 def __init__(self, parent=None, *args, **kwargs):
     QWidget.__init__(self, parent, *args, **kwargs)
     load_ui(__file__, 'cut.ui', self)
     self._command_lookup = {
         self.btnCutPlot: Command.Plot,
         self.btnCutPlotOver: Command.PlotOver,
         self.btnCutSaveToWorkspace: Command.SaveToWorkspace
     }
     for button in self._command_lookup.keys():
         button.clicked.connect(self._btn_clicked)
     self._presenter = CutWidgetPresenter(self)
     self.cmbCutAxis.currentIndexChanged.connect(self.axis_changed)
     self._minimumStep = None
     self.lneCutStep.editingFinished.connect(self._step_edited)
     self.enable_integration_axis(False)
     self.set_validators()
     self._en = EnergyUnits('meV')
     self._en_default = 'meV'
     self.cmbCutEUnits.currentIndexChanged.connect(self._changed_unit)
Exemple #9
0
    def __init__(self, parent=None, *args, **kwargs):
        """This Widget provides basic control over displaying slices. This widget is NOT USABLE without a main window

        The main window must implement MainView"""
        QWidget.__init__(self, parent, *args, **kwargs)
        load_ui(__file__, 'slice.ui', self)
        self.btnSliceDisplay.clicked.connect(self._btn_clicked)
        self.display_errors_to_statusbar = True
        self._presenter = SliceWidgetPresenter(self)
        # Each time the fields are populated, set a minimum step size
        self._minimumStep = {}
        self.lneSliceXStep.editingFinished.connect(lambda: self._step_edited('x', self.lneSliceXStep))
        self.lneSliceYStep.editingFinished.connect(lambda: self._step_edited('y', self.lneSliceYStep))
        self.cmbSliceXAxis.currentIndexChanged.connect(lambda ind: self._change_axes(1, ind))
        self.cmbSliceYAxis.currentIndexChanged.connect(lambda ind: self._change_axes(2, ind))
        self.cmbSliceUnits.currentIndexChanged.connect(self._change_unit)
        self.set_validators()
        self._old_en = EnergyUnits('meV')
        self._en_default = 'meV'
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     load_ui(__file__, 'workspacemanager.ui', self)
     self.button_mappings = {}
     self._main_window = None
     self.onscreen_workspaces = []
     self.tab = None
     self.tab_to_list = {
         TAB_2D: self.listWorkspaces2D,
         TAB_EVENT: self.listWorkspacesEvent,
         TAB_HISTO: self.listWorkspacesHisto
     }
     self.tabWidget.currentChanged.connect(self.tab_changed_method)
     self.listWorkspaces2D.itemSelectionChanged.connect(
         self.list_item_changed)
     self.listWorkspacesEvent.itemSelectionChanged.connect(
         self.list_item_changed)
     self.listWorkspacesHisto.itemSelectionChanged.connect(
         self.list_item_changed)
     self._presenter = WorkspaceManagerPresenter(self)
Exemple #11
0
    def __init__(self, parent=None, *args, **kwargs):
        """This Widget provides basic control over displaying slices. This widget is NOT USABLE without a main window

        The main window must implement MainView"""
        QWidget.__init__(self, parent, *args, **kwargs)
        load_ui(__file__, 'slice.ui', self)
        self.btnSliceDisplay.clicked.connect(self._btn_clicked)
        self.display_errors_to_statusbar = True
        self._presenter = SliceWidgetPresenter(self)
        # Each time the fields are populated, set a minimum step size
        self._minimumStep = {}
        self.lneSliceXStep.editingFinished.connect(
            lambda: self._step_edited('x', self.lneSliceXStep))
        self.lneSliceYStep.editingFinished.connect(
            lambda: self._step_edited('y', self.lneSliceYStep))
        self.enable_units_choice(False)
        self.cmbSliceXAxis.currentIndexChanged.connect(
            lambda ind: self._change_axes(1, ind))
        self.cmbSliceYAxis.currentIndexChanged.connect(
            lambda ind: self._change_axes(2, ind))
        self.set_validators()
Exemple #12
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        load_ui(__file__, 'dataloader.ui', self)

        self.directory = QDir(os.path.expanduser('~'))
        self._sort_column = 0
        self.reload_model()
        self.txtpath.setText(self.directory.absolutePath())
        self._presenter = DataLoaderPresenter(self)
        self.btnload.setEnabled(False)
        self.btnmerge.setEnabled(False)

        self.table_view.activated.connect(self.activated)
        self.table_view.clicked.connect(self.validate_selection)
        self.txtpath.editingFinished.connect(self.refresh)
        self.btnback.clicked.connect(self.back)
        self.sort.currentIndexChanged.connect(self.sort_files)
        self.btnhome.clicked.connect(self.go_to_home)
        self.btnload.clicked.connect(partial(self.load, False))
        self.btnmerge.clicked.connect(partial(self.load, True))
        self.btnrefresh.clicked.connect(self.reload_model)
Exemple #13
0
 def __init__(self, parent=None, *args, **kwargs):
     QWidget.__init__(self, parent, *args, **kwargs)
     load_ui(__file__, 'status.ui', self)
 def __init__(self, ws_list, parent=None):
     QDialog.__init__(self, parent)
     load_ui(__file__, 'subtract_input_box.ui', self)
     for i in range(ws_list.count()):
         item = ws_list.item(i).clone()
         self.listWidget.insertItem(i, item)