本文整理匯總了Python中widgets.widget_utils.DataModelInputBinder.bind_value_update方法的典型用法代碼示例。如果您正苦於以下問題:Python DataModelInputBinder.bind_value_update方法的具體用法?Python DataModelInputBinder.bind_value_update怎麽用?Python DataModelInputBinder.bind_value_update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類widgets.widget_utils.DataModelInputBinder
的用法示例。
在下文中一共展示了DataModelInputBinder.bind_value_update方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: CreateCharWidget
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
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,
#.........這裏部分代碼省略.........
示例2: ProcessingWidget
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
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._model_mib.bind_value_update('process_data',
self.layout_widget.child('use_processing'),
bool,
None)
self._model_mib.bind_value_update('anomalous',
self.layout_widget.child('use_anomalous'),
bool,
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)
示例3: AcquisitionWidget
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
#.........這裏部分代碼省略.........
def update_kappa_phi(self, new_value):
self.acq_widget_layout.child("kappa_phi_ledit").setText(
"%.2f" % float(new_value)
)
def use_osc_start(self, state):
self.acq_widget_layout.child("osc_start_cbox").setChecked(state)
self.acq_widget_layout.child("osc_start_cbox").setDisabled(state)
def use_kappa(self, state):
if self.layout_type == "vertical":
self.acq_widget_layout.child("kappa_ledit").setEnabled(state)
def use_kappa_phi(self, state):
if self.layout_type == "vertical":
self.acq_widget_layout.child("kappa_phi_ledit").setEnabled(state)
def set_beamline_setup(self, beamline_setup):
self._beamline_setup = beamline_setup
limits_dict = self._beamline_setup.get_acquisition_limit_values()
if "osc_range" in limits_dict:
limits = tuple(map(float, limits_dict["osc_range"].split(",")))
(lower, upper) = limits
osc_start_validator = qt.QDoubleValidator(lower, upper, 4, self)
osc_range_validator = qt.QDoubleValidator(lower, upper, 4, self)
else:
osc_start_validator = qt.QDoubleValidator(-10000, 10000, 4, self)
osc_range_validator = qt.QDoubleValidator(-10000, 10000, 4, self)
osc_start_ledit = self.acq_widget_layout.child("osc_start_ledit")
self._acquisition_mib.bind_value_update(
"osc_start", osc_start_ledit, float, osc_start_validator
)
osc_range_ledit = self.acq_widget_layout.child("osc_range_ledit")
self._acquisition_mib.bind_value_update(
"osc_range", osc_range_ledit, float, osc_range_validator
)
kappa_validator = qt.QDoubleValidator(0, 360, 2, self)
kappa_ledit = self.acq_widget_layout.child("kappa_ledit")
self._acquisition_mib.bind_value_update(
"kappa", kappa_ledit, float, kappa_validator
)
kappa_phi_validator = qt.QDoubleValidator(0, 360, 2, self)
kappa_phi_ledit = self.acq_widget_layout.child("kappa_phi_ledit")
self._acquisition_mib.bind_value_update(
"kappa_phi", kappa_phi_ledit, float, kappa_phi_validator
)
if "exposure_time" in limits_dict:
limits = tuple(map(float, limits_dict["exposure_time"].split(",")))
(lower, upper) = limits
exp_time_valdidator = qt.QDoubleValidator(lower, upper, 5, self)
else:
exp_time_valdidator = qt.QDoubleValidator(-0.003, 6000, 5, self)
exp_time_ledit = self.acq_widget_layout.child("exp_time_ledit")
self._acquisition_mib.bind_value_update(
"exp_time", exp_time_ledit, float, exp_time_valdidator
)
示例4: SampleDetailsBrick
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
class SampleDetailsBrick(BaseComponents.BlissWidget):
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,
)
def populate_sample_details(self, sample):
self.sample = sample
self.crystal = sample.crystals[0]
self.crystal_mib.set_model(self.crystal)
self.sample_mib.set_model(sample)
示例5: CharParametersWidget
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
class CharParametersWidget(qt.QWidget):
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,
#.........這裏部分代碼省略.........
示例6: CreateXRFSpectrumWidget
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
class CreateXRFSpectrumWidget(CreateTaskBase):
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,
)
def init_models(self):
CreateTaskBase.init_models(self)
self._path_template.start_num = 1
self._path_template.num_files = 1
self._path_template.suffix = "raw"
def single_item_selection(self, tree_item):
CreateTaskBase.single_item_selection(self, tree_item)
if isinstance(tree_item, queue_item.XRFSpectrumQueueItem):
xrfspectrum_model = tree_item.get_model()
self.xrfspectrum_mib.set_model(xrfspectrum_model)
if xrfspectrum_model.is_executed():
self.setDisabled(True)
else:
self.setDisabled(False)
if xrfspectrum_model.get_path_template():
self._path_template = xrfspectrum_model.get_path_template()
self._data_path_widget.update_data_model(self._path_template)
elif isinstance(tree_item, queue_item.BasketQueueItem):
self.setDisabled(False)
elif not (
isinstance(tree_item, queue_item.SampleQueueItem)
or isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)
):
self.setDisabled(True)
def approve_creation(self):
result = CreateTaskBase.approve_creation(self)
selected_shapes = self._shape_history.selected_shapes
for shape in selected_shapes:
if isinstance(shape, shape_history.Line) or isinstance(
shape, shape_history.CanvasGrid
):
result = False
self.count_time = None
try:
#.........這裏部分代碼省略.........
示例7: DataPathWidget
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
class DataPathWidget(qt.QWidget):
def __init__(self, parent = None, name = '', fl = 0, data_model = None,
layout = None):
qt.QWidget.__init__(self, parent, name, fl)
#
# Attributes
#
self._session_hwobj = 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('directory',
# self.data_path_widget_layout.folder_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)
def set_session(self, session_hwobj):
self._session_hwobj = session_hwobj
def _browse_clicked(self):
get_dir = qt.QFileDialog(self)
given_dir = self._session_hwobj.get_base_image_directory()
d = str(get_dir.getExistingDirectory(given_dir, self, "",
"Select a directory",
True, False))
d = os.path.dirname(d)
if d is not None and len(d) > 0:
self.set_directory(d)
def _prefix_ledit_change(self, new_value):
self.set_prefix(new_value)
self.emit(qt.PYSIGNAL('path_template_changed'),
(self.data_path_widget_layout.prefix_ledit,
new_value))
def _run_number_ledit_change(self, new_value):
if str(new_value).isdigit():
self.set_run_number(new_value)
self.emit(qt.PYSIGNAL('path_template_changed'),
(self.data_path_widget_layout.run_number_ledit,
new_value))
#.........這裏部分代碼省略.........
示例8: AcquisitionWidgetSimple
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
#.........這裏部分代碼省略.........
str(num_images)
)
self.acq_widget_layout.child("num_images_cbox").setCurrentItem(3)
self._path_template.num_files = num_images
def use_mad(self, state):
pass
def get_mad_energy(self):
pass
def set_energies(self, energy_scan_result):
pass
def energy_selected(self, index):
pass
def set_beamline_setup(self, beamline_setup):
self._beamline_setup = beamline_setup
limits_dict = self._beamline_setup.get_acquisition_limit_values()
if "osc_range" in limits_dict:
limits = tuple(map(float, limits_dict["osc_range"].split(",")))
(lower, upper) = limits
osc_start_validator = qt.QDoubleValidator(lower, upper, 4, self)
osc_range_validator = qt.QDoubleValidator(lower, upper, 4, self)
else:
osc_start_validator = qt.QDoubleValidator(-10000, 10000, 4, self)
osc_range_validator = qt.QDoubleValidator(-10000, 10000, 4, self)
osc_start_ledit = self.acq_widget_layout.child("osc_start_ledit")
self._acquisition_mib.bind_value_update(
"osc_start", osc_start_ledit, float, osc_start_validator
)
osc_range_ledit = self.acq_widget_layout.child("osc_range_ledit")
self._acquisition_mib.bind_value_update(
"osc_range", osc_range_ledit, float, osc_range_validator
)
if "exposure_time" in limits_dict:
limits = tuple(map(float, limits_dict["exposure_time"].split(",")))
(lower, upper) = limits
exp_time_valdidator = qt.QDoubleValidator(lower, upper, 5, self)
else:
exp_time_valdidator = qt.QDoubleValidator(-0.003, 6000, 5, self)
exp_time_ledit = self.acq_widget_layout.child("exp_time_ledit")
self._acquisition_mib.bind_value_update(
"exp_time", exp_time_ledit, float, exp_time_valdidator
)
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),
示例9: CreateCharWidget
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
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))
#.........這裏部分代碼省略.........
示例10: DataPathWidget
# 需要導入模塊: from widgets.widget_utils import DataModelInputBinder [as 別名]
# 或者: from widgets.widget_utils.DataModelInputBinder import bind_value_update [as 別名]
class DataPathWidget(qt.QWidget):
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,
)
def _browse_clicked(self):
get_dir = qt.QFileDialog(self)
given_dir = self._base_image_dir
d = str(
get_dir.getExistingDirectory(
given_dir, self, "", "Select a directory", True, False
)
)
d = os.path.dirname(d)
if d is not None and len(d) > 0:
self.set_directory(d)
#.........這裏部分代碼省略.........