コード例 #1
0
    def __init__(self):
        self.stages = {'Stage 1': GUILayout(QLabel('Stage 1')),
                       'Stage 2': {'Stage 2.1': GUILayout(QLabel('Stage 2'))},
                       'Stage 3': {'Stage 3.1': GUILayout(QLabel('Stage 3.1')),
                                   'Stage 3.2': GUILayout(QLabel('Stage 3.2'))}}

        super(TestPlugin, self).__init__()
コード例 #2
0
ファイル: __init__.py プロジェクト: lchen23/Xi-cam.BSISB
    def __init__(self, *args, **kwargs):

        self.mapToH5 = mapToH5()
        # Data model
        self.headermodel = QStandardItemModel()

        # Selection model
        self.selectionmodel = QItemSelectionModel(self.headermodel)
        self.preprocess = PreprocessWidget(self.headermodel,
                                           self.selectionmodel)
        self.FA_widget = FactorizationWidget(self.headermodel,
                                             self.selectionmodel)
        self.clusterwidget = ClusteringWidget(self.headermodel,
                                              self.selectionmodel)

        # update headers list when a tab window is closed
        self.headermodel.rowsRemoved.connect(
            partial(self.FA_widget.setHeader, 'spectra'))

        # Setup tabviews and update map selection
        self.imageview = BSISBTabview(self.headermodel, self.selectionmodel,
                                      MapView, 'image')
        self.imageview.currentChanged.connect(self.updateTab)

        self.stages = {
            "MapToH5": GUILayout(self.mapToH5),
            "Image View": GUILayout(self.imageview),
            "Preprocess": GUILayout(self.preprocess),
            "Decomposition": GUILayout(self.FA_widget),
            "Clustering": GUILayout(self.clusterwidget)
        }
        super(BSISB, self).__init__(*args, **kwargs)
コード例 #3
0
    def __init__(self, *args, **kwargs):

        self.mapToH5 = mapToH5()
        # Data model
        self.headermodel = QStandardItemModel()

        # Selection model
        self.selectionmodel = QItemSelectionModel(self.headermodel)

        self.PCA_widget = FactorizationWidget(self.headermodel,
                                              self.selectionmodel)
        self.NMF_widget = FactorizationWidget(self.headermodel,
                                              self.selectionmodel)

        # update headers list when a tab window is closed
        self.headermodel.rowsRemoved.connect(
            partial(self.PCA_widget.setHeader, 'spectra'))
        self.headermodel.rowsRemoved.connect(
            partial(self.NMF_widget.setHeader, 'volume'))

        # Setup tabviews and update map selection
        self.imageview = TabView(self.headermodel, self.selectionmodel,
                                 MapView, 'image')

        self.stages = {
            "MapToH5": GUILayout(self.mapToH5),
            "Image View": GUILayout(self.imageview),
            "PCA": GUILayout(self.PCA_widget),
            "NMF": GUILayout(self.NMF_widget)
        }
        super(BSISB, self).__init__(*args, **kwargs)
コード例 #4
0
    def __init__(self):
        self.workflow = Workflow()

        self.headermodel = QStandardItemModel()
        # self.alignmenttabview = TabView(self.headermodel)
        self.rawtabview = TabView(self.headermodel,
                                  widgetcls=RAWViewer,
                                  field='primary')
        self.recontabs = QTabWidget()

        self.workfloweditor = WorkflowEditor(self.workflow)
        self.workfloweditor.setHidden(True)

        self.tomotoolbar = TomoToolbar()
        self.tomotoolbar.sigSliceReconstruction.connect(self.sliceReconstruct)
        self.tomotoolbar.sigFullReconstruction.connect(self.fullReconstruction)

        self.stages = {
            'Alignment':
            GUILayout(QLabel('Alignment'),
                      right=self.workfloweditor,
                      top=self.tomotoolbar),
            'Preprocess':
            GUILayout(self.rawtabview,
                      right=self.workfloweditor,
                      top=self.tomotoolbar),
            'Reconstruct':
            GUILayout(self.recontabs,
                      top=self.tomotoolbar,
                      right=self.workfloweditor),
        }
        super(TomographyPlugin, self).__init__()
コード例 #5
0
    def __init__(self):
        self.stages = {
            "Stage 1": GUILayout(QLabel("Stage 1")),
            "Stage 2": {"Stage 2.1": GUILayout(QLabel("Stage 2"))},
            "Stage 3": {"Stage 3.1": GUILayout(QLabel("Stage 3.1")), "Stage 3.2": GUILayout(QLabel("Stage 3.2"))},
        }

        super(TestPlugin, self).__init__()
コード例 #6
0
    def __init__(self, *args, **kwargs):
        # Insert code here

        # Modify stages here
        self.stages = {'Stage 1': GUILayout(QLabel("Stage 1...")),
                       "Stage 2": GUILayout(QLabel("Stage 2..."))}

        # Initialize the parent class, GUIPlugin
        super({{cookiecutter.plugin_name}}, self).__init__(*args, **kwargs)
コード例 #7
0
    def __init__(self):
        #Define workflows
        self.my_workflow = MyWorkflow()
        #self.my_workflow_editor = WorkflowEditor(self.my_workflow)
        # Define a GUILayout
        # GUILayouts must provide a center widget
        #self.container_widget = QWidget()
        self.split_widget = CatalogAndAnalysisSplitWidget()
        layout = QVBoxLayout()  # what kind of layout
        self.button = QPushButton("push this")
        #layout.addWidget(self.split_widget) # add things to the layout one by one
        #layout.addWidget(self.button)
        #self.container_widget.setLayout(layout) # apply layout to the basic widget
        bottom_widget = QLabel('bottom')
        left_widget = QLabel('left')
        leftbottom_widget = QLabel('left bottom')
        right_widget = QLabel('right')

        self.model = QStandardItemModel()
        self.selectionmodel = QItemSelectionModel(self.model)
        stream = 'primary'
        field = 'img'
        self.test_tab_view = TabView(self.model,
                                     self.selectionmodel,
                                     widgetcls=MyImageView,
                                     stream=stream,
                                     field=field)

        self.parameter_view = ParameterTree()
        for operation in self.my_workflow.operations:
            parameter_dict = operation.as_parameter()
            for list_parameter in parameter_dict:
                parameter = Parameter.create(**list_parameter)
                self.parameter_view.addParameters(parameter)
        stage_layout = GUILayout(
            center=self.split_widget,
            #left=left_widget,
            #right=right_widget,
            #leftbottom = leftbottom_widget,
            bottom=self.button,
        )
        second_stage_layout = GUILayout(center=self.test_tab_view,
                                        righttop=self.parameter_view)
        #workflow_stage = GUILayout(center=self.test_tab_view, righttop=self.my_workflow_editor)
        #self.button.clicked.connect(self.update_label)
        #self.button.clicked.connect(self.show_message)
        self.button.clicked.connect(self.run_workflow)
        self.stages = {
            'catalogviewer and fft': stage_layout,
            'Something Else': second_stage_layout,
            #'testing workflow editor': workflow_stage,
        }

        super(MyGUIPlugin, self).__init__()
コード例 #8
0
    def __init__(self, *args, **kwargs):

        # Data model
        self.headermodel = QStandardItemModel()
        self.toolbar = QToolBar()

        # plot widget
        self.reduceWidget = QWidget()
        self.plot = pg.PlotWidget()
        self.layout = QGridLayout()
        self.reduceWidget.setLayout(self.layout)
        self.layout.addWidget(self.plot)
        x = np.random.random(20)
        y = np.random.random(20)
        self.plot.plot(x, y)

        # table widget
        self.tableWidget = QWidget()
        self.table = QTableWidget()
        self.layout2 = QGridLayout()
        self.tableWidget.setLayout(self.layout2)
        self.layout2.addWidget(self.table)
        self.table.setRowCount(len(x))
        self.table.setColumnCount(2)
        for i in range(0, len(x)):
            self.table.setItem(i, 0, QTableWidgetItem(str(round(x[i], 3))))
            self.table.setItem(i, 1, QTableWidgetItem(str(round(y[i], 3))))

        # Selection model
        self.selectionmodel = QItemSelectionModel(self.headermodel)

        # Setup TabViews
        self.rawview = TabView(self.headermodel, self.selectionmodel,
                               widgets.EFIViewerPlugin, 'primary')

        self.reduceview = TabView(self.headermodel, self.selectionmodel,
                                  self.reduceWidget)

        self.metadataview = MetadataView(self.headermodel, self.selectionmodel)

        self.stages = {
            'View':
            GUILayout(self.rawview, top=self.toolbar, right=self.metadataview),
            'Reduce':
            GUILayout(self.reduceWidget,
                      top=self.toolbar,
                      right=self.tableWidget)
            # 'View': GUILayout(QLabel('View'))
        }
        super(EFIPlugin, self).__init__(*args, **kwargs)
コード例 #9
0
    def __init__(self, *args, **kwargs):
        """Constructs the ExamplePlugin

        This will set up the widgets that we want the ExamplePlugin to have,
        the layout for the widgets (how the interface will look) in the ExamplePlugin,
        and an example workflow.
        """
        self._catalog_viewer = CatalogView(
        )  # Create a widget to view the loaded catalog
        self._results_viewer = DynImageView(
        )  # Create a widget to view the result image

        self._workflow = ExampleWorkflow()  # Create a workflow
        # Create a widget for the workflow; this shows the operations and their paramters,
        # and we can run the workflow with this widget
        self._workflow_editor = WorkflowEditor(workflow=self._workflow)
        # The WorkflowEditor emits a "sigRunWorkflow" signal when its "Run Workflow" is clicked
        # This will call our run_workflow method whenever this signal is emitted (whenever the button is clicked).
        self._workflow_editor.sigRunWorkflow.connect(self.run_workflow)

        # Create a layout to organize our widgets
        # The first argument (which corresponds to the center widget) is required.
        catalog_viewer_layout = GUILayout(self._catalog_viewer,
                                          right=self._workflow_editor,
                                          bottom=self._results_viewer)

        # Create a "View" stage that has the catalog viewer layout
        self.stages = {"View": catalog_viewer_layout}

        # For classes derived from GUIPlugin, this super __init__ must occur at end
        super(ExamplePlugin, self).__init__(*args, **kwargs)
コード例 #10
0
    def __init__(self):

        self.workflow = Workflow()
        self.workfloweditor = WorkflowEditor(
            self.workflow,
            callback_slot=self.showResult,
            except_slot=lambda *_: self.workflow._pretty_print())

        self.ensemble_model = EnsembleModel()

        data_selector_view = DataSelectorView()
        data_selector_view.setModel(self.ensemble_model)

        # Our results views' model (should only contain intents)
        intents_model = IntentsModel()
        intents_model.setSourceModel(self.ensemble_model)

        # Our results view widget container
        results_view = StackedCanvasView()
        results_view.setModel(intents_model)

        self.stages = {
            'Testing':
            GUILayout(results_view,
                      left=None,
                      righttop=data_selector_view,
                      right=self.workfloweditor),
        }
        super(WorkflowEditorPlugin, self).__init__()
コード例 #11
0
    def __init__(self, *args, **kwargs):
        self.plugin_maker = QMainWindow()
        self.uic_file = os.path.dirname(os.path.realpath(
            __file__)) + os.path.sep + "ui" + os.path.sep + "main.ui"

        result = uic.loadUi(self.uic_file, MyCustomClass())

        spoiler_widgets = result.findChildren(MyCustomClass.SpoilerWidget)
        for spoiler in spoiler_widgets:
            spoiler.modify()

        self.plugin_type = result.findChild(QComboBox,
                                            "plugin_type")  # type: QComboBox
        self.plugin_name = result.findChild(QLineEdit,
                                            "plugin_name")  # type: QLineEdit
        self.pyqode_root = result.findChild(QWidget,
                                            "pyqode_root")  # type: QWidget
        self.pyqode_root.setLayout(QVBoxLayout())
        # self.pyqode_root.layout().addWidget(MyPythonCodeEdit())
        self.pyqode_root.layout().addWidget(QTextEdit())

        self.plugin_generator = PluginDependencyGenerator(result)
        self.gui_generator = GuiPluginGenerator(result)

        self.generate = result.findChild(QPushButton,
                                         "generate")  # type: QPushButton
        self.generate.clicked.connect(self.generate_output)

        self.plugin_maker.setCentralWidget(result)
        self.stages = {'PluginMaker': GUILayout(self.plugin_maker)}

        super(PluginMaker, self).__init__(*args, **kwargs)
コード例 #12
0
    def __init__(self):
        runengine.initialize()
        deviceviewcontainer = DeviceView()
        devicelist = deviceviewcontainer.view
        controlsstack = QStackedWidget()
        devicelist.sigShowControl.connect(controlsstack.addSetWidget)

        self.stages = {
            'Controls': GUILayout(
                controlsstack,
                left=devicelist,
            ),
            'Plans': GUILayout(scripteditor(), left=devicelist),
            'Run Engine': GUILayout(RunEngineWidget(), left=devicelist)
        }
        super(AcquirePlugin, self).__init__()
コード例 #13
0
    def __init__(self):
        self.imageview = XArrayView()

        self.stages = {
            "Stage 1": GUILayout(self.imageview),
        }

        super(TestPlugin, self).__init__()
コード例 #14
0
    def __init__(self):
        self.imageview = XArrayView()

        self.stages = {
            'Viewer': GUILayout(self.imageview),
        }

        super(CatalogViewerPlugin, self).__init__()
コード例 #15
0
ファイル: __init__.py プロジェクト: tacaswell/Xi-cam.CDGISAXS
    def __init__(self):


        # Setup layout
        self.stages = {'Terminal': GUILayout(QWidget())}


        super(CDGISAXSPlugin, self).__init__()
コード例 #16
0
ファイル: test_catalog.py プロジェクト: Richardk2n/Xi-cam.gui
    def __init__(self):
        self.imageview = CatalogView()

        self.stages = {
            'Stage 1': GUILayout(self.imageview),
        }

        super(TestPlugin, self).__init__()
コード例 #17
0
    def __init__(self):
        devicelist = DeviceList()
        controlsstack = QStackedWidget()
        devicelist.sigShowControl.connect(controlsstack.addSetWidget)

        self.stages = {
            'Controls':
            GUILayout(
                controlsstack,
                left=devicelist,
                lefttop=BCSConnector(),
            ),
            'Scripting':
            GUILayout(AdvancedPythonWidget(),
                      left=devicelist,
                      lefttop=BCSConnector()),
        }
        super(AcquirePlugin, self).__init__()
コード例 #18
0
    def __init__(self, *args, **kwargs):
        self.logwidget = QListWidget()
        self.stages = {'Log': GUILayout(self.logwidget)}
        super(LogPlugin, self).__init__(*args, **kwargs)
        logging.Handler.__init__(self)
        self.level = msg.DEBUG
        self.filters = [BlacklistFilter()]

        logging.getLogger().addHandler(self)
コード例 #19
0
    def __init__(self):
        # Data model
        self.catalogModel = QStandardItemModel()

        # Selection model
        self.selectionmodel = QItemSelectionModel(self.catalogModel)

        # Setup TabViews
        self.rawview = TabView(self.catalogModel,
                               self.selectionmodel,
                               widgets.NCEMViewerPlugin,
                               'primary',
                               field='raw')

        self.fftview = TabView(self.catalogModel,
                               self.selectionmodel,
                               widgets.FFTViewerPlugin,
                               'primary',
                               field='raw')

        #self.fourDview = TabView(self.headermodel, self.selectionmodel, widgets.FourDImageView, 'primary')

        self.metadataview = MetadataView(self.catalogModel,
                                         self.selectionmodel,
                                         excludedkeys=('uid', 'descriptor',
                                                       'data'))

        # self.toolbar = widgets.NCEMToolbar(self.catalogModel, self.selectionmodel)

        self.stages = {
            'View':
            GUILayout(self.rawview,
                      right=self.metadataview),  # top=self.toolbar, )),
            # 'View': GUILayout(self.rawview, top=self.toolbar),
            # '4D STEM': GUILayout(self.fourDview, ),
            'FFT View': GUILayout(self.fftview, )
        }
        super(NCEMPlugin, self).__init__()
コード例 #20
0
    def __init__(self):
        print("Initializing")
        self.logwidget = QListWidget()
        self.leftdisplay = pg.ImageView()
        self.rightdisplay = pg.ImageView()
        self.stages = {
            'StreamingTomography':
            GUILayout(self.leftdisplay, right=self.rightdisplay)
        }
        super(StreamingTomographyPlugin, self).__init__()

        self.thread = threads.QThreadFutureIterator(self.background_sock,
                                                    callback_slot=self.display,
                                                    showBusy=True)
        self.thread.start()
コード例 #21
0
    def __init__(self):
        self.monitorwidget = QListView()
        self.toolbar = QToolBar()
        actionPause = QAction(QIcon(str(path('icons/pause.png'))), "Pause", self.toolbar)
        actionPause.triggered.connect(self.pause)
        actionPause.setCheckable(True)
        self.toolbar.addAction(actionPause)
        self.stages = {'Monitor': GUILayout(self.monitorwidget, top=self.toolbar)}
        super(ThreadMonitorPlugin, self).__init__()

        self.model = QStandardItemModel()
        self.monitorwidget.setModel(self.model)
        self.timer = QTimer()
        self.timer.timeout.connect(self.update)
        self.timer.start(1000)
コード例 #22
0
ファイル: __init__.py プロジェクト: phzwart/Xi-cam.BSISB
    def __init__(self, *args, **kwargs):
        self.imageview = MapViewWidget()
        self.spectra = SpectraPlotWidget()

        self.stage2spectra = SpectraPlotWidget()

        self.lefttoolbar = QToolBar()
        self.lefttoolbar.setOrientation(Qt.Vertical)
        self.zoombutton = QToolButton()
        self.zoombutton.setText('Zoom In')
        self.lefttoolbar.addWidget(self.zoombutton)

        self.centerwidget = QWidget()
        self.centerlayout = QHBoxLayout()
        self.centerwidget.setLayout(self.centerlayout)
        self.centerlayout.addWidget(self.lefttoolbar)
        self.centerlayout.addWidget(self.imageview)

        # Connect signals
        self.imageview.sigShowSpectra.connect(self.spectra.showSpectra)

        self.stages = {"BSISB": GUILayout(self.centerwidget, bottom=self.spectra),
                       "NMF": GUILayout(self.stage2spectra)}
        super(BSISB, self).__init__(*args, **kwargs)
コード例 #23
0
    def __init__(self):
        # # Enforce global style within the console
        # with open('xicam/gui/style.stylesheet', 'r') as f:
        #     style = f.read()
        # style = (qdarkstyle.load_stylesheet() + style)

        # Setup the kernel
        self.kernel_manager = QtInProcessKernelManager()
        self.kernel_manager.start_kernel()
        kernel = self.kernel_manager.kernel
        kernel.gui = 'qt'

        # Push Xi-cam variables into the kernel
        kernel.shell.push({
            plugin.name: plugin
            for plugin in pluginmanager.get_plugins_of_type("GUIPlugin") +
            pluginmanager.get_plugins_of_type("EZPlugin")
        })

        # Observe plugin changes
        pluginmanager.attach(self.pluginsChanged)

        # Continue kernel setuppluginmanager.getPluginsOfCategory("GUIPlugin")
        self.kernel_client = self.kernel_manager.client()
        threads.invoke_in_main_thread(self.kernel_client.start_channels)

        # Setup console widget
        def stop():
            self.kernel_client.stop_channels()
            self.kernel_manager.shutdown_kernel()

        control = RichJupyterWidget()
        control.kernel_manager = self.kernel_manager
        threads.invoke_in_main_thread(setattr, control, "kernel_client",
                                      self.kernel_client)
        control.exit_requested.connect(stop)
        # control.style_sheet = style
        control.syntax_style = u'monokai'
        control.set_default_style(colors='Linux')

        # Setup layout
        self.stages = {'Terminal': GUILayout(control)}

        # Save for later
        self.kernel = kernel

        super(IPythonPlugin, self).__init__()
コード例 #24
0
 def __init__(self):
     self.layout = QHBoxLayout()
     self.parent_widget = QWidget()
     self.field_label = QLabel('Select image:')
     self.field_combo_box = QComboBox()
     self.field_combo_box.setFixedWidth(300)
     self.layout.addSpacerItem(QSpacerItem(0, 0, QSizePolicy.Expanding))
     self.layout.addWidget(self.field_label)
     self.layout.addWidget(self.field_combo_box)
     self.parent_widget.setLayout(self.layout)
     self.field_combo_box.currentTextChanged.connect(self.field_changed)
     self.catalog_viewer = CatalogViewerBlend()
     self.stages = {
         'Viewer':
         GUILayout(top=self.parent_widget, center=self.catalog_viewer),
     }
     super(CatalogViewerPlugin, self).__init__()
コード例 #25
0
ファイル: __init__.py プロジェクト: Xi-CAM/Xi-cam.spectral
    def __init__(self):
        super(MapStage, self).__init__()

        self.canvases_view = StackedCanvasView()
        self.canvases_view.setModel(self.intents_model)

        self.preprocess_workflow = Workflow()
        self.preprocess_editor = WorkflowEditor(
            self.preprocess_workflow,
            callback_slot=self.append_result,
            # finished_slot=self.append_result,
            kwargs_callable=self.treatment_kwargs)

        self.stages["Map"] = GUILayout(self.catalog_viewer,
                                       right=self.preprocess_editor,
                                       bottom=self.canvases_view,
                                       righttop=self.data_selector_view)
コード例 #26
0
    def __init__(self, *args, **kwargs):

        self.sftp_client = dict()

        self.centerwidget, self.rightwidget, self.leftwidget = ui.load()

        # INIT FORMS
        self.computationForm = None
        self._detectorForm = None
        self._scatteringForm = None

        # SETUP FEATURES
        featuremanager.layout = ui.leftwidget.featuresList
        featuremanager.load()

        # INIT EXPERIMENT
        self.newExperiment()

        # WIREUP CONTROLS
        self.leftwidget.addFeatureButton.clicked.connect(featuremanager.addLayer)
        self.leftwidget.addSubstrateButton.clicked.connect(featuremanager.addSubstrate)
        self.leftwidget.addParticleButton.clicked.connect(featuremanager.addParticle)
        # self.leftwidget.showComputationButton.clicked.connect(self.showComputation)
        self.leftwidget.showDetectorButton.clicked.connect(self.showDetector)
        self.leftwidget.addParticleButton.setMenu(ui.particlemenu)
        self.leftwidget.runLocal.clicked.connect(self.runLocal)
        self.leftwidget.runRemote.clicked.connect(self.runRemote)
        self.leftwidget.runDask.clicked.connect(self.runDask)

        # inject loginwidget
        # from xicam.widgets import login
        # self.loginwidget= login.LoginDialog()
        # self.leftwidget.layout().addWidget(self.loginwidget)


        # SETUP DISPLAY
        display.load()
        display.redraw()
        self.centerwidget.addWidget(display.viewWidget)

        # SETUP stages
        self.stages = {'HipGISAXS': GUILayout(self.centerwidget, left=self.leftwidget, right=self.rightwidget)}

        super(HipGISAXSPlugin, self).__init__(*args, **kwargs)
コード例 #27
0
    def __init__(self, *args, **kwargs):
        """
        """
        # self._catalog_viewer = CatalogView()  # Create a widget to view the loaded catalog
        # self._results_viewer = DynImageView()  # Create a widget to view the result image

        self._workflow = MapWorkflow()  # Create a workflow
        # Create a widget for the workflow; this shows the operations and their parameters,
        # and we can run the workflow with this widget
        self._workflow_editor = WorkflowEditor(workflow=self._workflow)
        # The WorkflowEditor emits a "sigRunWorkflow" signal when its "Run Workflow" is clicked
        # This will call our run_workflow method whenever this signal is emitted (whenever the button is clicked).
        self._workflow_editor.sigRunWorkflow.connect(self.run_workflow)

        # Create a layout to organize our widgets
        # The first argument (which corresponds to the center widget) is required.
        catalog_viewer_layout = GUILayout(self._catalog_viewer,
                                          right=self._workflow_editor,
                                          bottom=self._results_viewer)
        super(RegisterStack, self).__init__(*args, **kwargs)
コード例 #28
0
    def __init__(self):
        # Define workflows
        self.my_workflow = MyWorkflow()
        
        # Define stages
        
        # GUILayout must provide a center widget
        # Use a subclass to group some widget
        self.center_widget = MyImageWidget()

        # Adding button 
        self.button = QPushButton("Button")

        # Must pass a widget to GUILayout.  Widgets have layouts though
        stage_layout = GUILayout(center=self.center_widget, bottom=self.button) 

        # Define some connections
        # SYNTAX: variable.<SIGNAL>.connect(<SLOT>:function)
        # SIGNALs are emitted when a gui "event" happens (click, change, etc)
        # Different QObjects define/emit different SIGNALs
        # Connect a SIGNAL to a function (called SLOT)
        #   function/SLOT called when SIGNAL emitted (event happens)
        self.button.clicked.connect(self.update_label)
        self.button.clicked.connect(self.show_message)
        self.button.clicked.connect(self.run_workflow)
        # self.stages defines GUILayouts
        # self.stages is a dictionary contianing:
        #       stage name -> GUILayout
        #       stage name 2 -> GUILayout 2
        #       ...
        self.stages = { 
            'first stage': stage_layout 
        }

        # newer suggested format for super()
        # here need to run super after GUILayouts
        super(MyGUIPlugin, self).__init__()
コード例 #29
0
 def __init__(self):
     self.catalog_viewer = CatalogViewerBlend()
     self.stages = {
         "Viewer": GUILayout(center=self.catalog_viewer),
     }
     super(CatalogViewerPlugin, self).__init__()
コード例 #30
0
    def __init__(self):
        # Late imports required due to plugin system
        from xicam.SAXS.calibration import CalibrationPanel
        from xicam.SAXS.widgets.SAXSMultiViewer import SAXSMultiViewerPlugin
        from xicam.SAXS.widgets.SAXSViewerPlugin import SAXSViewerPluginBase, SAXSCalibrationViewer, SAXSMaskingViewer, \
            SAXSReductionViewer
        from xicam.SAXS.widgets.SAXSToolbar import SAXSToolbar
        from xicam.SAXS.widgets.SAXSSpectra import SAXSSpectra

        # Data model
        self.headermodel = QStandardItemModel()
        self.selectionmodel = QItemSelectionModel(self.headermodel)

        # Initialize workflows
        self.maskingworkflow = MaskingWorkflow()
        self.simulateworkflow = SimulateWorkflow()
        self.displayworkflow = DisplayWorkflow()
        self.reduceworkflow = ReduceWorkflow()

        # Grab the calibration plugin
        self.calibrationsettings = pluginmanager.getPluginByName(
            'xicam.SAXS.calibration', 'SettingsPlugin').plugin_object
        print(
            pluginmanager.getPluginByName('xicam.SAXS.calibration',
                                          'SettingsPlugin').path)

        # Setup TabViews
        self.calibrationtabview = TabView(
            self.headermodel,
            widgetcls=SAXSCalibrationViewer,
            selectionmodel=self.selectionmodel,
            bindings=[(self.calibrationsettings.sigGeometryChanged,
                       'setGeometry')],
            geometry=self.getAI)
        self.masktabview = TabView(
            self.headermodel,
            widgetcls=SAXSMaskingViewer,
            selectionmodel=self.selectionmodel,
            bindings=[('sigTimeChangeFinished', self.indexChanged),
                      (self.calibrationsettings.sigGeometryChanged,
                       'setGeometry')],
            geometry=self.getAI)
        self.reducetabview = TabView(
            self.headermodel,
            widgetcls=SAXSReductionViewer,
            selectionmodel=self.selectionmodel,
            bindings=[('sigTimeChangeFinished', self.indexChanged),
                      (self.calibrationsettings.sigGeometryChanged,
                       'setGeometry')],
            geometry=self.getAI)
        self.comparemultiview = SAXSMultiViewerPlugin(self.headermodel,
                                                      self.selectionmodel)

        # self.tabviewsynchronizer = TabViewSynchronizer(
        #     [self.calibrationtabview, self.masktabview, self.reducetabview, self.comparemultiview.leftTabView])

        # Setup toolbars
        self.toolbar = SAXSToolbar(self.headermodel, self.selectionmodel)
        self.calibrationtabview.kwargs['toolbar'] = self.toolbar
        self.reducetabview.kwargs['toolbar'] = self.toolbar

        # Setup calibration widgets
        self.calibrationsettings.setModels(
            self.headermodel, self.calibrationtabview.selectionmodel)
        self.calibrationpanel = CalibrationPanel(
            self.headermodel, self.calibrationtabview.selectionmodel)
        self.calibrationpanel.sigDoCalibrateWorkflow.connect(
            self.doCalibrateWorkflow)
        self.calibrationsettings.sigGeometryChanged.connect(
            self.doSimulateWorkflow)

        # Setup masking widgets
        self.maskeditor = WorkflowEditor(self.maskingworkflow)
        self.maskeditor.sigWorkflowChanged.connect(self.doMaskingWorkflow)

        # Setup reduction widgets
        self.displayeditor = WorkflowEditor(self.displayworkflow)
        self.reduceeditor = WorkflowEditor(self.reduceworkflow)
        self.reduceplot = SAXSSpectra(self.reduceworkflow, self.toolbar)
        self.toolbar.sigDoWorkflow.connect(partial(self.doReduceWorkflow))
        self.reduceeditor.sigWorkflowChanged.connect(self.doReduceWorkflow)
        self.displayeditor.sigWorkflowChanged.connect(self.doDisplayWorkflow)
        self.reducetabview.currentChanged.connect(self.headerChanged)
        self.reducetabview.currentChanged.connect(self.headerChanged)

        # Setup more bindings
        self.calibrationsettings.sigSimulateCalibrant.connect(
            partial(self.doSimulateWorkflow))

        self.stages = {
            'Calibrate':
            GUILayout(
                self.calibrationtabview,
                # pluginmanager.getPluginByName('SAXSViewerPlugin', 'WidgetPlugin').plugin_object()
                right=self.calibrationsettings.widget,
                rightbottom=self.calibrationpanel,
                top=self.toolbar),
            'Mask':
            GUILayout(self.masktabview,
                      right=self.maskeditor,
                      top=self.toolbar),
            'Reduce':
            GUILayout(self.reducetabview,
                      bottom=self.reduceplot,
                      right=self.reduceeditor,
                      righttop=self.displayeditor,
                      top=self.toolbar),
            'Compare':
            GUILayout(self.comparemultiview,
                      top=self.toolbar,
                      bottom=self.reduceplot,
                      right=self.reduceeditor)
        }
        super(SAXSPlugin, self).__init__()

        # Start visualizations
        self.displayworkflow.visualize(
            self.reduceplot,
            imageview=lambda: self.reducetabview.currentWidget(),
            toolbar=self.toolbar)