def __init__(self, addmode=True): super(CredentialDialog, self).__init__() # Set size and position # self.setGeometry(0, 0, 800, 500) frameGm = self.frameGeometry() screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos()) centerPoint = QApplication.desktop().screenGeometry(screen).center() frameGm.moveCenter(centerPoint) self.move(frameGm.topLeft()) # Setup fields self.host = QLineEdit() self.profiles = QComboBox() self.profiles.addItem("New...") self.profilename = QLineEdit() self.username = QLineEdit() self.password = QLineEdit() self.password.setEchoMode(QLineEdit.Password) self.savepassword = QCheckBox("Save Password") self.rememberprofile = QCheckBox("Remember Profile") # Setup dialog buttons self.addButton = QPushButton("&Add") self.connectButton = QPushButton("C&onnect") self.cancelButton = QPushButton("&Cancel") self.addButton.clicked.connect(self.add) self.connectButton.clicked.connect(self.connect) self.cancelButton.clicked.connect(self.close) self.profiles.currentTextChanged.connect(self.loadProfile) self.buttonboxWidget = QDialogButtonBox() if addmode: self.buttonboxWidget.addButton(self.addButton, QDialogButtonBox.AcceptRole) else: self.buttonboxWidget.addButton(self.connectButton, QDialogButtonBox.AcceptRole) self.buttonboxWidget.addButton(self.cancelButton, QDialogButtonBox.RejectRole) # Compose main layout mainLayout = QFormLayout() if not addmode: mainLayout.addRow("Profile", self.profiles) mainLayout.addRow("Profile", self.profilename) mainLayout.addRow("Host", self.host) mainLayout.addRow("Username", self.username) mainLayout.addRow("Password", self.password) mainLayout.addRow(self.savepassword) if not addmode: mainLayout.addRow(self.rememberprofile) mainLayout.addRow(self.buttonboxWidget) # Populate profiles for name, credential in manager.getPluginByName("Connections", "SettingsPlugin").plugin_object.credentials.items(): self.profiles.addItem(name) self.setLayout(mainLayout) self.setWindowTitle("Add Connection...") # Set modality self.setModal(True)
def fieldChanged(self, field): self.setCatalog(self.catalog, self.stream, field) # TODO -- figure out where to put the geometry update if QSpace in inspect.getmro(type(self)): self.setGeometry( pluginmanager.getPluginByName( 'xicam.SAXS.calibration', 'SettingsPlugin').plugin_object.AI(field))
def __init__(self): super(ipythonconsole, self).__init__() ipythonplugin = pluginmanager.getPluginByName('IPython', 'GUIPlugin').plugin_object self.kernel_manager = ipythonplugin.kernel_manager self.kernel_client = ipythonplugin.kernel_client # self.style_sheet = (qdarkstyle.load_stylesheet()) self.syntax_style = u'monokai' self.set_default_style(colors='Linux')
def loadProfile(self): profilename = self.profiles.currentText() if profilename == "New...": self.username.setEnabled(True) self.password.setEnabled(True) self.host.setEnabled(True) self.savepassword.setEnabled(True) self.rememberprofile.setVisible(True) else: credential = manager.getPluginByName("Connections", "SettingsPlugin").plugin_object.credentials[profilename] self.username.setText(credential["username"]) self.host.setText(credential["host"]) self.password.setText(credential["password"]) self.savepassword.setChecked(credential["savepassword"]) self.profilename.setText(profilename) self.username.setEnabled(False) self.password.setEnabled(False) self.host.setEnabled(False) self.savepassword.setEnabled(False) self.rememberprofile.setVisible(False)
def checkPolygonsSet(self, workflow: Workflow): """ Check for any unset polygonmask processes; start masking mode if found Parameters ---------- workflow: Workflow Returns ------- bool True if unset polygonmask process is found """ pluginmaskclass = pluginmanager.getPluginByName('Polygon Mask', 'ProcessingPlugin') for process in workflow.processes: if isinstance(process, pluginmaskclass.plugin_object): if process.polygon.value is None: self.startPolygonMasking(process) return True return False
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)
def __init__(self): # Data model self.headermodel = QStandardItemModel() # Initialize workflows self.maskingworkflow = MaskingWorkflow() self.simulateworkflow = SimulateWorkflow() self.displayworkflow = DisplayWorkflow() self.reduceworkflow = ReduceWorkflow() # Setup TabViews self.calibrationtabview = TabView(self.headermodel, pluginmanager.getPluginByName('SAXSViewerPlugin', 'WidgetPlugin').plugin_object, 'primary') self.masktabview = TabView(self.headermodel, pluginmanager.getPluginByName('SAXSViewerPlugin', 'WidgetPlugin').plugin_object, 'primary') self.reducetabview = TabView(self.headermodel, pluginmanager.getPluginByName('SAXSViewerPlugin', 'WidgetPlugin').plugin_object, 'primary', bindings=[('sigTimeChangeFinished', self.indexChanged)]) self.comparemultiview = SAXSMultiViewerPlugin(self.headermodel) self.tabviewsynchronizer = TabViewSynchronizer( [self.calibrationtabview, self.masktabview, self.reducetabview, self.comparemultiview.leftTabView]) # Setup toolbars self.calibrationtoolbar = SAXSToolbar(self.calibrationtabview, workflow=self.reduceworkflow) self.reducetoolbar = SAXSToolbar(self.reducetabview, workflow=self.reduceworkflow) self.calibrationtabview.kwargs['toolbar'] = self.calibrationtoolbar self.reducetabview.kwargs['toolbar'] = self.reducetoolbar # Setup calibration widgets self.calibrationsettings = pluginmanager.getPluginByName('DeviceProfiles', 'SettingsPlugin').plugin_object self.calibrationsettings.setModels(self.headermodel, self.calibrationtabview.selectionmodel) self.calibrationpanel = CalibrationPanel() self.calibrationpanel.setModels(self.headermodel, self.calibrationtabview.selectionmodel) self.calibrationpanel.sigDoCalibrateWorkflow.connect(self.doCalibrateWorkflow) # Setup masking widgets self.maskeditor = WorkflowEditor(self.maskingworkflow) self.maskeditor.sigWorkflowChanged.connect(self.doMaskingWorkflow) # Setup reduction widgets self.displayeditor = WorkflowEditor(self.displayworkflow) self.reduceworkflow.attach(partial(self.doReduceWorkflow, self.reduceworkflow)) self.reduceeditor = WorkflowEditor(self.reduceworkflow) self.reduceplot = SAXSSpectra(self.reduceworkflow, self.reducetoolbar) self.reducetoolbar.sigDoWorkflow.connect(partial(self.doReduceWorkflow, self.reduceworkflow)) self.reduceeditor.sigWorkflowChanged.connect(self.doReduceWorkflow) self.displayeditor.sigWorkflowChanged.connect(self.doDisplayWorkflow) self.reducetabview.currentChanged.connect(partial(self.doReduceWorkflow, self.reduceworkflow)) self.reducetabview.currentChanged.connect(partial(self.doDisplayWorkflow, self.displayworkflow)) # Setup more bindings self.calibrationsettings.sigSimulateCalibrant.connect(partial(self.doSimulateWorkflow, self.simulateworkflow)) self.stages = { 'Calibrate': GUILayout(self.calibrationtabview, # pluginmanager.getPluginByName('SAXSViewerPlugin', 'WidgetPlugin').plugin_object() right=self.calibrationsettings.widget, rightbottom=self.calibrationpanel, top=self.calibrationtoolbar), 'Mask': GUILayout(self.masktabview, right=self.maskeditor), 'Reduce': GUILayout(self.reducetabview, bottom=self.reduceplot, right=self.reduceeditor, righttop=self.displayeditor, top=self.reducetoolbar), 'Compare': GUILayout(self.comparemultiview, top=self.reducetoolbar, bottom=self.reduceplot, right=self.reduceeditor) } super(SAXSPlugin, self).__init__()
def __init__(self): self.catalog = BlueskyInMemoryCatalog() # XPCS data model self.resultsModel = QStandardItemModel() # Input (raw) data model self.headerModel = QStandardItemModel() self.selectionModel = QItemSelectionModel(self.headerModel) # Widgets self.calibrationSettings = pluginmanager.getPluginByName( 'xicam.SAXS.calibration', 'SettingsPlugin').plugin_object # Setup TabViews self.rawTabView = TabView( self.headerModel, widgetcls=XPCSViewerPlugin, selectionmodel=self.selectionModel, bindings=[(self.calibrationSettings.sigGeometryChanged, 'setGeometry')], geometry=self.getAI) # Setup correlation views self.twoTimeView = TwoTimeView() self.twoTimeFileSelection = FileSelectionView(self.headerModel, self.selectionModel) self.twoTimeProcessor = TwoTimeProcessor() self.twoTimeToolBar = QToolBar() self.twoTimeToolBar.addAction(QIcon(static.path('icons/run.png')), 'Process', self.processTwoTime) self.twoTimeToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.oneTimeView = OneTimeView() self.oneTimeFileSelection = FileSelectionView(self.headerModel, self.selectionModel) self.oneTimeProcessor = OneTimeProcessor() self.oneTimeToolBar = QToolBar() self.oneTimeToolBar.addAction(QIcon(static.path('icons/run.png')), 'Process', self.processOneTime) self.oneTimeToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) # self.placeholder = QLabel('correlation parameters') self.stages = { 'Raw': GUILayout(self.rawTabView, right=self.calibrationSettings.widget), '2-Time Correlation': GUILayout( self.twoTimeView, top=self.twoTimeToolBar, right=self.twoTimeFileSelection, rightbottom=self.twoTimeProcessor, ), # bottom=self.placeholder), '1-Time Correlation': GUILayout( self.oneTimeView, top=self.oneTimeToolBar, right=self.oneTimeFileSelection, rightbottom=self.oneTimeProcessor, ) # bottom=self.placeholder) } # TODO -- improve result caching self._results = [] super(XPCS, self).__init__()