本文整理汇总了Python中create_task_base.CreateTaskBase类的典型用法代码示例。如果您正苦于以下问题:Python CreateTaskBase类的具体用法?Python CreateTaskBase怎么用?Python CreateTaskBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CreateTaskBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(self, parent, name, fl, 'Discrete')
if not name:
self.setName("create_discrete_widget")
self.previous_energy = None
self.init_models()
#
# Layout
#
v_layout = qt.QVBoxLayout(self, 2, 5, "v_layout")
self._acq_gbox = qt.QVGroupBox('Acquisition', self, 'acq_gbox')
self._acq_widget = \
AcquisitionWidget(self._acq_gbox,
"acquisition_widget",
layout='vertical',
acq_params=self._acquisition_parameters,
path_template=self._path_template)
self._data_path_gbox = qt.QVGroupBox('Data location',
self, 'data_path_gbox')
self._data_path_widget = \
DataPathWidget(self._data_path_gbox,
'create_dc_path_widget',
data_model=self._path_template,
layout=DataPathWidgetVerticalLayout)
self._processing_gbox = qt.QVGroupBox('Processing', self,
'processing_gbox')
self._processing_widget = \
ProcessingWidget(self._processing_gbox,
data_model=self._processing_parameters)
v_layout.addWidget(self._acq_gbox)
v_layout.addWidget(self._data_path_gbox)
v_layout.addWidget(self._processing_gbox)
v_layout.addStretch()
dp_layout = self._data_path_widget.data_path_widget_layout
self.connect(self._acq_widget, qt.PYSIGNAL('mad_energy_selected'),
self.mad_energy_selected)
self.connect(dp_layout.prefix_ledit,
qt.SIGNAL("textChanged(const QString &)"),
self._prefix_ledit_change)
self.connect(dp_layout.run_number_ledit,
qt.SIGNAL("textChanged(const QString &)"),
self._run_number_ledit_change)
self.connect(self._acq_widget,
qt.PYSIGNAL("path_template_changed"),
self.handle_path_conflict)
self.connect(self._data_path_widget,
qt.PYSIGNAL("path_template_changed"),
self.handle_path_conflict)
示例2: single_item_selection
def single_item_selection(self, tree_item):
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, queue_item.SampleQueueItem) or \
isinstance(tree_item, queue_item.DataCollectionGroupQueueItem):
self._processing_parameters = copy.deepcopy(self._processing_parameters)
self._processing_widget.update_data_model(self._processing_parameters)
self._acq_widget.disable_inverse_beam(False)
elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
dc = tree_item.get_model()
if dc.experiment_type != queue_model_enumerables.EXPERIMENT_TYPE.HELICAL:
self.setDisabled(False)
self._acq_widget.disable_inverse_beam(True)
self._path_template = dc.get_path_template()
self._data_path_widget.update_data_model(self._path_template)
self._acquisition_parameters = dc.acquisitions[0].acquisition_parameters
self._acq_widget.update_data_model(self._acquisition_parameters,
self._path_template)
if len(dc.acquisitions) == 1:
self.select_shape_with_cpos(self._acquisition_parameters.\
centred_position)
self._processing_parameters = dc.processing_parameters
self._processing_widget.update_data_model(self._processing_parameters)
else:
self.setDisabled(True)
else:
self.setDisabled(True)
示例3: 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.experiment_type == EXPERIMENT_TYPE.HELICAL:
if tree_item.get_model().is_executed():
self.setDisabled(True)
else:
self.setDisabled(False)
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
self.select_shape_with_cpos(start_cpos, end_cpos)
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
)
示例4: __init__
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(self, parent, name, fl, "XRF-spectrum")
self.count_time = None
# Data attributes
self.init_models()
xrfspectrum_model = queue_model_objects.XRFSpectrum()
self.xrfspectrum_mib = DataModelInputBinder(xrfspectrum_model)
# Layout
v_layout = qt.QVBoxLayout(self, 2, 6, "main_v_layout")
self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
self._data_path_widget = DataPathWidget(
self._data_path_gbox, data_model=self._path_template, layout="vertical"
)
parameters_hor_gbox = qt.QHGroupBox("Parameters", self)
self.count_time_label = qt.QLabel("Count time", parameters_hor_gbox)
self.count_time_label.setFixedWidth(83)
self.count_time_ledit = qt.QLineEdit(
"1.0", parameters_hor_gbox, "count_time_ledit"
)
self.count_time_ledit.setFixedWidth(50)
self.xrfspectrum_mib.bind_value_update(
"count_time", self.count_time_ledit, float
) # ,
spacer = qt.QWidget(parameters_hor_gbox)
spacer.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
v_layout.addWidget(self._data_path_gbox)
v_layout.addWidget(parameters_hor_gbox)
v_layout.addStretch()
self.connect(
self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._run_number_ledit_change,
)
self.connect(
self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._prefix_ledit_change,
)
self.connect(
self._data_path_widget,
qt.PYSIGNAL("path_template_changed"),
self.handle_path_conflict,
)
示例5: __init__
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(self, parent, name, fl, "Workflow")
# Data attributes
self.workflow_hwobj = None
self.workflows = {}
self.init_models()
# Layout
v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
self._workflow_type_gbox = qt.QVGroupBox(
"Workflow type", self, "workflow_rtype"
)
self._workflow_cbox = qt.QComboBox(self._workflow_type_gbox)
self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
self._data_path_widget = DataPathWidget(
self._data_path_gbox, data_model=self._path_template, layout="vertical"
)
self._data_path_widget.data_path_widget_layout.child("file_name_label").setText(
""
)
self._data_path_widget.data_path_widget_layout.child(
"file_name_value_label"
).hide()
# self._grid_widget = MxLookupScanBrick.MxLookupScanBrick(self, 'grid_widget')
v_layout.addWidget(self._workflow_type_gbox)
v_layout.addWidget(self._data_path_gbox)
# v_layout.addWidget(self._grid_widget)
v_layout.addStretch()
self.connect(
self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._prefix_ledit_change,
)
self.connect(
self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._run_number_ledit_change,
)
self.connect(
self._data_path_widget,
qt.PYSIGNAL("path_template_changed"),
self.handle_path_conflict,
)
示例6: init_models
def init_models(self):
CreateTaskBase.init_models(self)
self._energy_scan_result = qmo.EnergyScanResult()
self._processing_parameters = qmo.ProcessingParameters()
if self._beamline_setup_hwobj is not None:
has_shutter_less = self._beamline_setup_hwobj.detector_has_shutterless()
self._acquisition_parameters.shutterless = has_shutter_less
self._acquisition_parameters = self._beamline_setup_hwobj.get_default_acquisition_parameters()
else:
self._acquisition_parameters = qmo.AcquisitionParameters()
self._path_template = qmo.PathTemplate()
示例7: single_item_selection
def single_item_selection(self, tree_item):
CreateTaskBase.single_item_selection(self, tree_item)
escan_model = tree_item.get_model()
if isinstance(tree_item, queue_item.EnergyScanQueueItem):
self.setDisabled(False)
if escan_model.get_path_template():
self._path_template = escan_model.get_path_template()
self._data_path_widget.update_data_model(self._path_template)
elif not(isinstance(tree_item, queue_item.SampleQueueItem) or \
isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
self.setDisabled(True)
示例8: single_item_selection
def single_item_selection(self, tree_item):
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, queue_item.SampleQueueItem):
logging.info("no update, sample level")
"""JN 20140829, keep the values user set up
self._init_models()
self._set_space_group(self._char_params.space_group)
self._acq_widget.update_data_model(self._acquisition_parameters,
self._path_template)
self._char_params_mib.set_model(self._char_params)
"""
#self._char_params = copy.deepcopy(self._char_params)
#self._acquisition_parameters = copy.deepcopy(self._acquisition_parameters)
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
logging.info("resolution is set to %s", str(self._acquisition_parameters.resolution))
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)
示例9: 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()
self._set_space_group(self._char_params.space_group)
self._acq_widget.update_data_model(
self._acquisition_parameters, self._path_template
)
self._char_params_mib.set_model(self._char_params)
# self._char_params = copy.deepcopy(self._char_params)
# self._acquisition_parameters = copy.deepcopy(self._acquisition_parameters)
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)
示例10: __init__
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(self, parent, name, fl, "Energy-scan")
# Data attributes
self.init_models()
# Layout
v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
h_box = qt.QHGroupBox("Available elements", self)
self.periodic_table = PeriodicTableBrick(h_box)
font = self.periodic_table.font()
font.setPointSize(8)
self.periodic_table.setFont(font)
h_box.setMaximumWidth(470)
h_box.setMaximumHeight(310)
self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
self._data_path_widget = DataPathWidget(
self._data_path_gbox, data_model=self._path_template, layout="vertical"
)
v_layout.addWidget(h_box)
v_layout.addWidget(self._data_path_gbox)
v_layout.addStretch()
self.connect(
self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._prefix_ledit_change,
)
self.connect(
self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._run_number_ledit_change,
)
self.connect(
self._data_path_widget,
qt.PYSIGNAL("path_template_changed"),
self.handle_path_conflict,
)
qt.QObject.connect(
self.periodic_table, qt.PYSIGNAL("edgeSelected"), self.element_clicked
)
示例11: __init__
def __init__(self, parent = None, name = None, fl = 0):
CreateTaskBase.__init__(self, parent, name, fl, 'Workflow')
# Data attributes
self.workflow_hwobj = None
self.workflows = {}
self.init_models()
#Layout
v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
self._workflow_type_gbox = qt.QVGroupBox('Workflow type', self,
'workflow_rtype')
self._workflow_cbox = qt.QComboBox(self._workflow_type_gbox)
self._data_path_gbox = qt.QVGroupBox('Data location', self,
'data_path_gbox')
self._data_path_widget = DataPathWidget(self._data_path_gbox,
data_model = self._path_template,
layout = DataPathWidgetVerticalLayout)
self._data_path_widget.data_path_widget_layout.file_name_label.setText('')
self._data_path_widget.data_path_widget_layout.file_name_value_label.hide()
self._grid_widget = MxLookupScanBrick.\
MxLookupScanBrick(self, 'grid_widget')
v_layout.addWidget(self._workflow_type_gbox)
v_layout.addWidget(self._data_path_gbox)
v_layout.addWidget(self._grid_widget)
v_layout.addStretch()
self.connect(self._data_path_widget.data_path_widget_layout.prefix_ledit,
qt.SIGNAL("textChanged(const QString &)"),
self._prefix_ledit_change)
self.connect(self._data_path_widget.data_path_widget_layout.run_number_ledit,
qt.SIGNAL("textChanged(const QString &)"),
self._run_number_ledit_change)
self.connect(self._data_path_widget,
qt.PYSIGNAL("path_template_changed"),
self.handle_path_conflict)
示例12: single_item_selection
def single_item_selection(self, tree_item):
CreateTaskBase.single_item_selection(self, tree_item)
wf_model = tree_item.get_model()
if isinstance(tree_item, queue_item.GenericWorkflowQueueItem):
if tree_item.get_model().is_executed():
self.setDisabled(True)
else:
self.setDisabled(False)
if wf_model.get_path_template():
self._path_template = wf_model.get_path_template()
self._data_path_widget.update_data_model(self._path_template)
elif not(isinstance(tree_item, queue_item.SampleQueueItem) or \
isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
self.setDisabled(True)
示例13: approve_creation
def approve_creation(self):
return CreateTaskBase.approve_creation(self)
selected_shapes = self._shape_history.selected_shapes
for shape in selected_shapes:
if isinstance(shape, shape_history.Line):
result = False
return result
示例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) or \
isinstance(tree_item, queue_item.DataCollectionGroupQueueItem):
self._acquisition_parameters = copy.deepcopy(self._acquisition_parameters)
self._processing_parameters = copy.deepcopy(self._processing_parameters)
elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
data_collection = tree_item.get_model()
if data_collection.experiment_type == EXPERIMENT_TYPE.HELICAL:
self.setDisabled(False)
self._path_template = data_collection.acquisitions[0].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
self.select_shape_with_cpos(start_cpos, end_cpos)
self._energy_scan_result = qmo.EnergyScanResult()
self._processing_parameters = data_collection.processing_parameters
self._energy_scan_result = data_collection.crystal.energy_scan_result
self._acq_widget.set_energies(self._energy_scan_result)
self._processing_widget.update_data_model(self._processing_parameters)
self._acq_widget.update_data_model(self._acquisition_parameters,
self._path_template)
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)
示例15: init_models
def init_models(self):
CreateTaskBase.init_models(self)
self._char = queue_model_objects.Characterisation()
self._char_params = self._char.characterisation_parameters
self._char_params.experiment_type = queue_model_enumerables.EXPERIMENT_TYPE.OSC
self._processing_parameters = queue_model_objects.ProcessingParameters()
if self._beamline_setup_hwobj is not None:
self._acquisition_parameters = self._beamline_setup_hwobj.\
get_default_characterisation_parameters()
try:
transmission = self._beamline_setup_hwobj.transmission_hwobj.getAttFactor()
transmission = round(float(transmission), 1)
except AttributeError:
transmission = 0
try:
resolution = self._beamline_setup_hwobj.resolution_hwobj.getPosition()
resolution = round(float(resolution), 4)
except AttributeError:
resolution = 0
try:
energy = self._beamline_setup_hwobj.energy_hwobj.getCurrentEnergy()
energy = round(float(energy), 2)
except AttributeError:
energy = 0
self._acquisition_parameters.resolution = resolution
self._acquisition_parameters.energy = energy
self._acquisition_parameters.transmission = transmission
else:
self._acquisition_parameters = queue_model_objects.AcquisitionParameters()
self._path_template.reference_image_prefix = 'ref'
# The num images drop down default value is 1
# we would like it to be 2
self._acquisition_parameters.num_images = 2
self._char.characterisation_software =\
queue_model_enumerables.COLLECTION_ORIGIN.EDNA
self._path_template.num_files = 2
self._acquisition_parameters.shutterless = False