本文整理匯總了Python中widgets.widget_utils.DataModelInputBinder類的典型用法代碼示例。如果您正苦於以下問題:Python DataModelInputBinder類的具體用法?Python DataModelInputBinder怎麽用?Python DataModelInputBinder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DataModelInputBinder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
def __init__(self, parent = None, name = '', fl = 0, data_model = None,
layout = None):
qt.QWidget.__init__(self, parent, name, fl)
#
# Attributes
#
self._base_image_dir = None
self._base_process_dir = None
if data_model is None:
self._data_model = queue_model_objects.PathTemplate()
else:
self._data_model = data_model
self._data_model_pm = DataModelInputBinder(self._data_model)
#
# Layout
#
h_layout = qt.QHBoxLayout(self)
if layout is DataPathWidgetHorizontalLayout:
self.data_path_widget_layout = layout(self, name)
elif layout is DataPathWidgetVerticalLayout:
self.data_path_widget_layout = layout(self, name)
else:
self.data_path_widget_layout = DataPathWidgetHorizontalLayout(self)
h_layout.addWidget(self.data_path_widget_layout)
#
# Logic
#
self._data_model_pm.bind_value_update('base_prefix',
self.data_path_widget_layout.prefix_ledit,
str,
None)
self._data_model_pm.bind_value_update('run_number',
self.data_path_widget_layout.run_number_ledit,
int,
qt.QIntValidator(0, 1000, self))
qt.QObject.connect(self.data_path_widget_layout.prefix_ledit,
qt.SIGNAL("textChanged(const QString &)"),
self._prefix_ledit_change)
qt.QObject.connect(self.data_path_widget_layout.run_number_ledit,
qt.SIGNAL("textChanged(const QString &)"),
self._run_number_ledit_change)
qt.QObject.connect(self.data_path_widget_layout.browse_button,
qt.SIGNAL("clicked()"),
self._browse_clicked)
qt.QObject.connect(self.data_path_widget_layout.folder_ledit,
qt.SIGNAL("textChanged(const QString &)"),
self._folder_ledit_change)
示例2: __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,
)
示例3: __init__
def __init__(
self,
parent=None,
name=None,
fl=0,
acq_params=None,
path_template=None,
layout=None,
):
qt.QWidget.__init__(self, parent, name, fl)
#
# Attributes
#
if acq_params is None:
self._acquisition_parameters = queue_model_objects.AcquisitionParameters()
else:
self._acquisition_parameters = acq_params
if path_template is None:
self._path_template = queue_model_objects.PathTemplate()
else:
self._path_template = path_template
self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters)
#
# Layout
#
h_layout = qt.QHBoxLayout(self)
current_dir = os.path.dirname(__file__)
ui_file = "ui_files/acquisition_widget_vertical_simple_layout.ui"
widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
widget.reparent(self, qt.QPoint(0, 0))
h_layout.addWidget(widget)
self.acq_widget_layout = widget
#
# Logic
#
self.acq_widget_layout.child("kappa_ledit").setEnabled(False)
self.acq_widget_layout.child("kappa_phi_ledit").setEnabled(False)
self.acq_widget_layout.child("osc_start_ledit").setEnabled(False)
# Default to 2-images
self.acq_widget_layout.child("num_images_cbox").setCurrentItem(1)
qt.QObject.connect(
self.acq_widget_layout.child("num_images_cbox"),
qt.SIGNAL("activated(int)"),
self.update_num_images,
)
示例4: populate_parameter_widget
def populate_parameter_widget(self, item):
data_collection = item.get_model()
self._tree_view_item = item
self._data_collection = data_collection
self._acquisition_mib = DataModelInputBinder(
self._data_collection.acquisitions[0].acquisition_parameters
)
# The acq_widget sends a signal to the path_widget, and it relies
# on that both models upto date, we need to refactor this part
# so that both models are set before taking ceratin actions.
# This workaround, works for the time beeing.
self.path_widget._data_model = data_collection.acquisitions[0].path_template
self.acq_widget.set_energies(data_collection.crystal.energy_scan_result)
self.acq_widget.update_data_model(
data_collection.acquisitions[0].acquisition_parameters,
data_collection.acquisitions[0].path_template,
)
self.acq_widget.use_osc_start(True)
self.path_widget.update_data_model(
data_collection.acquisitions[0].path_template
)
self.processing_widget.update_data_model(data_collection.processing_parameters)
if data_collection.acquisitions[
0
].acquisition_parameters.centred_position.snapshot_image:
image = data_collection.acquisitions[
0
].acquisition_parameters.centred_position.snapshot_image
image = image.scale(427, 320)
self.position_widget.child("svideo").setPixmap(qt.QPixmap(image))
invalid = self._acquisition_mib.validate_all()
if invalid:
msg = (
"This data collection has one or more incorrect parameters,"
+ " correct the fields marked in red to solve the problem."
)
logging.getLogger("user_level_log").warning(msg)
示例5: AcquisitionWidgetSimple
class AcquisitionWidgetSimple(qt.QWidget):
def __init__(self, parent = None, name = None, fl = 0, acq_params = None,
path_template = None, layout = None):
qt.QWidget.__init__(self, parent, name, fl)
#
# Attributes
#
if acq_params is None:
self._acquisition_parameters = queue_model_objects.AcquisitionParameters()
else:
self._acquisition_parameters = acq_params
if path_template is None:
self._path_template = queue_model_objects.PathTemplate()
else:
self._path_template = path_template
self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters)
#
# Layout
#
h_layout = qt.QHBoxLayout(self)
current_dir = os.path.dirname(__file__)
ui_file = 'ui_files/acquisition_widget_vertical_simple_layout.ui'
widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
widget.reparent(self, qt.QPoint(0,0))
h_layout.addWidget(widget)
self.acq_widget_layout = widget
#
# Logic
#
self._acquisition_mib.\
bind_value_update('exp_time',
self.acq_widget_layout.child('exp_time_ledit'),
float,
qt.QDoubleValidator(0.001, 6000, 3, self))
self._acquisition_mib.\
bind_value_update('osc_range',
self.acq_widget_layout.child('osc_range_ledit'),
float,
qt.QDoubleValidator(0.001, 1000, 2, self))
self._acquisition_mib.\
bind_value_update('osc_start',
self.acq_widget_layout.child('osc_start_ledit'),
float,
qt.QDoubleValidator(-1000, 1000, 2, self))
self._acquisition_mib.\
bind_value_update('energy',
self.acq_widget_layout.child('energy_ledit'),
float,
qt.QDoubleValidator(0, 1000, 4, self))
self._acquisition_mib.\
bind_value_update('transmission',
self.acq_widget_layout.child('transmission_ledit'),
float,
qt.QDoubleValidator(0, 1000, 2, self))
self._acquisition_mib.\
bind_value_update('resolution',
self.acq_widget_layout.child('resolution_ledit'),
float,
qt.QDoubleValidator(0, 1000, 3, self))
qt.QObject.connect(self.acq_widget_layout.child('osc_start_cbox'),
qt.SIGNAL("toggled(bool)"),
self.osc_start_cbox_click)
self.acq_widget_layout.child('osc_start_ledit').setEnabled(False)
# Default to 2-images
self.acq_widget_layout.child('num_images_cbox').setCurrentItem(1)
qt.QObject.connect(self.acq_widget_layout.child('num_images_cbox'),
qt.SIGNAL("activated(int)"),
self.update_num_images)
def osc_start_cbox_click(self, state):
self.update_osc_start(self._beamline_setup._get_omega_axis_position())
self.acq_widget_layout.child('osc_start_ledit').setEnabled(state)
def update_osc_start(self, new_value):
if not self.acq_widget_layout.child('osc_start_cbox').isChecked():
osc_start_ledit = self.acq_widget_layout.child('osc_start_ledit')
osc_start_value = 0
try:
osc_start_value = round(float(new_value),2)
except TypeError:
pass
#.........這裏部分代碼省略.........
示例6: __init__
def __init__(self, *args):
BaseComponents.BlissWidget.__init__(self, *args)
#
# Data attributes
#
self.sample = queue_model_objects.Sample()
self.crystal = self.sample.crystals[0]
self.sample_mib = DataModelInputBinder(self.sample)
self.crystal_mib = DataModelInputBinder(self.crystal)
#
# Qt - Signals/Slots
#
self.defineSlot("populate_sample_details", ({}))
#
# Layout
#
main_layout = qt.QHBoxLayout(self, 11, 15, "main_layout")
self.crystal_widget = CrystalWidgetLayout(self)
self.sample_info_widget = SampleInfoWidgetLayout(self)
main_layout.addWidget(self.sample_info_widget)
main_layout.addWidget(self.crystal_widget)
main_layout.addStretch(10)
self.crystal_mib.bind_value_update(
"space_group", self.crystal_widget.space_group_value_label, str, None
)
self.crystal_mib.bind_value_update(
"protein_acronym",
self.crystal_widget.protein_acronym_value_label,
str,
None,
)
self.crystal_mib.bind_value_update(
"cell_a", self.crystal_widget.a_value_label, str, None
)
self.crystal_mib.bind_value_update(
"cell_alpha", self.crystal_widget.alpha_value_label, str, None
)
self.crystal_mib.bind_value_update(
"cell_b", self.crystal_widget.b_value_label, str, None
)
self.crystal_mib.bind_value_update(
"cell_beta", self.crystal_widget.beta_value_label, str, None
)
self.crystal_mib.bind_value_update(
"cell_c", self.crystal_widget.c_value_label, str, None
)
self.crystal_mib.bind_value_update(
"cell_gamma", self.crystal_widget.gamma_value_label, str, None
)
self.sample_mib.bind_value_update(
"name", self.sample_info_widget.name_value_label, str, None
)
self.sample_mib.bind_value_update(
"code", self.sample_info_widget.data_matrix_value_label, str, None
)
self.sample_mib.bind_value_update(
"holder_length",
self.sample_info_widget.holder_length_value_label,
str,
None,
)
self.sample_mib.bind_value_update(
"lims_sample_location",
self.sample_info_widget.sample_location_value_label,
str,
None,
)
self.sample_mib.bind_value_update(
"lims_container_location",
self.sample_info_widget.basket_location_value_label,
str,
None,
)
示例7: __init__
def __init__(self, parent=None, name="", fl=0, data_model=None, layout=None):
qt.QWidget.__init__(self, parent, name, fl)
#
# Attributes
#
self._base_image_dir = None
self._base_process_dir = None
self.path_conflict_state = False
if data_model is None:
self._data_model = queue_model_objects.PathTemplate()
else:
self._data_model = data_model
self._data_model_pm = DataModelInputBinder(self._data_model)
#
# Layout
#
h_layout = qt.QHBoxLayout(self)
if layout == "vertical":
widget = qtui.QWidgetFactory.create(
os.path.join(
os.path.dirname(__file__),
"ui_files/data_path_widget_vertical_layout.ui",
)
)
elif layout == "horizontal":
widget = qtui.QWidgetFactory.create(
os.path.join(
os.path.dirname(__file__),
"ui_files/data_path_widget_horizontal_layout.ui",
)
)
else:
widget = qtui.QWidgetFactory.create(
os.path.join(
os.path.dirname(__file__),
"ui_files/data_path_widget_horizontal_layout.ui",
)
)
self.data_path_widget_layout = widget
widget.reparent(self, qt.QPoint(0, 0))
h_layout.addWidget(self.data_path_widget_layout)
#
# Logic
#
self._data_model_pm.bind_value_update(
"base_prefix", self.data_path_widget_layout.child("prefix_ledit"), str, None
)
self._data_model_pm.bind_value_update(
"run_number",
self.data_path_widget_layout.child("run_number_ledit"),
int,
qt.QIntValidator(0, 1000, self),
)
qt.QObject.connect(
self.data_path_widget_layout.child("prefix_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._prefix_ledit_change,
)
qt.QObject.connect(
self.data_path_widget_layout.child("run_number_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._run_number_ledit_change,
)
qt.QObject.connect(
self.data_path_widget_layout.child("browse_button"),
qt.SIGNAL("clicked()"),
self._browse_clicked,
)
qt.QObject.connect(
self.data_path_widget_layout.child("folder_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self._folder_ledit_change,
)
示例8: CreateCharWidget
class CreateCharWidget(CreateTaskBase):
def __init__(self, parent=None, name=None, fl=0):
CreateTaskBase.__init__(self, parent, name, fl, "Characterisation")
if not name:
self.setName("create_char_widget")
#
# Data attributes
#
self._current_selected_item = None
self.init_models()
self._char_params_mib = DataModelInputBinder(self._char_params)
#
# Layout
#
v_layout = qt.QVBoxLayout(self, 2, 6, "v_layout")
self._acq_widget = AcquisitionWidgetSimple(
self,
acq_params=self._acquisition_parameters,
path_template=self._path_template,
)
# self._acq_widget.setFixedHeight(170)
current_dir = os.path.dirname(__file__)
ui_file = "ui_files/vertical_crystal_dimension_widget_layout.ui"
widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
widget.reparent(self, qt.QPoint(0, 0))
self._vertical_dimension_widget = widget
ui_file = "ui_files/characterise_simple_widget_vertical_layout.ui"
widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
widget.reparent(self, qt.QPoint(0, 0))
self._char_widget = widget
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(self._acq_widget)
v_layout.addWidget(self._data_path_gbox)
v_layout.addWidget(self._char_widget)
v_layout.addWidget(self._vertical_dimension_widget)
v_layout.addStretch(100)
#
# Logic
#
optimised_sad_cbx = self._char_widget.child("optimised_sad_cbx")
account_rad_dmg_cbx = self._char_widget.child("account_rad_dmg_cbx")
start_comp_cbox = self._char_widget.child("start_comp_cbox")
# induced_burn_cbx = self._char_widget.child('induced_burn_cbx')
max_vdim_ledit = self._vertical_dimension_widget.child("max_vdim_ledit")
min_vdim_ledit = self._vertical_dimension_widget.child("min_vdim_ledit")
min_vphi_ledit = self._vertical_dimension_widget.child("min_vphi_ledit")
max_vphi_ledit = self._vertical_dimension_widget.child("max_vphi_ledit")
space_group_ledit = self._vertical_dimension_widget.child("space_group_ledit")
self._char_params_mib.bind_value_update(
"opt_sad", optimised_sad_cbx, bool, None
)
self._char_params_mib.bind_value_update(
"account_rad_damage", 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", start_comp_cbox, int, None
)
self._char_params_mib.bind_value_update(
"max_crystal_vdim",
max_vdim_ledit,
float,
qt.QDoubleValidator(0.0, 1000, 2, self),
)
self._char_params_mib.bind_value_update(
"min_crystal_vdim",
min_vdim_ledit,
float,
qt.QDoubleValidator(0.0, 1000, 2, self),
)
self._char_params_mib.bind_value_update(
"min_crystal_vphi",
min_vphi_ledit,
#.........這裏部分代碼省略.........
示例9: AcquisitionWidget
class AcquisitionWidget(qt.QWidget):
def __init__(
self,
parent=None,
name=None,
fl=0,
acq_params=None,
path_template=None,
layout="horizontal",
):
qt.QWidget.__init__(self, parent, name, fl)
#
# Attributes
#
self._beamline_setup = None
self.previous_energy = 0
self.layout_type = layout
if acq_params is None:
self._acquisition_parameters = queue_model_objects.AcquisitionParameters()
else:
self._acquisition_parameters = acq_params
if path_template is None:
self._path_template = queue_model_objects.PathTemplate()
else:
self._path_template = path_template
self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters)
# self._path_template_mib = DataModelInputBinder(self._path_template)
#
# Layout
#
h_layout = qt.QHBoxLayout(self)
if layout == "vertical":
widget = qtui.QWidgetFactory.create(
os.path.join(
os.path.dirname(__file__),
"ui_files/acquisition_widget_vertical_layout.ui",
)
)
elif layout == "horizontal":
widget = qtui.QWidgetFactory.create(
os.path.join(
os.path.dirname(__file__),
"ui_files/acquisition_widget_horizontal_layout.ui",
)
)
widget.child("inverse_beam_cbx").hide()
widget.child("subwedge_size_label").hide()
widget.child("subwedge_size_ledit").hide()
else:
widget = qtui.QWidgetFactory.create(
os.path.join(
os.path.dirname(__file__),
"ui_files/acquisition_widget_vertical_layout.ui",
)
)
widget.reparent(self, qt.QPoint(0, 0))
self.acq_widget_layout = widget
h_layout.addWidget(self.acq_widget_layout)
#
# Logic
#
qt.QObject.connect(
self.acq_widget_layout.child("energies_combo"),
qt.SIGNAL("activated(int)"),
self.energy_selected,
)
qt.QObject.connect(
self.acq_widget_layout.child("mad_cbox"),
qt.SIGNAL("toggled(bool)"),
self.use_mad,
)
qt.QObject.connect(
self.acq_widget_layout.child("inverse_beam_cbx"),
qt.SIGNAL("toggled(bool)"),
self.set_use_inverse_beam,
)
qt.QObject.connect(
self.acq_widget_layout.child("first_image_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self.first_image_ledit_change,
)
qt.QObject.connect(
self.acq_widget_layout.child("num_images_ledit"),
qt.SIGNAL("textChanged(const QString &)"),
self.num_images_ledit_change,
)
#.........這裏部分代碼省略.........
示例10: __init__
def __init__(self, parent = None, name = "parameter_widget"):
qt.QWidget.__init__(self, parent, name)
#
# Private members
#
self._char = None
self._char_params = queue_model_objects.CharacterisationParameters()
self._char_params_mib = DataModelInputBinder(self._char_params)
self._tree_view_item = None
self.previous_energy = None
self.add_dc_cb = None
self.char_type_widget = CharTypeWidget(self)
self.routine_dc_widget = self.char_type_widget.routine_dc_page
self.sad_widget = self.char_type_widget.sad_page
self.rad_dmg_char_widget = self.char_type_widget.rad_damage_page
self.reference_img_widget = ReferenceImageWidget(self)
self.acq_widget = self.reference_img_widget.acq_widget
self.path_widget = self.reference_img_widget.path_widget
self.opt_parameters_widget = OptimisationParametersWidgetLayout(self)
self.rad_dmg_widget = RadiationDamageModelWidgetLayout(self)
self.position_widget = SnapshotWidgetLayout(self)
self.vertical_dimension_widget = VerticalCrystalDimensionWidgetLayout(self)
# Fix the widths of the widgets to make the layout look nicer,
# and beacuse the qt layout engine is so tremendosly good.
self.opt_parameters_widget.setFixedWidth(600)
self.reference_img_widget.setFixedWidth(772)
#
# Layout
#
v_layout = qt.QVBoxLayout(self, 11, 15, "main_layout")
rone_hlayout = qt.QHBoxLayout(v_layout, 15, "rone" )
rone_cone_vlayout = qt.QVBoxLayout(rone_hlayout, 15, "rone_cone")
rtwo_hlayout = qt.QHBoxLayout(v_layout, 15, "rtwo")
rthree_hlayout = qt.QHBoxLayout(v_layout, 15, "rtwo")
rone_hlayout.addWidget(self.position_widget)
rone_cone_vlayout.addWidget(self.reference_img_widget)
rone_hlayout.addStretch()
rtwo_hlayout.addWidget(self.char_type_widget)
rtwo_hlayout.addWidget(self.opt_parameters_widget)
rtwo_hlayout.addStretch(10)
v_layout.addStretch(10)
rthree_hlayout.addWidget(self.rad_dmg_widget)
rthree_hlayout.addWidget(self.vertical_dimension_widget)
rthree_hlayout.addStretch(10)
v_layout.addStretch(10)
#
# Widget logic
#
self.toggle_permitted_range(self.\
opt_parameters_widget.permitted_range_cbx.isOn())
qt.QObject.connect(self.opt_parameters_widget.permitted_range_cbx,
qt.SIGNAL("toggled(bool)"),
self.toggle_permitted_range)
self._char_params_mib.bind_value_update('min_dose',
self.routine_dc_widget.dose_ledit,
float,
qt.QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.bind_value_update('min_time',
self.routine_dc_widget.time_ledit,
float,
qt.QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.bind_value_update('use_min_dose',
self.routine_dc_widget.min_dose_radio,
bool,
None)
self._char_params_mib.bind_value_update('use_min_time',
self.routine_dc_widget.min_time_radio,
bool,
None)
self._char_params_mib.bind_value_update('account_rad_damage',
self.routine_dc_widget.radiation_damage_cbx,
bool,
None)
self._char_params_mib.bind_value_update('auto_res',
self.sad_widget.automatic_resolution_radio,
bool,
None)
self._char_params_mib.bind_value_update('opt_sad',
self.sad_widget.optimal_sad_radio,
bool,
None)
#.........這裏部分代碼省略.........
示例11: __init__
def __init__(self, parent=None, name=None, fl=0, acq_params=None,
path_template=None, layout='horizontal'):
qt.QWidget.__init__(self, parent, name, fl)
#
# Attributes
#
self._beamline_setup = None
self.previous_energy = 0
if acq_params is None:
self._acquisition_parameters = queue_model_objects.\
AcquisitionParameters()
else:
self._acquisition_parameters = acq_params
if path_template is None:
self._path_template = queue_model_objects.PathTemplate()
else:
self._path_template = path_template
self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters)
#self._path_template_mib = DataModelInputBinder(self._path_template)
#
# Layout
#
h_layout = qt.QHBoxLayout(self)
if layout == 'vertical':
widget = qtui.QWidgetFactory.\
create(os.path.join(os.path.dirname(__file__),
'ui_files/acquisition_widget_vertical_layout.ui'))
elif layout == 'horizontal':
widget = qtui.QWidgetFactory.\
create(os.path.join(os.path.dirname(__file__),
'ui_files/acquisition_widget_horizontal_layout.ui'))
widget.child('inverse_beam_cbx').hide()
widget.child('subwedge_size_label').hide()
widget.child('subwedge_size_ledit').hide()
else:
widget = qtui.QWidgetFactory.\
create(os.path.join(os.path.dirname(__file__),
'ui_files/acquisition_widget_vertical_layout.ui'))
widget.reparent(self, qt.QPoint(0, 0))
self.acq_widget_layout = widget
h_layout.addWidget(self.acq_widget_layout)
#
# Logic
#
self._acquisition_mib.\
bind_value_update('osc_start',
self.acq_widget_layout.child('osc_start_ledit'),
float,
qt.QDoubleValidator(-10000, 10000, 2, self))
self._acquisition_mib.\
bind_value_update('first_image',
self.acq_widget_layout.child('first_image_ledit'),
int,
qt.QIntValidator(1, 9999, self))
self._acquisition_mib.\
bind_value_update('exp_time',
self.acq_widget_layout.child('exp_time_ledit'),
float,
qt.QDoubleValidator(0.003, 6000, 3, self))
self._acquisition_mib.\
bind_value_update('osc_range',
self.acq_widget_layout.child('osc_range_ledit'),
float,
qt.QDoubleValidator(0.001, 1000, 2, self))
self._acquisition_mib.\
bind_value_update('num_images',
self.acq_widget_layout.child('num_images_ledit'),
int,
qt.QIntValidator(1, 9999, self))
self._acquisition_mib.\
bind_value_update('num_passes',
self.acq_widget_layout.child('num_passes_ledit'),
int,
qt.QIntValidator(1, 1000, self))
self._acquisition_mib.\
bind_value_update('overlap',
self.acq_widget_layout.child('overlap_ledit'),
float,
qt.QDoubleValidator(-1000, 1000, 2, self))
self._acquisition_mib.\
bind_value_update('energy',
self.acq_widget_layout.child('energy_ledit'),
float,
qt.QDoubleValidator(0, 1000, 4, self))
#.........這裏部分代碼省略.........
示例12: AcquisitionWidget
class AcquisitionWidget(qt.QWidget):
def __init__(self, parent=None, name=None, fl=0, acq_params=None,
path_template=None, layout='horizontal'):
qt.QWidget.__init__(self, parent, name, fl)
#
# Attributes
#
self._beamline_setup = None
self.previous_energy = 0
if acq_params is None:
self._acquisition_parameters = queue_model_objects.\
AcquisitionParameters()
else:
self._acquisition_parameters = acq_params
if path_template is None:
self._path_template = queue_model_objects.PathTemplate()
else:
self._path_template = path_template
self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters)
#self._path_template_mib = DataModelInputBinder(self._path_template)
#
# Layout
#
h_layout = qt.QHBoxLayout(self)
if layout == 'vertical':
widget = qtui.QWidgetFactory.\
create(os.path.join(os.path.dirname(__file__),
'ui_files/acquisition_widget_vertical_layout.ui'))
elif layout == 'horizontal':
widget = qtui.QWidgetFactory.\
create(os.path.join(os.path.dirname(__file__),
'ui_files/acquisition_widget_horizontal_layout.ui'))
widget.child('inverse_beam_cbx').hide()
widget.child('subwedge_size_label').hide()
widget.child('subwedge_size_ledit').hide()
else:
widget = qtui.QWidgetFactory.\
create(os.path.join(os.path.dirname(__file__),
'ui_files/acquisition_widget_vertical_layout.ui'))
widget.reparent(self, qt.QPoint(0, 0))
self.acq_widget_layout = widget
h_layout.addWidget(self.acq_widget_layout)
#
# Logic
#
self._acquisition_mib.\
bind_value_update('osc_start',
self.acq_widget_layout.child('osc_start_ledit'),
float,
qt.QDoubleValidator(-10000, 10000, 2, self))
self._acquisition_mib.\
bind_value_update('first_image',
self.acq_widget_layout.child('first_image_ledit'),
int,
qt.QIntValidator(1, 9999, self))
self._acquisition_mib.\
bind_value_update('exp_time',
self.acq_widget_layout.child('exp_time_ledit'),
float,
qt.QDoubleValidator(0.003, 6000, 3, self))
self._acquisition_mib.\
bind_value_update('osc_range',
self.acq_widget_layout.child('osc_range_ledit'),
float,
qt.QDoubleValidator(0.001, 1000, 2, self))
self._acquisition_mib.\
bind_value_update('num_images',
self.acq_widget_layout.child('num_images_ledit'),
int,
qt.QIntValidator(1, 9999, self))
self._acquisition_mib.\
bind_value_update('num_passes',
self.acq_widget_layout.child('num_passes_ledit'),
int,
qt.QIntValidator(1, 1000, self))
self._acquisition_mib.\
bind_value_update('overlap',
self.acq_widget_layout.child('overlap_ledit'),
float,
qt.QDoubleValidator(-1000, 1000, 2, self))
self._acquisition_mib.\
bind_value_update('energy',
self.acq_widget_layout.child('energy_ledit'),
float,
#.........這裏部分代碼省略.........
示例13: ProcessingWidget
class ProcessingWidget(qt.QWidget):
def __init__(self, parent=None, name=None, fl=0, data_model=None):
qt.QWidget.__init__(self, parent, name, fl)
if data_model is None:
self._model = queue_model_objects.ProcessingParameters()
else:
self._model = data_model
self._model_mib = DataModelInputBinder(self._model)
h_layout = qt.QHBoxLayout(self)
widget = self.acq_widget_layout = qtui.QWidgetFactory.create(
os.path.join(
os.path.dirname(__file__),
"ui_files/processing_widget_vertical_layout.ui",
)
)
widget.reparent(self, qt.QPoint(0, 0))
self.layout_widget = widget
h_layout.addWidget(self.layout_widget)
self.layout_widget.child("space_group_ledit").insertStrList(
queue_model_enumerables.XTAL_SPACEGROUPS
)
self._model_mib.bind_value_update(
"cell_a", self.layout_widget.child("a_ledit"), float, None
)
self._model_mib.bind_value_update(
"cell_alpha", self.layout_widget.child("alpha_ledit"), float, None
)
self._model_mib.bind_value_update(
"cell_b", self.layout_widget.child("b_ledit"), float, None
)
self._model_mib.bind_value_update(
"cell_beta", self.layout_widget.child("beta_ledit"), float, None
)
self._model_mib.bind_value_update(
"cell_c", self.layout_widget.child("c_ledit"), float, None
)
self._model_mib.bind_value_update(
"cell_gamma", self.layout_widget.child("gamma_ledit"), float, None
)
self._model_mib.bind_value_update(
"num_residues", self.layout_widget.child("num_residues_ledit"), float, None
)
self.connect(
self.layout_widget.child("space_group_ledit"),
qt.SIGNAL("activated(int)"),
self._space_group_change,
)
def _space_group_change(self, index):
self._model.space_group = queue_model_enumerables.XTAL_SPACEGROUPS[index]
def _set_space_group(self, space_group):
index = 0
if space_group in queue_model_enumerables.XTAL_SPACEGROUPS:
index = queue_model_enumerables.XTAL_SPACEGROUPS.index(space_group)
self._space_group_change(index)
self.layout_widget.child("space_group_ledit").setCurrentItem(index)
def update_data_model(self, model):
self._model = model
self._model_mib.set_model(model)
self._set_space_group(model.space_group)
示例14: __init__
def __init__(self,parent = None,name = None, fl = 0):
CreateTaskBase.__init__(self, parent, name, fl, 'Characterisation')
if not name:
self.setName("create_char_widget")
#
# Data attributes
#
self._current_selected_item = None
self.init_models()
self._char_params_mib = DataModelInputBinder(self._char_params)
#
# Layout
#
v_layout = qt.QVBoxLayout(self, 2, 6, "v_layout")
self._acq_widget = \
AcquisitionWidgetSimple(self, acq_params = self._acquisition_parameters,
path_template = self._path_template)
current_dir = os.path.dirname(__file__)
ui_file = 'ui_files/vertical_crystal_dimension_widget_layout.ui'
widget = qtui.QWidgetFactory.\
create(os.path.join(current_dir, ui_file))
widget.reparent(self, qt.QPoint(0,0))
self._vertical_dimension_widget = widget
ui_file = 'ui_files/characterise_simple_widget_vertical_layout.ui'
widget = qtui.QWidgetFactory.\
create(os.path.join(current_dir, ui_file))
widget.reparent(self, qt.QPoint(0,0))
self._char_widget = widget
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)
v_layout.addWidget(self._acq_widget)
v_layout.addWidget(self._char_widget)
v_layout.addWidget(self._vertical_dimension_widget)
v_layout.addWidget(self._data_path_gbox)
v_layout.addStretch(10)
#
# Logic
#
optimised_sad_cbx = self._char_widget.\
child('optimised_sad_cbx')
account_rad_dmg_cbx = self._char_widget.\
child('account_rad_dmg_cbx')
start_comp_cbox = self._char_widget.child('start_comp_cbox')
induced_burn_cbx = self._char_widget.child('induced_burn_cbx')
max_vdim_ledit = self._vertical_dimension_widget.\
child('max_vdim_ledit')
min_vdim_ledit = self._vertical_dimension_widget.\
child('min_vdim_ledit')
min_vphi_ledit = self._vertical_dimension_widget.\
child('min_vphi_ledit')
max_vphi_ledit = self._vertical_dimension_widget.\
child('max_vphi_ledit')
space_group_ledit = self._vertical_dimension_widget.\
child('space_group_ledit')
self._char_params_mib.bind_value_update('opt_sad',
optimised_sad_cbx,
bool, None)
self._char_params_mib.bind_value_update('account_rad_damage',
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',
start_comp_cbox,
int, None)
self._char_params_mib.\
bind_value_update('max_crystal_vdim',
max_vdim_ledit, float,
qt.QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.\
bind_value_update('min_crystal_vdim',
min_vdim_ledit, float,
qt.QDoubleValidator(0.0, 1000, 2, self))
#.........這裏部分代碼省略.........
示例15: CreateCharWidget
class CreateCharWidget(CreateTaskBase):
def __init__(self,parent = None,name = None, fl = 0):
CreateTaskBase.__init__(self, parent, name, fl, 'Characterisation')
if not name:
self.setName("create_char_widget")
#
# Data attributes
#
self._current_selected_item = None
self.init_models()
self._char_params_mib = DataModelInputBinder(self._char_params)
#
# Layout
#
v_layout = qt.QVBoxLayout(self, 2, 6, "v_layout")
self._acq_widget = \
AcquisitionWidgetSimple(self, acq_params = self._acquisition_parameters,
path_template = self._path_template)
current_dir = os.path.dirname(__file__)
ui_file = 'ui_files/vertical_crystal_dimension_widget_layout.ui'
widget = qtui.QWidgetFactory.\
create(os.path.join(current_dir, ui_file))
widget.reparent(self, qt.QPoint(0,0))
self._vertical_dimension_widget = widget
ui_file = 'ui_files/characterise_simple_widget_vertical_layout.ui'
widget = qtui.QWidgetFactory.\
create(os.path.join(current_dir, ui_file))
widget.reparent(self, qt.QPoint(0,0))
self._char_widget = widget
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)
v_layout.addWidget(self._acq_widget)
v_layout.addWidget(self._char_widget)
v_layout.addWidget(self._vertical_dimension_widget)
v_layout.addWidget(self._data_path_gbox)
v_layout.addStretch(10)
#
# Logic
#
optimised_sad_cbx = self._char_widget.\
child('optimised_sad_cbx')
account_rad_dmg_cbx = self._char_widget.\
child('account_rad_dmg_cbx')
start_comp_cbox = self._char_widget.child('start_comp_cbox')
induced_burn_cbx = self._char_widget.child('induced_burn_cbx')
max_vdim_ledit = self._vertical_dimension_widget.\
child('max_vdim_ledit')
min_vdim_ledit = self._vertical_dimension_widget.\
child('min_vdim_ledit')
min_vphi_ledit = self._vertical_dimension_widget.\
child('min_vphi_ledit')
max_vphi_ledit = self._vertical_dimension_widget.\
child('max_vphi_ledit')
space_group_ledit = self._vertical_dimension_widget.\
child('space_group_ledit')
self._char_params_mib.bind_value_update('opt_sad',
optimised_sad_cbx,
bool, None)
self._char_params_mib.bind_value_update('account_rad_damage',
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',
start_comp_cbox,
int, None)
self._char_params_mib.\
bind_value_update('max_crystal_vdim',
max_vdim_ledit, float,
qt.QDoubleValidator(0.0, 1000, 2, self))
self._char_params_mib.\
bind_value_update('min_crystal_vdim',
min_vdim_ledit, float,
qt.QDoubleValidator(0.0, 1000, 2, self))
#.........這裏部分代碼省略.........