本文整理汇总了Python中Qt4_data_path_widget.DataPathWidget类的典型用法代码示例。如果您正苦于以下问题:Python DataPathWidget类的具体用法?Python DataPathWidget怎么用?Python DataPathWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataPathWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(self, parent, name, fl, "Helical")
if not name:
self.setObjectName("create_helical_widget")
self.init_models()
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self._lines_map = {}
# Graphic elements ----------------------------------------------------
self._lines_widget = uic.loadUi(
os.path.join(os.path.dirname(__file__), "ui_files/Qt4_helical_line_widget_layout.ui")
)
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 = QtGui.QVBoxLayout(self)
_main_vlayout.addWidget(self._lines_widget)
_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(2)
_main_vlayout.setContentsMargins(0, 0, 0, 0)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._lines_widget.lines_treewidget.itemSelectionChanged.connect(self.lines_treewidget_selection_changed)
self._lines_widget.create_line_button.clicked.connect(self.create_line_button_clicked)
self._lines_widget.remove_line_button.clicked.connect(self.remove_line_button_clicked)
self._data_path_widget.data_path_layout.prefix_ledit.textChanged.connect(self._prefix_ledit_change)
self._data_path_widget.data_path_layout.run_number_ledit.textChanged.connect(self._run_number_ledit_change)
self._data_path_widget.pathTemplateChangedSignal.connect(self.handle_path_conflict)
self._acq_widget.madEnergySelectedSignal.connect(self.mad_energy_selected)
self._acq_widget.acqParametersChangedSignal.connect(self.handle_path_conflict)
self._processing_widget.enableProcessingSignal.connect(self._enable_processing_toggled)
# Other ---------------------------------------------------------------
for col in range(self._lines_widget.lines_treewidget.columnCount()):
self._lines_widget.lines_treewidget.resizeColumnToContents(col)
示例2: __init__
def __init__(self, parent = None,name = None, fl = 0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name, fl, 'Energy scan')
if not name:
self.setObjectName("create_energy_scan_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
# Graphic elements ----------------------------------------------------
self._periodic_table_widget = PeriodicTableWidget(self)
self._data_path_widget = DataPathWidget(self,
data_model = self._path_template, layout = 'vertical')
# Layout --------------------------------------------------------------
self.main_layout = QtGui.QVBoxLayout(self)
self.main_layout.addWidget(self._periodic_table_widget)
self.main_layout.addWidget(self._data_path_widget)
self.main_layout.setContentsMargins(0, 0, 0, 0)
self.main_layout.setSpacing(6)
self.main_layout.addStretch(10)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._periodic_table_widget.elementEdgeSelectedSignal.\
connect(self.acq_parameters_changed)
self._data_path_widget.pathTemplateChangedSignal.\
connect(self.acq_parameters_changed)
示例3: __init__
def __init__(self, parent=None,name=None, fl=0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name, fl, 'Energy scan')
if not name:
self.setObjectName("create_energy_scan_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
# Graphic elements ----------------------------------------------------
self._periodic_table_widget = PeriodicTableWidget(self)
self._data_path_widget = DataPathWidget(self,
data_model = self._path_template, layout = 'vertical')
_parameters_gbox = QGroupBox('Parameters', self)
self._adjust_transmission_cbox = QCheckBox(\
"Adjust transmission", _parameters_gbox)
self._adjust_transmission_cbox.setChecked(False)
self._adjust_transmission_cbox.setEnabled(True)
self._max_transmission_label = QLabel("Maximum transmission:")
self._max_transmission_ledit = QLineEdit("20", _parameters_gbox)
self._max_transmission_ledit.setFixedWidth(80)
self._max_transmission_ledit.setEnabled(False)
# Layout --------------------------------------------------------------
_parameters_gbox_hlayout = QGridLayout(_parameters_gbox)
_parameters_gbox_hlayout.addWidget(self._adjust_transmission_cbox, 0, 0)
_parameters_gbox_hlayout.addWidget(self._max_transmission_label, 1, 0)
_parameters_gbox_hlayout.addWidget(self._max_transmission_ledit, 1, 1)
_parameters_gbox_hlayout.setColumnStretch(2, 1)
_parameters_gbox_hlayout.setSpacing(2)
_main_vlayout = QVBoxLayout(self)
_main_vlayout.addWidget(self._periodic_table_widget)
_main_vlayout.addWidget(self._data_path_widget)
_main_vlayout.addWidget(_parameters_gbox)
_main_vlayout.setContentsMargins(2, 2, 2, 2)
_main_vlayout.setSpacing(6)
_main_vlayout.addStretch(10)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
#self._periodic_table_widget.elementEdgeSelectedSignal.connect(\
# self.acq_parameters_changed)
self._data_path_widget.pathTemplateChangedSignal.connect(\
self.path_template_changed)
self._adjust_transmission_cbox.stateChanged.connect(\
self.adjust_transmission_state_changed)
self._max_transmission_ledit.textEdited.connect(\
self.max_transmission_value_changed)
self._data_path_widget.data_path_layout.compression_cbox.setVisible(False)
示例4: __init__
def __init__(self, parent=None, name=None, fl=0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name,
QtCore.Qt.WindowFlags(fl), "Standart")
if not name:
self.setObjectName("create_discrete_widget")
self.init_models()
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.previous_energy = None
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 = QtGui.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(2)
_main_vlayout.setContentsMargins(0,0,0,0)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._acq_widget.acqParametersChangedSignal.\
connect(self.acq_parameters_changed)
self._data_path_widget.pathTemplateChangedSignal.\
connect(self.acq_parameters_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.hide()
示例5: __init__
def __init__(self, parent = None,name = None, fl = 0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name, fl, 'Energy scan')
if not name:
self.setObjectName("create_energy_scan_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
# Graphic elements ----------------------------------------------------
self._periodic_table_widget = PeriodicTableWidget(self)
self._data_path_gbox = QtGui.QGroupBox('Data location', self)
self._data_path_widget = DataPathWidget(self._data_path_gbox,
data_model = self._path_template,
layout = 'vertical')
# Layout --------------------------------------------------------------
self._data_path_gbox_vlayout = QtGui.QVBoxLayout(self)
self._data_path_gbox_vlayout.addWidget(self._data_path_widget)
self._data_path_gbox_vlayout.setSpacing(0)
self._data_path_gbox_vlayout.setContentsMargins(0, 0, 0, 0)
self._data_path_gbox.setLayout(self._data_path_gbox_vlayout)
self.main_layout = QtGui.QVBoxLayout(self)
self.main_layout.addWidget(self._periodic_table_widget)
self.main_layout.addWidget(self._data_path_gbox)
self.main_layout.addStretch(0)
self.main_layout.setSpacing(0)
self.main_layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.main_layout)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._data_path_widget.data_path_layout.run_number_ledit.textChanged.\
connect(self._run_number_ledit_change)
self.connect(self._data_path_widget,
QtCore.SIGNAL("pathTemplateChanged"),
self.handle_path_conflict)
示例6: __init__
def __init__(self,parent=None, name=None, fl=0):
CreateTaskBase.__init__(self, parent, name,
Qt.WindowFlags(fl), "Still")
if not name:
self.setObjectName("create_still_scan_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
# Graphic elements ----------------------------------------------------
self._acq_widget = AcquisitionStillWidget(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 = 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._processing_widget.enableProcessingSignal.connect(\
self._run_processing_toggled)
示例7: __init__
def __init__(self, parent = None,name = None, fl = 0):
CreateTaskBase.__init__(self, parent, name, fl, 'Helical')
if not name:
self.setObjectName("create_helical_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
self._prev_pos = None
self._current_pos = None
self._list_item_map = {}
self.init_models()
# Graphic elements ----------------------------------------------------
self._lines_gbox = QtGui.QGroupBox('Lines', self)
self._lines_list_widget = QtGui.QListWidget(self._lines_gbox)
self._lines_list_widget.setFixedWidth(300)
self._lines_list_widget.setFixedHeight(100)
self._lines_list_widget.setToolTip(\
"Select the line(s) to perfrom helical scan on")
add_button = QtGui.QPushButton("+", self._lines_gbox)
add_button.setFixedWidth(20)
add_button.setFixedHeight(20)
remove_button = QtGui.QPushButton("-", self._lines_gbox)
remove_button.setFixedWidth(20)
remove_button.setFixedHeight(20)
add_button_tool_tip = "Add a line between two saved positions, " \
"CTRL click to select more than one position"
add_button.setToolTip(add_button_tool_tip)
remove_button_tool_tip = "Remove selected line(s)"
remove_button.setToolTip(remove_button_tool_tip)
self._acq_gbox = QtGui.QGroupBox('Acquisition', self)
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 = QtGui.QGroupBox('Data location', self)
self._data_path_widget = \
DataPathWidget(self._data_path_gbox,
'create_dc_path_widget',
data_model=self._path_template,
layout='vertical')
self._processing_gbox = QtGui.QGroupBox('Processing', self)
self._processing_gbox.setObjectName('processing_gbox')
self._processing_widget = \
ProcessingWidget(self._processing_gbox,
data_model=self._processing_parameters)
# Layout --------------------------------------------------------------
_lines_gbox_gridlayout = QtGui.QGridLayout(self)
_lines_gbox_gridlayout.addWidget(self._lines_list_widget, 0, 0, 2, 1)
_lines_gbox_gridlayout.addWidget(add_button, 0, 1)
_lines_gbox_gridlayout.addWidget(remove_button, 1, 1)
_lines_gbox_gridlayout.setSpacing(2)
_lines_gbox_gridlayout.setColumnStretch(2, 10)
_lines_gbox_gridlayout.setContentsMargins(2, 2, 2, 2)
self._lines_gbox.setLayout(_lines_gbox_gridlayout)
_acq_gbox_layout = QtGui.QVBoxLayout(self)
_acq_gbox_layout.addWidget(self._acq_widget)
_acq_gbox_layout.setSpacing(0)
_acq_gbox_layout.setContentsMargins(0,0,0,0)
self._acq_gbox.setLayout(_acq_gbox_layout)
_data_path_gbox_layout = QtGui.QVBoxLayout(self)
_data_path_gbox_layout.addWidget(self._data_path_widget)
_data_path_gbox_layout.setSpacing(0)
_data_path_gbox_layout.setContentsMargins(0,0,0,0)
self._data_path_gbox.setLayout(_data_path_gbox_layout)
_processing_gbox_layout = QtGui.QVBoxLayout(self)
_processing_gbox_layout.addWidget(self._processing_widget)
_processing_gbox_layout.setSpacing(0)
_processing_gbox_layout.setContentsMargins(0,0,0,0)
self._processing_gbox.setLayout(_processing_gbox_layout)
_main_vlayout = QtGui.QVBoxLayout(self)
_main_vlayout.addWidget(self._lines_gbox)
_main_vlayout.addWidget(self._acq_gbox)
_main_vlayout.addWidget(self._data_path_gbox)
_main_vlayout.addWidget(self._processing_gbox)
_main_vlayout.addStretch(0)
_main_vlayout.setSpacing(2)
_main_vlayout.setContentsMargins(0,0,0,0)
self.setLayout(_main_vlayout)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
add_button.clicked.connect(self.add_clicked)
remove_button.clicked.connect(self.remove_clicked)
#.........这里部分代码省略.........
示例8: CreateEnergyScanWidget
class CreateEnergyScanWidget(CreateTaskBase):
"""
Descript. :
"""
def __init__(self, parent = None,name = None, fl = 0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name, fl, 'Energy scan')
if not name:
self.setObjectName("create_energy_scan_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
# Graphic elements ----------------------------------------------------
self._periodic_table_widget = PeriodicTableWidget(self)
self._data_path_widget = DataPathWidget(self,
data_model = self._path_template, layout = 'vertical')
# Layout --------------------------------------------------------------
self.main_layout = QtGui.QVBoxLayout(self)
self.main_layout.addWidget(self._periodic_table_widget)
self.main_layout.addWidget(self._data_path_widget)
self.main_layout.setContentsMargins(0, 0, 0, 0)
self.main_layout.setSpacing(6)
self.main_layout.addStretch(10)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._periodic_table_widget.elementEdgeSelectedSignal.\
connect(self.acq_parameters_changed)
self._data_path_widget.pathTemplateChangedSignal.\
connect(self.acq_parameters_changed)
def init_models(self):
"""
Descript. :
"""
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'
def set_energy_scan_hwobj(self, energy_scan_hwobj):
"""
Descript. :
"""
self._periodic_table_widget.set_elements(\
energy_scan_hwobj.getElements())
def single_item_selection(self, tree_item):
"""
Descript. :
"""
CreateTaskBase.single_item_selection(self, tree_item)
escan_model = tree_item.get_model()
if isinstance(tree_item, Qt4_queue_item.EnergyScanQueueItem):
if tree_item.get_model().is_executed():
self.setDisabled(True)
else:
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, Qt4_queue_item.SampleQueueItem) or \
isinstance(tree_item, Qt4_queue_item.DataCollectionGroupQueueItem)):
self.setDisabled(True)
def approve_creation(self):
"""
Descript. :
"""
base_result = CreateTaskBase.approve_creation(self)
selected_element, selected_edge = self._periodic_table_widget.get_selected_element_edge()
if not selected_element:
logging.getLogger("GUI").\
info("No element selected, please select an element.")
return base_result and selected_element
# Called by the owning widget (task_toolbox_widget) to create
# a collection. When a data collection group is selected.
def _create_task(self, sample, shape):
"""
Descript. :
"""
data_collections = []
#.........这里部分代码省略.........
示例9: CreateStillScanWidget
class CreateStillScanWidget(CreateTaskBase):
def __init__(self,parent=None, name=None, fl=0):
CreateTaskBase.__init__(self, parent, name,
Qt.WindowFlags(fl), "Still")
if not name:
self.setObjectName("create_still_scan_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
# Graphic elements ----------------------------------------------------
self._acq_widget = AcquisitionStillWidget(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 = 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._processing_widget.enableProcessingSignal.connect(\
self._run_processing_toggled)
# Other ---------------------------------------------------------------
def use_osc_start(self, status):
pass
def update_exp_time_limits(self, status):
pass
def init_models(self):
CreateTaskBase.init_models(self)
self._processing_parameters = queue_model_objects.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("default_acquisition_values")
self._acquisition_parameters.num_triggers = 1
self._acquisition_parameters.num_images_per_trigger = 1
self._processing_widget.processing_widget.run_processing_parallel_cbox.setChecked(\
self._beamline_setup_hwobj._get_run_processing_parallel())
def set_tunable_energy(self, state):
self._acq_widget.set_tunable_energy(state)
def update_processing_parameters(self, crystal):
self._processing_parameters.space_group = crystal.space_group
self._processing_parameters.cell_a = crystal.cell_a
self._processing_parameters.cell_alpha = crystal.cell_alpha
self._processing_parameters.cell_b = crystal.cell_b
self._processing_parameters.cell_beta = crystal.cell_beta
self._processing_parameters.cell_c = crystal.cell_c
self._processing_parameters.cell_gamma = crystal.cell_gamma
self._processing_widget.update_data_model(self._processing_parameters)
def single_item_selection(self, tree_item):
"""
Descript. :
"""
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, Qt4_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, Qt4_queue_item.BasketQueueItem):
self.setDisabled(False)
elif isinstance(tree_item, Qt4_queue_item.DataCollectionQueueItem):
dc = tree_item.get_model()
self._acq_widget.use_kappa(False)
if not dc.is_helical():
if dc.is_executed():
#.........这里部分代码省略.........
示例10: CreateDiscreteWidget
class CreateDiscreteWidget(CreateTaskBase):
"""
Descript. :
"""
def __init__(self, parent=None, name=None, fl=0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name,
QtCore.Qt.WindowFlags(fl), "Standart")
if not name:
self.setObjectName("create_discrete_widget")
self.init_models()
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.previous_energy = None
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 = QtGui.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(2)
_main_vlayout.setContentsMargins(0,0,0,0)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._acq_widget.acqParametersChangedSignal.\
connect(self.acq_parameters_changed)
self._data_path_widget.pathTemplateChangedSignal.\
connect(self.acq_parameters_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.hide()
def init_models(self):
"""
Descript. :
"""
CreateTaskBase.init_models(self)
self._energy_scan_result = queue_model_objects.EnergyScanResult()
self._processing_parameters = queue_model_objects.ProcessingParameters()
def set_tunable_energy(self, state):
"""
Descript. :
"""
self._acq_widget.set_tunable_energy(state)
def update_processing_parameters(self, crystal):
"""
Descript. :
"""
self._processing_parameters.space_group = crystal.space_group
self._processing_parameters.cell_a = crystal.cell_a
self._processing_parameters.cell_alpha = crystal.cell_alpha
self._processing_parameters.cell_b = crystal.cell_b
self._processing_parameters.cell_beta = crystal.cell_beta
self._processing_parameters.cell_c = crystal.cell_c
self._processing_parameters.cell_gamma = crystal.cell_gamma
self._processing_widget.update_data_model(self._processing_parameters)
def single_item_selection(self, tree_item):
"""
Descript. :
"""
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, Qt4_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, Qt4_queue_item.BasketQueueItem):
self.setDisabled(False)
elif isinstance(tree_item, Qt4_queue_item.DataCollectionQueueItem):
dc = tree_item.get_model()
#.........这里部分代码省略.........
示例11: __init__
def __init__(self, parent = None,name = None, fl = 0):
CreateTaskBase.__init__(self, parent, name, fl, 'Helical')
if not name:
self.setObjectName("create_helical_widget")
self.init_models()
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self._lines_map = {}
# Graphic elements ----------------------------------------------------
self._lines_widget = loadUi(os.path.join(\
os.path.dirname(__file__), "ui_files/Qt4_helical_line_widget_layout.ui"))
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 = QVBoxLayout(self)
_main_vlayout.addWidget(self._lines_widget)
_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._lines_widget.lines_treewidget.itemSelectionChanged.connect(\
self.lines_treewidget_selection_changed)
self._lines_widget.create_line_button.clicked.connect(\
self.create_line_button_clicked)
self._lines_widget.create_auto_line_button.clicked.connect(\
self.create_auto_line_button_clicked)
self._lines_widget.remove_line_button.clicked.connect(\
self.remove_line_button_clicked)
self._lines_widget.overlay_cbox.stateChanged.connect(\
self.overlay_toggled)
self._lines_widget.overlay_slider.valueChanged.connect(\
self.overlay_alpha_changed)
self._lines_widget.swap_points_button.clicked.connect(\
self.swap_points_clicked)
self._acq_widget.acqParametersChangedSignal.\
connect(self.acq_parameters_changed)
self._acq_widget.madEnergySelectedSignal.connect(\
self.mad_energy_selected)
self._data_path_widget.pathTemplateChangedSignal.\
connect(self.path_template_changed)
self._processing_widget.enableProcessingSignal.connect(\
self._run_processing_toggled)
# Other ---------------------------------------------------------------
for col in range(self._lines_widget.lines_treewidget.columnCount()):
self._lines_widget.lines_treewidget.resizeColumnToContents(col)
#self._processing_widget.processing_widget.\
# run_processing_parallel_cbox.setChecked(False)
self.enable_widgets(False)
示例12: CreateDiscreteWidget
class CreateDiscreteWidget(CreateTaskBase):
"""
Descript. :
"""
def __init__(self, parent=None, name=None, fl=0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name,
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 = 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 ---------------------------------------------------------------
def init_models(self):
"""
Descript. :
"""
CreateTaskBase.init_models(self)
#self._energy_scan_result = queue_model_objects.EnergyScanResult()
self._processing_parameters = queue_model_objects.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("default_acquisition_values")
self._processing_widget.processing_widget.run_processing_parallel_cbox.setChecked(\
self._beamline_setup_hwobj._get_run_processing_parallel())
def set_tunable_energy(self, state):
"""
Descript. :
"""
self._acq_widget.set_tunable_energy(state)
def update_processing_parameters(self, crystal):
"""
Descript. :
"""
self._processing_parameters.space_group = crystal.space_group
self._processing_parameters.cell_a = crystal.cell_a
self._processing_parameters.cell_alpha = crystal.cell_alpha
self._processing_parameters.cell_b = crystal.cell_b
self._processing_parameters.cell_beta = crystal.cell_beta
self._processing_parameters.cell_c = crystal.cell_c
self._processing_parameters.cell_gamma = crystal.cell_gamma
self._processing_widget.update_data_model(self._processing_parameters)
def single_item_selection(self, tree_item):
"""
Descript. :
"""
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, Qt4_queue_item.SampleQueueItem):
sample_model = tree_item.get_model()
#.........这里部分代码省略.........
示例13: CreateCharWidget
class CreateCharWidget(CreateTaskBase):
"""
Descript. :
"""
def __init__(self,parent = None,name = None, fl = 0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name, fl, 'Characterisation')
self.setObjectName("create_char_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self._vertical_dimension_widget = None
self._current_selected_item = None
self.init_models()
self._char_params_mib = DataModelInputBinder(self._char_params)
# Graphic elements ----------------------------------------------------
self._acq_widget = \
AcquisitionWidgetSimple(self, acq_params = self._acquisition_parameters,
path_template = self._path_template)
self._data_path_widget = DataPathWidget(self,
data_model = self._path_template, layout = 'vertical')
self._vertical_dimension_widget = loadUi(os.path.join(os.path.dirname(__file__),
'ui_files/Qt4_vertical_crystal_dimension_widget_layout.ui'))
self._char_widget = loadUi(os.path.join(os.path.dirname(__file__),
'ui_files/Qt4_characterise_simple_widget_vertical_layout.ui'))
# Layout --------------------------------------------------------------
_main_vlayout = QVBoxLayout(self)
_main_vlayout.addWidget(self._acq_widget)
_main_vlayout.addWidget(self._data_path_widget)
_main_vlayout.addWidget(self._char_widget)
_main_vlayout.addWidget(self._vertical_dimension_widget)
_main_vlayout.setContentsMargins(2, 2, 2, 2)
_main_vlayout.setSpacing(6)
_main_vlayout.addStretch(0)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
self._data_path_widget.pathTemplateChangedSignal.\
connect(self.path_template_changed)
self._acq_widget.acqParametersChangedSignal.\
connect(self.acq_parameters_changed)
self._vertical_dimension_widget.space_group_ledit.activated.\
connect(self._space_group_change)
#self.connect(induced_burn_cbx, QtCore.SIGNAL("toggled(bool)"),
# self.use_induced_burn)
self._char_widget.characterisation_gbox.toggled.connect(\
self.characterisation_gbox_toggled)
self._char_widget.wait_result_cbx.toggled.connect(\
self.wait_results_cbx_toggled)
self._char_widget.execute_plan_cbx.toggled.connect(\
self.run_diffraction_plan_cbx_toggled)
# Other ---------------------------------------------------------------
self._char_params_mib.bind_value_update(
'opt_sad', self._char_widget.optimised_sad_cbx,
bool, None)
self._char_params_mib.bind_value_update(
'account_rad_damage', self._char_widget.account_rad_dmg_cbx,
bool, None)
#self._char_params_mib.bind_value_update('determine_rad_params',
# induced_burn_cbx,
# bool, None)
self._char_params_mib.bind_value_update(
'strategy_complexity', self._char_widget.start_comp_cbox,
int, None)
self._char_params_mib.\
bind_value_update('max_crystal_vdim',
self._vertical_dimension_widget.max_vdim_ledit, float,
QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.\
bind_value_update('min_crystal_vdim',
self._vertical_dimension_widget.min_vdim_ledit, float,
QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.\
bind_value_update('min_crystal_vphi',
self._vertical_dimension_widget.min_vphi_ledit, float,
QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.\
bind_value_update('max_crystal_vphi',
self._vertical_dimension_widget.max_vphi_ledit, float,
#.........这里部分代码省略.........
示例14: __init__
def __init__(self,parent = None,name = None, fl = 0):
"""
Descript. :
"""
CreateTaskBase.__init__(self, parent, name, fl, 'Characterisation')
if not name:
self.setName("create_char_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self._current_selected_item = None
self.init_models()
self._char_params_mib = DataModelInputBinder(self._char_params)
# Graphic elements ----------------------------------------------------
self._acq_widget = \
AcquisitionWidgetSimple(self, acq_params = self._acquisition_parameters,
path_template = self._path_template)
self._data_path_gbox = QtGui.QGroupBox('Data location', self)
self._data_path_widget = DataPathWidget(
self._data_path_gbox,
data_model = self._path_template,
layout = 'vertical')
self._vertical_dimension_widget = uic.loadUi(os.path.join(os.path.dirname(__file__),
'ui_files/Qt4_vertical_crystal_dimension_widget_layout.ui'))
self._char_widget = uic.loadUi(os.path.join(os.path.dirname(__file__),
'ui_files/Qt4_characterise_simple_widget_vertical_layout.ui'))
gbox = self._char_widget.findChild(QtGui.QGroupBox, "characterisation_gbox")
p = gbox.palette();
p.setColor(QtGui.QPalette.Window, QtCore.Qt.red);
p.setColor(QtGui.QPalette.Highlight, QtCore.Qt.red);
gbox.setPalette(p);
# Layout --------------------------------------------------------------
_data_path_gbox_layout = QtGui.QVBoxLayout(self)
_data_path_gbox_layout.addWidget(self._data_path_widget)
_data_path_gbox_layout.setSpacing(0)
_data_path_gbox_layout.setContentsMargins(0,0,0,0)
self._data_path_gbox.setLayout(_data_path_gbox_layout)
_main_vlayout = QtGui.QVBoxLayout(self)
_main_vlayout.addWidget(self._acq_widget)
_main_vlayout.addWidget(self._data_path_gbox)
_main_vlayout.addWidget(self._char_widget)
_main_vlayout.addWidget(self._vertical_dimension_widget)
_main_vlayout.setSpacing(0)
_main_vlayout.setContentsMargins(0,0,0,0)
self.setLayout(_main_vlayout)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
# Other ---------------------------------------------------------------
self._char_params_mib.bind_value_update(
'opt_sad', self._char_widget.optimised_sad_cbx,
bool, None)
self._char_params_mib.bind_value_update(
'account_rad_damage', self._char_widget.account_rad_dmg_cbx,
bool, None)
#self._char_params_mib.bind_value_update('determine_rad_params',
# induced_burn_cbx,
# bool, None)
self._char_params_mib.bind_value_update(
'strategy_complexity', self._char_widget.start_comp_cbox,
int, None)
self._char_params_mib.\
bind_value_update('max_crystal_vdim',
self._vertical_dimension_widget.max_vdim_ledit, float,
QtGui.QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.\
bind_value_update('min_crystal_vdim',
self._vertical_dimension_widget.min_vdim_ledit, float,
QtGui.QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.\
bind_value_update('min_crystal_vphi',
self._vertical_dimension_widget.min_vphi_ledit, float,
QtGui.QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.\
bind_value_update('max_crystal_vphi',
self._vertical_dimension_widget.max_vphi_ledit, float,
QtGui.QDoubleValidator(0.0, 1000, 2, self))
self._vertical_dimension_widget.space_group_ledit.addItems(XTAL_SPACEGROUPS)
self._data_path_widget.data_path_layout.prefix_ledit.textChanged.\
#.........这里部分代码省略.........
示例15: CreateHelicalWidget
class CreateHelicalWidget(CreateTaskBase):
def __init__(self, parent = None,name = None, fl = 0):
CreateTaskBase.__init__(self, parent, name, fl, 'Helical')
if not name:
self.setObjectName("create_helical_widget")
# Hardware objects ----------------------------------------------------
# Internal variables --------------------------------------------------
self.init_models()
self._prev_pos = None
self._current_pos = None
self._list_item_map = {}
self.init_models()
# Graphic elements ----------------------------------------------------
self._lines_gbox = QtGui.QGroupBox('Lines', self)
self._lines_list_widget = QtGui.QListWidget(self._lines_gbox)
self._lines_list_widget.setFixedWidth(300)
self._lines_list_widget.setFixedHeight(100)
self._lines_list_widget.setToolTip(\
"Select the line(s) to perfrom helical scan on")
add_button = QtGui.QPushButton("+", self._lines_gbox)
add_button.setFixedWidth(20)
add_button.setFixedHeight(20)
remove_button = QtGui.QPushButton("-", self._lines_gbox)
remove_button.setFixedWidth(20)
remove_button.setFixedHeight(20)
add_button_tool_tip = "Add a line between two saved positions, " \
"CTRL click to select more than one position"
add_button.setToolTip(add_button_tool_tip)
remove_button_tool_tip = "Remove selected line(s)"
remove_button.setToolTip(remove_button_tool_tip)
self._acq_gbox = QtGui.QGroupBox('Acquisition', self)
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 = QtGui.QGroupBox('Data location', self)
self._data_path_widget = \
DataPathWidget(self._data_path_gbox,
'create_dc_path_widget',
data_model=self._path_template,
layout='vertical')
self._processing_gbox = QtGui.QGroupBox('Processing', self)
self._processing_gbox.setObjectName('processing_gbox')
self._processing_widget = \
ProcessingWidget(self._processing_gbox,
data_model=self._processing_parameters)
# Layout --------------------------------------------------------------
_lines_gbox_gridlayout = QtGui.QGridLayout(self)
_lines_gbox_gridlayout.addWidget(self._lines_list_widget, 0, 0, 2, 1)
_lines_gbox_gridlayout.addWidget(add_button, 0, 1)
_lines_gbox_gridlayout.addWidget(remove_button, 1, 1)
_lines_gbox_gridlayout.setSpacing(2)
_lines_gbox_gridlayout.setColumnStretch(2, 10)
_lines_gbox_gridlayout.setContentsMargins(2, 2, 2, 2)
self._lines_gbox.setLayout(_lines_gbox_gridlayout)
_acq_gbox_layout = QtGui.QVBoxLayout(self)
_acq_gbox_layout.addWidget(self._acq_widget)
_acq_gbox_layout.setSpacing(0)
_acq_gbox_layout.setContentsMargins(0,0,0,0)
self._acq_gbox.setLayout(_acq_gbox_layout)
_data_path_gbox_layout = QtGui.QVBoxLayout(self)
_data_path_gbox_layout.addWidget(self._data_path_widget)
_data_path_gbox_layout.setSpacing(0)
_data_path_gbox_layout.setContentsMargins(0,0,0,0)
self._data_path_gbox.setLayout(_data_path_gbox_layout)
_processing_gbox_layout = QtGui.QVBoxLayout(self)
_processing_gbox_layout.addWidget(self._processing_widget)
_processing_gbox_layout.setSpacing(0)
_processing_gbox_layout.setContentsMargins(0,0,0,0)
self._processing_gbox.setLayout(_processing_gbox_layout)
_main_vlayout = QtGui.QVBoxLayout(self)
_main_vlayout.addWidget(self._lines_gbox)
_main_vlayout.addWidget(self._acq_gbox)
_main_vlayout.addWidget(self._data_path_gbox)
_main_vlayout.addWidget(self._processing_gbox)
_main_vlayout.addStretch(0)
_main_vlayout.setSpacing(2)
_main_vlayout.setContentsMargins(0,0,0,0)
self.setLayout(_main_vlayout)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
add_button.clicked.connect(self.add_clicked)
#.........这里部分代码省略.........