def __init__(self): super(calibrationpanel, self).__init__() self.autoCalibrateAction = pTypes.ActionParameter( name='Auto Calibrate') self.autoCalibrateAction.sigActivated.connect(self.calibrate) calibrants = sorted(calibrant.ALL_CALIBRANTS.all.keys()) self.calibrant = pTypes.ListParameter(name='Calibrant Material', values=calibrants) self.autoCalibrateMethod = pTypes.ListParameter(name='Algorithm', values=self.algorithms) self.overlayAction = pTypes.ActionParameter(name='Simulate Calibrant') self.overlayAction.sigActivated.connect(self.simulatecalibrant) self.setParameters(pTypes.GroupParameter(name='Calibration', children=[ self.autoCalibrateAction, self.calibrant, self.autoCalibrateMethod, self.overlayAction ]), showTop=False)
def parameter(self): if not (hasattr(self, '_param') and self._param): instructions = parameterTypes.TextParameter(name='Instructions', value='Use the mouse to draw the mask. Click [Finish Mask] below when complete, or [Clear Selection] to start over.', readonly=True) clearmask = parameterTypes.ActionParameter(name='Clear Selection') finishmask = parameterTypes.ActionParameter(name='Finish Mask') children = [instructions, clearmask, finishmask] self._param = parameterTypes.GroupParameter(name='Polygon Mask', children=children) return self._param
def __init__(self, pipeline, **kwargs): kwargs['title'] = 'Input file' super().__init__(pipeline, **kwargs) try: file_path = pipeline.source.file_path except Exception: file_path = '' # Add LineEdit for choosing file file_path_str = parameterTypes.SimpleParameter( type='str', name=self.FILE_PATH_STR_NAME, value=file_path) file_path_str.sigValueChanged.connect(self._on_file_path_changed) self.file_path_str = self.addChild(file_path_str) # Add PushButton for choosing file file_path_button = parameterTypes.ActionParameter( type='action', name="Select data...") file_path_button.sigActivated.connect(self._choose_file) self.file_path_button = self.addChild(file_path_button)
def __init__(self, source_node, **kwargs): kwargs["title"] = "Input file" super().__init__(source_node, **kwargs) try: file_path = source_node.file_path except Exception: file_path = "" # Add LineEdit for choosing file file_path_str = parameterTypes.SimpleParameter( type="str", name=self.FILE_PATH_STR_NAME, value=file_path) file_path_str.setValue(file_path) file_path_str.sigValueChanged.connect(self._on_file_path_changed) self.file_path_str = self.addChild(file_path_str) # Add PushButton for choosing file file_path_button = parameterTypes.ActionParameter( type="action", name="Select data...") file_path_button.sigActivated.connect(self._choose_file) self.file_path_button = self.addChild(file_path_button)
def __init__(self, parent=None, *, pin=False): super().__init__(parent=parent) self._update_title() self._tree = ParameterTree(parent=self, showHeader=False) self._tree.setAlternatingRowColors(False) self._save_action = ptypes.ActionParameter(name='Save Suite') self._tree.addParameters(self._save_action) self._save_action.sigActivated.connect(self.save) self._bar = pcdsutils.qt.QPopBar(title='Suite', parent=self, widget=self._tree, pin=pin) self._content_frame = QtWidgets.QFrame(self) self._content_frame.setObjectName("content") self._content_frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self._content_frame.setLayout(QtWidgets.QHBoxLayout()) # Horizontal box layout: [PopBar] [Content Frame] layout = QtWidgets.QHBoxLayout() self.setLayout(layout) layout.setSpacing(1) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self._bar) layout.addWidget(self._content_frame) self.embedded_dock = None
def _create_parameters(self): file_path = self._output_node.output_path file_path_str = parameterTypes.SimpleParameter( type="str", name=self.FILE_PATH_STR_NAME, value=file_path) file_path_str.sigValueChanged.connect(self._on_file_path_changed) self.file_path_str = self.addChild(file_path_str) # Add PushButton for choosing file file_path_button = parameterTypes.ActionParameter( type="action", name="Change output file") file_path_button.sigActivated.connect(self._choose_file) self.file_path_button = self.addChild(file_path_button) start_stop_button = parameterTypes.ActionParameter(type="action", name="Start") start_stop_button.sigActivated.connect(self._on_start_stop_toggled) self.start_stop_button = self.addChild(start_stop_button)
def __init__(self, name, project, datatype_name, value, context, model_parent, **kwargs): """ Initializes the Array Parameter class. Parameters: ----------- name : str The name of the parameter project : pymap.project.Project The underlying pymap project. datatype_name : str The name of the datatype associated with the parameter. values : list The values of the array. context : list The context. model_parent : parameterTypes.Parameter The parent of the parameter according to the data model. """ super().__init__(name, project, datatype_name, value, context, model_parent, **kwargs) if not isinstance(self.datatype, VariableSizeArrayType) and not isinstance( self.datatype, UnboundedArrayType): raise RuntimeError( f'Expected a VariableSizeArrayType or UnboundedArrayType but got {type(self.datatype)} instead.' ) # Add widgets to add and remove elements self.addChild(parameterTypes.ActionParameter(name='Remove')) self.child('Remove').sigActivated.connect( lambda: self._remove(idx=self.child('idx').value())) self.addChild(parameterTypes.ActionParameter(name='Append')) self.child('Append').sigActivated.connect(self._append) # Make length in parent read-only if self._size_location() is not None: self._size_location().setReadonly(True) self.update_value()
def __init__( self, parent: Optional[QtWidgets.QWidget] = None, *, pin: bool = False, content_layout: Optional[QtWidgets.QLayout] = None, default_display_type: DisplayTypes = DisplayTypes.detailed_screen, scroll_option: ScrollOptions = ScrollOptions.auto, ): super().__init__(parent=parent) self._update_title() self._tree = parametertree.ParameterTree(parent=self, showHeader=False) self._tree.setAlternatingRowColors(False) self._save_action = ptypes.ActionParameter(name='Save Suite') self._tree.addParameters(self._save_action) self._save_action.sigActivated.connect(self.save) self._bar = pcdsutils.qt.QPopBar(title='Suite', parent=self, widget=self._tree, pin=pin) self._tree.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) self._tree.setMinimumSize(250, 150) self._content_frame = QtWidgets.QFrame(self) self._content_frame.setObjectName("content") self._content_frame.setFrameShape(QtWidgets.QFrame.StyledPanel) # Content frame layout: configurable # Defaults to [content] [content] [content] ... in one line if content_layout is None: content_layout = QtWidgets.QHBoxLayout() self._content_frame.setLayout(content_layout) # Horizontal box layout: [PopBar] [Content Frame] layout = QtWidgets.QHBoxLayout() self.setLayout(layout) layout.setSpacing(1) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self._bar) layout.addWidget(self._content_frame) self.embedded_dock = None self.default_display_type = default_display_type self.scroll_option = scroll_option
def __init__(self, *args, **kwargs): self.centerwidget = QtGui.QWidget() self.fileslistwidget = widgets.filesListWidget() self.centerwidget.setLayout(QtGui.QVBoxLayout()) self.centerwidget.layout().addWidget(self.fileslistwidget) self.rightwidget = ParameterTree() self.remeshOption = pTypes.SimpleParameter(type='bool', name='GIXS remeshing', value=False) self.integrateOption = pTypes.SimpleParameter( type='bool', name='Azimuthal integration', value=True) self.roiOption = pTypes.SimpleParameter(type='bool', name='Integrate last ROI', value=True) self.logOption = pTypes.SimpleParameter(type='bool', name='Log scale image', value=False) self.cakeOption = pTypes.SimpleParameter(type='bool', name='Cake (q/chi)', value=False) self.exportformat = pTypes.ListParameter( type='list', name='Image export format', value=0, values=['EDF (.edf)', 'TIFF (.tif)', 'JPEG (.jpg)']) self.processButton = pTypes.ActionParameter(name='Process') # self.abortButton = pTypes.ActionParameter(name='Abort') params = [ self.remeshOption, self.cakeOption, self.integrateOption, self.roiOption, self.logOption, self.exportformat, self.processButton ] paramgroup = Parameter.create(name='params', type='group', children=params) self.rightwidget.setParameters(paramgroup, showTop=False) self.processButton.sigActivated.connect(self.processfiles) super(BatchPlugin, self).__init__(*args, **kwargs)
def __init__(self, headermodel: QStandardItemModel, selectionmodel: QItemSelectionModel): super(CalibrationPanel, self).__init__() self.selectionmodel = selectionmodel self.headermodel = headermodel self.header().close() calibrants = dict( zip(calibrant.ALL_CALIBRANTS.keys(), calibrant.ALL_CALIBRANTS.values())) self.device = pTypes.ListParameter(name='Device', type='list', values=[], value='') self.calibrant = pTypes.ListParameter(name='Calibrant Material', values=calibrants, value=calibrants['AgBh']) self.autoCalibrateMethod = pTypes.ListParameter( name='Algorithm', values=self.algorithms.keys()) self.autoCalibrateAction = pTypes.ActionParameter( name='Auto Calibrate') self.autoCalibrateAction.sigActivated.connect(self.calibrate) self.calibratetext = pTypes.TextParameter(name='Instructions', value='', readonly=True, visible=False) self.parameter = pTypes.GroupParameter(name='Calibration', children=[ self.device, self.calibrant, self.autoCalibrateMethod, self.autoCalibrateAction, self.autoCalibrateAction, self.calibratetext ]) self.setParameters(self.parameter, showTop=False) from xicam.core.execution import Workflow self.workflow = Workflow()
def __init__(self): super(calibrationpanel, self).__init__() self.autoCalibrateAction = pTypes.ActionParameter( name='Auto Calibrate') self.autoCalibrateAction.sigActivated.connect(self.calibrate) calibrants = sorted(calibrant.calibrant_factory().all.keys()) self.calibrant = pTypes.ListParameter(name='Calibrant Material', values=calibrants) self.autoCalibrateMethod = pTypes.ListParameter( name='Algorithm', values=self.algorithms.keys()) self.setParameters(pTypes.GroupParameter(name='Calibration', children=[ self.autoCalibrateAction, self.calibrant, self.autoCalibrateMethod ]), showTop=False)
def __init__(self): super(spacegroupwidget, self).__init__() self.parameter = pTypes.GroupParameter(name='') self.setParameters(self.parameter, showTop=False) self.crystalsystem = pTypes.ListParameter(type='list', name='Crystal System', values=spacegrouptypes, value=None) self.spacegroupparameter = pTypes.ListParameter( type='list', name='Space Group', values=spacegroupnames[0], value=None) self.rotationstyle = pTypes.ListParameter(type='list', name='Rotation Mode', values=[ 'Sample-frame vector', 'Crystal-frame vector', 'Crystal plane' ]) self.rotationstyle.sigValueChanged.connect(self.rotationmodechanged) self.rotationxyz = VectorParameter(name='Vector (x,y,z)') self.rotationvectorsample = hideableGroup( name='Rotation (sample-frame vector)', children=[self.rotationxyz]) self.rotationxyz.setValue([0, 0, 1]) self.rotationuvw = VectorParameter(name='Vector (u,v,w)') self.rotationvectorcrystal = hideableGroup( name='Rotation (crystal-frame vector)', children=[self.rotationuvw]) self.rotationuvw.setValue([0, 0, 1]) self.rotationhkl = VectorParameter(name='Vector (h,k,l)') self.rotationplane = hideableGroup(name='Rotation (crystal plane)', children=[self.rotationhkl]) self.rotationhkl.setValue([0, 0, 1]) self.spacegroupeditors = [ triclinicparameter(), monoclinicparameter(), orthorhombicparameter(), tetragonalparameter(), trigonalparameter(), hexagonalparameter(), cubicparameter() ] self.rotations = [ self.rotationvectorsample, self.rotationvectorcrystal, self.rotationplane ] self.delta = pTypes.SimpleParameter(name=u'δ', type='float', value=2.67150153E-06) self.beta = pTypes.SimpleParameter(name=u'β', type='float', value=3.71373554E-09) self.refractiveindex = pTypes.GroupParameter( name='Refractive Index', children=[self.delta, self.beta]) self.redrawsg = pTypes.ActionParameter(name='Overlay space group') self.redrawsg.sigActivated.connect(self.drawoverlay) self.parameter.addChildren( [self.crystalsystem, self.spacegroupparameter] + self.spacegroupeditors + [self.rotationstyle] + self.rotations + [self.refractiveindex, self.redrawsg]) self.hidechildren() self.hiderotations() self.parameter.children()[2].show() self.rotations[0].show() self.crystalsystem.sigValueChanged.connect(self.crystalsystemchanged)
def _create_parameters(self): take_abs_bool = parameterTypes.SimpleParameter( type="bool", name=self.TAKE_ABS_BOOL_NAME, value=True, readonly=True, ) take_abs_bool.sigValueChanged.connect(self._on_take_abs_toggled) self.take_abs_bool = self.addChild(take_abs_bool) limits_modes = self.OUTPUT_CLASS.LIMITS_MODES limits_mode_values = [ limits_modes.LOCAL, limits_modes.GLOBAL, limits_modes.MANUAL, ] limits_mode_value = self._output_node.limits_mode limits_mode_combo = parameterTypes.ListParameter( name=self.LIMITS_MODE_COMBO_NAME, values=limits_mode_values, value=limits_mode_value, ) limits_mode_combo.sigValueChanged.connect(self._on_limits_mode_changed) self.limits_mode_combo = self.addChild(limits_mode_combo) lock_limits_bool = parameterTypes.SimpleParameter( type="bool", name=self.LOCK_LIMITS_BOOL_NAME, value=False) lock_limits_bool.sigValueChanged.connect(self._on_lock_limits_toggled) self.lock_limits_bool = self.addChild(lock_limits_bool) buffer_length_value = self._output_node.buffer_length buffer_length_slider = SliderParameter( name=self.BUFFER_LENGTH_SLIDER_NAME, limits=(0.1, 10), value=buffer_length_value, prec=3, suffix=" s", ) buffer_length_slider.sigValueChanged.connect( self._on_buffer_length_changed) self.buffer_length_slider = self.addChild(buffer_length_slider) lower_limit_value = self._output_node.colormap_limits.lower upper_limit_value = self._output_node.colormap_limits.upper lower_limit_spinbox = parameterTypes.SimpleParameter( type="float", name=self.LOWER_LIMIT_SPIN_BOX_NAME, decimals=3, limits=(None, upper_limit_value), ) upper_limit_spinbox = parameterTypes.SimpleParameter( type="float", name=self.UPPER_LIMIT_SPIN_BOX_NAME, decimals=3, limits=(lower_limit_value, None), ) lower_limit_spinbox.sigValueChanged.connect( self._on_lower_limit_changed) upper_limit_spinbox.sigValueChanged.connect( self._on_upper_limit_changed) self.lower_limit_spinbox = self.addChild(lower_limit_spinbox) self.upper_limit_spinbox = self.addChild(upper_limit_spinbox) self._on_limits_mode_changed(None, limits_mode_value) threshold_value = self._output_node.threshold_pct threshold_slider = SliderParameter( name=self.THRESHOLD_SLIDER_NAME, limits=(0, 99), value=threshold_value, prec=0, suffix="%", ) threshold_slider.sigValueChanged.connect(self._on_threshold_changed) self.threshold_slider = self.addChild(threshold_slider) gif_button = parameterTypes.ActionParameter(type="action", name="Record gif") gif_button.sigActivated.connect(self._toggle_gif_button) self.gif_button = self.addChild(gif_button) fps_text = parameterTypes.TextParameter(name="Refresh rate, FPS", readonly=True, value="0.0") self.fps_text = self.addChild(fps_text)
def _add_add(self): child_add = parameterTypes.ActionParameter( name=PointerParameter.add_reference) child_add.sigActivated.connect(lambda: self.add_new(referred=None)) self.addChild(child_add)