本文整理汇总了Python中gui.widgets.create_task_base.CreateTaskBase类的典型用法代码示例。如果您正苦于以下问题:Python CreateTaskBase类的具体用法?Python CreateTaskBase怎么用?Python CreateTaskBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CreateTaskBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_models
def init_models(self):
CreateTaskBase.init_models(self)
self.xrf_spectrum_model = queue_model_objects.XRFSpectrum()
self._path_template.start_num = 1
self._path_template.num_files = 1
self._path_template.suffix = "raw"
self._path_template.compression = False
示例2: __init__
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(
self, parent, name, QtImport.Qt.WindowFlags(fl), "Standard"
)
if not name:
self.setObjectName("create_discrete_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
# Graphic elements ----------------------------------------------------
self._acq_widget = AcquisitionWidget(
self,
"acquisition_widget",
layout="vertical",
acq_params=self._acquisition_parameters,
path_template=self._path_template,
)
self._data_path_widget = DataPathWidget(
self,
"create_dc_path_widget",
data_model=self._path_template,
layout="vertical",
)
self._processing_widget = ProcessingWidget(
self, data_model=self._processing_parameters
)
# Layout --------------------------------------------------------------
_main_vlayout = QtImport.QVBoxLayout(self)
_main_vlayout.addWidget(self._acq_widget)
_main_vlayout.addWidget(self._data_path_widget)
_main_vlayout.addWidget(self._processing_widget)
_main_vlayout.addStretch(0)
_main_vlayout.setSpacing(6)
_main_vlayout.setContentsMargins(2, 2, 2, 2)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._acq_widget.acqParametersChangedSignal.connect(self.acq_parameters_changed)
self._data_path_widget.pathTemplateChangedSignal.connect(
self.path_template_changed
)
self._acq_widget.madEnergySelectedSignal.connect(self.mad_energy_selected)
self._processing_widget.enableProcessingSignal.connect(
self._run_processing_toggled
)
# Other ---------------------------------------------------------------
self._processing_widget.processing_widget.run_processing_parallel_cbox.setChecked(
api.beamline_setup._get_run_processing_parallel()
)
示例3: __init__
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(
self, parent, name, QtImport.Qt.WindowFlags(fl), "XRF spectrum"
)
if name is not None:
self.setObjectName(name)
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.count_time = None
self.xrf_spectrum_model = None
self.init_models()
# Graphic elements ----------------------------------------------------
self._data_path_widget = DataPathWidget(
self, data_model=self._path_template, layout="vertical"
)
_parameters_gbox = QtImport.QGroupBox("Parameters", self)
_count_time_label = QtImport.QLabel("Count time (sec.):", _parameters_gbox)
self.count_time_ledit = QtImport.QLineEdit("1", _parameters_gbox)
# self.count_time_ledit.setMaximumWidth(75)
self.adjust_transmission_cbox = QtImport.QCheckBox(
"Adjust transmission", _parameters_gbox
)
self.adjust_transmission_cbox.setChecked(True)
# Layout --------------------------------------------------------------
_parameters_gbox_hlayout = QtImport.QHBoxLayout(_parameters_gbox)
_parameters_gbox_hlayout.addWidget(_count_time_label)
_parameters_gbox_hlayout.addWidget(self.count_time_ledit)
_parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox)
_parameters_gbox_hlayout.addStretch(0)
_parameters_gbox_hlayout.setSpacing(2)
_parameters_gbox_hlayout.setContentsMargins(0, 0, 0, 0)
_main_vlayout = QtImport.QVBoxLayout(self)
_main_vlayout.addWidget(self._data_path_widget)
_main_vlayout.addWidget(_parameters_gbox)
_main_vlayout.setSpacing(6)
_main_vlayout.setContentsMargins(2, 2, 2, 2)
_main_vlayout.addStretch(0)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._data_path_widget.pathTemplateChangedSignal.connect(
self.path_template_changed
)
self.adjust_transmission_cbox.stateChanged.connect(
self.adjust_transmission_state_changed
)
# Other ---------------------------------------------------------------
self._data_path_widget.data_path_layout.compression_cbox.setVisible(False)
示例4: init_models
def init_models(self):
CreateTaskBase.init_models(self)
self._xray_imaging_parameters = queue_model_objects.XrayImagingParameters()
self._acquisition_parameters = api.beamline_setup.get_default_acquisition_parameters(
"default_imaging_values"
)
self._path_template.suffix = "tiff"
示例5: init_models
def init_models(self):
CreateTaskBase.init_models(self)
self.enery_scan = queue_model_objects.EnergyScan()
self._path_template.start_num = 1
self._path_template.num_files = 1
self._path_template.suffix = "raw"
self._path_template.compression = False
示例6: single_item_selection
def single_item_selection(self, tree_item):
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, queue_item.SampleQueueItem):
sample_model = tree_item.get_model()
self._processing_parameters = sample_model.processing_parameters
# self._processing_parameters = copy.deepcopy(self._processing_parameters)
self._processing_widget.update_data_model(self._processing_parameters)
elif isinstance(tree_item, queue_item.BasketQueueItem):
self.setDisabled(False)
elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
data_collection = tree_item.get_model()
if data_collection.is_helical():
self.setDisabled(tree_item.get_model().is_executed())
self._path_template = data_collection.get_path_template()
self._data_path_widget.update_data_model(self._path_template)
self._acquisition_parameters = data_collection.acquisitions[
0
].acquisition_parameters
if len(data_collection.acquisitions) == 2:
start_cpos = data_collection.acquisitions[
0
].acquisition_parameters.centred_position
end_cpos = data_collection.acquisitions[
1
].acquisition_parameters.centred_position
num_images = data_collection.acquisitions[
0
].acquisition_parameters.num_images
self.select_line_with_cpos(start_cpos, end_cpos, num_images)
self._acq_widget.update_data_model(
self._acquisition_parameters, self._path_template
)
# self.get_acquisition_widget().use_osc_start(True)
self._processing_parameters = data_collection.processing_parameters
self._processing_widget.update_data_model(self._processing_parameters)
else:
self.setDisabled(True)
else:
self.setDisabled(True)
if (
isinstance(tree_item, queue_item.SampleQueueItem)
or isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)
or isinstance(tree_item, queue_item.DataCollectionQueueItem)
):
self._processing_widget.update_data_model(self._processing_parameters)
self._acq_widget.update_data_model(
self._acquisition_parameters, self._path_template
)
示例7: init_api
def init_api(self):
"""
In plate mode osciallation is start is in the middle of grid
"""
CreateTaskBase.init_api(self)
self._xray_imaging_parameters_widget.init_api()
api.detector_distance.connect(
"positionChanged",
self._xray_imaging_parameters_widget.set_detector_distance,
)
示例8: init_models
def init_models(self):
CreateTaskBase.init_models(self)
# self._energy_scan_result = queue_model_objects.EnergyScanResult()
self._processing_parameters = queue_model_objects.ProcessingParameters()
has_shutter_less = api.beamline_setup.detector_has_shutterless()
self._acquisition_parameters.shutterless = has_shutter_less
self._acquisition_parameters = api.beamline_setup.get_default_acquisition_parameters(
"default_acquisition_values"
)
示例9: init_models
def init_models(self):
CreateTaskBase.init_models(self)
self._processing_parameters = queue_model_objects.ProcessingParameters()
has_shutter_less = api.beamline_setup.detector_has_shutterless()
self._acquisition_parameters.shutterless = has_shutter_less
self._acquisition_parameters = api.beamline_setup.get_default_acquisition_parameters(
"default_acquisition_values"
)
self._acquisition_parameters.num_triggers = 1
self._acquisition_parameters.num_images_per_trigger = 1
示例10: _init_models
def _init_models(self):
"""
Descript. :
"""
CreateTaskBase.init_models(self)
self._processing_parameters = queue_model_objects.ProcessingParameters()
has_shutter_less = api.beamline_setup.detector_has_shutterless()
self._acquisition_parameters.shutterless = has_shutter_less
self._acquisition_parameters = api.beamline_setup.get_default_acquisition_parameters(
"default_advanced_values"
)
示例11: single_item_selection
def single_item_selection(self, tree_item):
"""
Method called when a queue item in the tree is selected
:param tree_item: queue_item
:return: None
"""
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, queue_item.SampleQueueItem):
sample_model = tree_item.get_model()
# self._processing_parameters = copy.deepcopy(self._processing_parameters)
self._processing_parameters = sample_model.processing_parameters
self._processing_widget.update_data_model(self._processing_parameters)
elif isinstance(tree_item, queue_item.BasketQueueItem):
self.setDisabled(False)
elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
dc_model = tree_item.get_model()
self._acq_widget.use_kappa(False)
if not dc_model.is_helical():
if dc_model.is_executed():
self.setDisabled(True)
else:
self.setDisabled(False)
sample_data_model = self.get_sample_item(tree_item).get_model()
energy_scan_result = sample_data_model.crystals[0].energy_scan_result
self._acq_widget.set_energies(energy_scan_result)
# self._acq_widget.disable_inverse_beam(True)
self._path_template = dc_model.get_path_template()
self._data_path_widget.update_data_model(self._path_template)
self._acquisition_parameters = dc_model.acquisitions[0].acquisition_parameters
self._acq_widget.update_data_model(
self._acquisition_parameters, self._path_template
)
# self.get_acquisition_widget().use_osc_start(True)
if len(dc_model.acquisitions) == 1:
self.select_shape_with_cpos(
self._acquisition_parameters.centred_position
)
self._processing_parameters = dc_model.processing_parameters
self._processing_widget.update_data_model(self._processing_parameters)
else:
self.setDisabled(True)
else:
self.setDisabled(True)
示例12: single_item_selection
def single_item_selection(self, tree_item):
"""
Descript. :
"""
CreateTaskBase.single_item_selection(self, tree_item)
self.dc_selected = False
if isinstance(tree_item, queue_item.SampleQueueItem):
pass
elif isinstance(tree_item, queue_item.BasketQueueItem):
pass
# self.setDisabled(False)
elif isinstance(tree_item, queue_item.DataCollectionQueueItem) or isinstance(
tree_item, queue_item.XrayCenteringQueueItem
):
if isinstance(tree_item, queue_item.XrayCenteringQueueItem):
data_collection = tree_item.get_model().reference_image_collection
else:
data_collection = tree_item.get_model()
if tree_item.get_model().is_executed():
self.setDisabled(True)
else:
self.setDisabled(False)
if data_collection.is_mesh():
# sample_data_model = self.get_sample_item(tree_item).get_model()
# self._acq_widget.disable_inverse_beam(True)
# api.graphics.de_select_all()
api.graphics.select_shape(data_collection.grid)
self._advanced_methods_widget.grid_treewidget.setCurrentItem(
self._grid_map[data_collection.grid]
)
self._path_template = data_collection.get_path_template()
self._data_path_widget.update_data_model(self._path_template)
self._acquisition_parameters = data_collection.acquisitions[
0
].acquisition_parameters
self._acq_widget.update_data_model(
self._acquisition_parameters, self._path_template
)
# self.get_acquisition_widget().use_osc_start(True)
self.dc_selected = True
else:
self.setDisabled(True)
self.grid_treewidget_item_selection_changed()
示例13: __init__
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(
self, parent, name, QtImport.Qt.WindowFlags(fl), "GphlWorkflow"
)
if not name:
self.setObjectName("create_gphl_workflow_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.current_prefix = None
self.init_models()
示例14: single_item_selection
def single_item_selection(self, tree_item):
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, queue_item.SampleQueueItem):
# self._init_models()
if self._char_params.space_group == "":
sample_model = tree_item.get_model()
self._set_space_group(sample_model.processing_parameters.space_group)
# self._acq_widget.update_data_model(self._acquisition_parameters,
# self._path_template)
# self._char_params_mib.set_model(self._char_params)
elif isinstance(tree_item, queue_item.BasketQueueItem):
self.setDisabled(False)
elif isinstance(tree_item, queue_item.CharacterisationQueueItem):
if tree_item.get_model().is_executed():
self.setDisabled(True)
else:
self.setDisabled(False)
self._char = tree_item.get_model()
if self._char.get_path_template():
self._path_template = self._char.get_path_template()
self._data_path_widget.update_data_model(self._path_template)
data_collection = self._char.reference_image_collection
self._char_params = self._char.characterisation_parameters
self._char_params_mib.set_model(self._char_params)
self._acquisition_parameters = data_collection.acquisitions[
0
].acquisition_parameters
self._acq_widget.update_data_model(
self._acquisition_parameters, self._path_template
)
# self.get_acquisition_widget().use_osc_start(True)
if len(data_collection.acquisitions) == 1:
self.select_shape_with_cpos(
self._acquisition_parameters.centred_position
)
self._processing_parameters = data_collection.processing_parameters
else:
self.setDisabled(True)
示例15: approve_creation
def approve_creation(self):
"""
Descript. :
"""
result = CreateTaskBase.approve_creation(self)
selected_grid = self.get_selected_shapes()[0]
if not selected_grid:
msg = "No grid selected. Please select a grid to continue!"
logging.getLogger("GUI").warning(msg)
result = False
# selected_grid = api.graphics.get_auto_grid()
else:
grid_properties = selected_grid.get_properties()
exp_time = float(self._acq_widget.acq_widget_layout.exp_time_ledit.text())
speed = grid_properties["yOffset"] / exp_time
if speed >= 2.25:
logging.getLogger("GUI").error(
"Translation speed %.3f is above the limit 2.25" % speed
)
return False
osc_range_per_frame = float(
self._acq_widget.acq_widget_layout.osc_range_ledit.text()
)
speed = osc_range_per_frame / exp_time
if speed >= 300:
logging.getLogger("GUI").error(
"Rotation speed per frame %.3f is above the limit 300" % speed
)
return False
return result