本文整理汇总了Python中gui.BaseComponents.BaseWidget类的典型用法代码示例。如果您正苦于以下问题:Python BaseWidget类的具体用法?Python BaseWidget怎么用?Python BaseWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, *args):
BaseWidget.__init__(self, *args)
# Hardware objects ----------------------------------------------------
# Internal values -----------------------------------------------------
self.use_dialog = False
# Properties ----------------------------------------------------------
self.add_property("mnemonicList", "string", "")
# Signals ------------------------------------------------------------
# Slots ---------------------------------------------------------------
# Graphic elements ----------------------------------------------------
self.progress_type_label = QtImport.QLabel("", self)
self.progress_bar = QtImport.QProgressBar(self)
# $self.progress_bar.setCenterIndicator(True)
self.progress_bar.setMinimum(0)
main_layout = QtImport.QVBoxLayout(self)
main_layout.addWidget(self.progress_type_label)
main_layout.addWidget(self.progress_bar)
main_layout.setContentsMargins(2, 2, 2, 2)
main_layout.setSpacing(2)
self.setEnabled(False)
new_palette = QtImport.QPalette()
new_palette.setColor(QtImport.QPalette.Highlight, Colors.DARK_GREEN)
self.progress_bar.setPalette(new_palette)
示例2: property_changed
def property_changed(self, property_name, old_value, new_value):
if property_name == "mnemonic":
if self.light_ho is not None:
self.disconnect(
self.light_ho, QtImport.SIGNAL("levelChanged"), self.level_changed
)
self.disconnect(
self.light_ho, QtImport.SIGNAL("stateChanged"), self.state_changed
)
self.light_ho = self.get_hardware_object(new_value)
if self.light_ho is not None:
self.setEnabled(True)
self.connect(
self.light_ho, QtImport.SIGNAL("levelChanged"), self.level_changed
)
self.connect(
self.light_ho, QtImport.SIGNAL("stateChanged"), self.state_changed
)
self.light_ho.update_values()
self.setToolTip(
"Control of %s (light level and on/off switch."
% self.light_ho.getUserName()
)
self.set_level_limits(self.light_ho.getLimits())
self.set_label(self.light_ho.getUserName())
else:
self.setEnabled(False)
elif property_name == "icons":
self.set_icons(new_value)
else:
BaseWidget.property_changed(self, property_name, old_value, new_value)
示例3: __init__
def __init__(self, *args):
"""Main init"""
BaseWidget.__init__(self, *args)
# Internal values -----------------------------------------------------
self.graphics_initialized = None
self.value_label_list = []
# Properties (name, type, default value, comment)----------------------
self.add_property(
"maxPlotPoints", "integer", 100, comment="Maximal number of plot points"
)
# Signals -------------------------------------------------------------
# Slots ---------------------------------------------------------------
# Graphic elements ----------------------------------------------------
# Layout --------------------------------------------------------------
self.main_vlayout = QtImport.QVBoxLayout(self)
self.main_vlayout.setSpacing(1)
self.main_vlayout.setContentsMargins(2, 2, 2, 2)
# SizePolicies --------------------------------------------------------
# Other ---------------------------------------------------------------
self.setToolTip("Main information about the beamline")
示例4: __init__
def __init__(self, *args):
BaseWidget.__init__(self, *args)
# Internal variables --------------------------------------------------
# Properties ----------------------------------------------------------
self.add_property("useImageTracking", "boolean", True)
# Signals ------------------------------------------------------------
# Slots ---------------------------------------------------------------
self.define_slot("populate_dc_parameter_widget", ({}))
# Graphic elements ----------------------------------------------------
self.tool_box = QtImport.QToolBox(self)
self.parameters_widget = DCParametersWidget(self, "parameters_widget")
self.results_static_view = QtImport.QTextBrowser(self.tool_box)
self.image_tracking_widget = ImageTrackingWidget(self.tool_box)
self.advance_results_widget = AdvancedResultsWidget(self.tool_box)
self.snapshot_widget = SnapshotWidget(self)
self.tool_box.addItem(self.parameters_widget, "Parameters")
self.tool_box.addItem(self.image_tracking_widget, "Results - ADXV control")
self.tool_box.addItem(self.results_static_view, "Results - Summary")
self.tool_box.addItem(
self.advance_results_widget, "Results - Parallel processing"
)
# Layout --------------------------------------------------------------
_main_vlayout = QtImport.QHBoxLayout(self)
_main_vlayout.addWidget(self.tool_box)
_main_vlayout.addWidget(self.snapshot_widget)
示例5: property_changed
def property_changed(self, property_name, old_value, new_value):
if property_name == "mnemonic":
if self.crl_hwobj:
self.disconnect(self.crl_hwobj, "crlModeChanged", self.crl_mode_changed)
self.disconnect(
self.crl_hwobj, "crlValueChanged", self.crl_value_changed
)
self.crl_hwobj = self.get_hardware_object(new_value)
if self.crl_hwobj:
crl_modes = self.crl_hwobj.get_modes()
for crl_mode in crl_modes:
self.mode_combo.addItem(crl_mode)
self.connect(self.crl_hwobj, "crlModeChanged", self.crl_mode_changed)
self.connect(self.crl_hwobj, "crlValueChanged", self.crl_value_changed)
self.crl_hwobj.update_values()
elif property_name == "lenseCount":
self.crl_value_table.setColumnCount(new_value)
for col_index in range(new_value):
temp_item = QtImport.QTableWidgetItem("")
temp_item.setFlags(QtImport.Qt.ItemIsEnabled)
temp_item.setBackground(Colors.LIGHT_GRAY)
self.crl_value_table.setItem(0, col_index, temp_item)
self.crl_value_table.setColumnWidth(col_index, 20)
self.crl_value.append(0)
self.crl_value_table.setFixedWidth(20 * new_value + 6)
elif property_name == "caption":
if new_value:
self.main_gbox.setTitle(new_value)
else:
BaseWidget.property_changed(self, property_name, old_value, new_value)
示例6: property_changed
def property_changed(self, property_name, old_value, new_value):
if property_name == "mnemonic":
if self.actuator_hwo is not None:
self.disconnect(
self.actuator_hwo, QtImport.SIGNAL("stateChanged"), self.state_changed
)
self.actuator_hwo = self.get_hardware_object(new_value)
if self.actuator_hwo is not None:
self.setEnabled(True)
self.connect(
self.actuator_hwo, QtImport.SIGNAL("stateChanged"), self.state_changed
)
self.actuator_hwo.update_values()
logging.getLogger("HWR").info(
"User Name is: %s" % self.actuator_hwo.getUserName()
)
self.widget.actuatorBox.setTitle(self.actuator_hwo.getUserName())
else:
self.setEnabled(False)
elif property_name == "in_cmd_name":
self.widget.cmdInButton.setText(new_value)
elif property_name == "out_cmd_name":
self.widget.cmdOutButton.setText(new_value)
else:
BaseWidget.property_changed(self, property_name, old_value, new_value)
示例7: property_changed
def property_changed(self, property_name, old_value, new_value):
if property_name == "mnemonic":
if self.beamstop_hwobj is not None:
self.disconnect(self.beamstop_hwobj, "deviceReady", self.connected)
self.disconnect(
self.beamstop_hwobj, "deviceNotReady", self.disconnected
)
self.disconnect(
self.beamstop_hwobj,
"beamstopDistanceChanged",
self.beamstop_distance_changed,
)
self.beamstop_hwobj = self.get_hardware_object(new_value)
if self.beamstop_hwobj is not None:
self.connect(self.beamstop_hwobj, "deviceReady", self.connected)
self.connect(self.beamstop_hwobj, "deviceNotReady", self.disconnected)
self.connect(
self.beamstop_hwobj,
"beamstopDistanceChanged",
self.beamstop_distance_changed,
)
if self.beamstop_hwobj.isReady():
self.connected()
self.beamstop_hwobj.update_values()
else:
self.disconnected()
else:
self.disconnected()
else:
BaseWidget.property_changed(self, property_name, old_value, new_value)
示例8: property_changed
def property_changed(self, property_name, old_value, new_value):
if property_name == "mnemonic":
if self.image_tracking_hwobj is not None:
self.disconnect(
self.image_tracking_hwobj,
"imageTrackingStateChanged",
self.image_tracking_state_changed,
)
self.disconnect(
self.image_tracking_hwobj, "stateChanged", self.state_changed
)
self.image_tracking_hwobj = self.get_hardware_object(new_value)
if self.image_tracking_hwobj is not None:
self.image_tracking_cbox.blockSignals(True)
self.image_tracking_cbox.setChecked(
self.image_tracking_hwobj.is_tracking_enabled() == True
)
self.image_tracking_cbox.blockSignals(False)
self.connect(
self.image_tracking_hwobj,
"imageTrackingStateChanged",
self.image_tracking_state_changed,
)
self.connect(
self.image_tracking_hwobj, "stateChanged", self.state_changed
)
self.image_tracking_hwobj.update_values()
self.setEnabled(True)
else:
self.setEnabled(False)
else:
BaseWidget.property_changed(self, property_name, old_value, new_value)
示例9: __init__
def __init__(self, *args):
BaseWidget.__init__(self, *args)
# Hardware objects ----------------------------------------------------
# Internal values -----------------------------------------------------
# Properties ----------------------------------------------------------
# Signals -------------------------------------------------------------
# Slots ---------------------------------------------------------------
self.define_slot("populate_advanced_widget", ({}))
# Graphic elements ----------------------------------------------------
self.tool_box = QtImport.QToolBox(self)
self.parameters_widget = AdvancedParametersWidget(self)
self.results_widget = AdvancedResultsWidget(self)
self.line_parameters_widget = AdvancedParametersWidget(self)
self.line_results_widget = AdvancedResultsWidget(self)
self.snapshot_widget = SnapshotWidget(self)
self.tool_box.addItem(self.parameters_widget, "2D Heat map: Parameters")
self.tool_box.addItem(self.results_widget, "2D Heat map: Results")
self.tool_box.addItem(self.line_parameters_widget, "Line scan: Parameters")
self.tool_box.addItem(self.line_results_widget, "Line scan: Results")
# Layout --------------------------------------------------------------
_main_vlayout = QtImport.QHBoxLayout(self)
_main_vlayout.addWidget(self.tool_box)
_main_vlayout.addWidget(self.snapshot_widget)
示例10: __init__
def __init__(self, *args):
BaseWidget.__init__(self, *args)
# Hardware objects ----------------------------------------------------
# Internal values -----------------------------------------------------
self.max_log_lines = -1
self.test_mode = False
# Properties ----------------------------------------------------------
self.add_property("maxLogLines", "integer", -1)
# Signals -------------------------------------------------------------
# Slots ---------------------------------------------------------------
# Graphic elements ----------------------------------------------------
self._status_bar_widget = LogBarWidget(self)
# Layout --------------------------------------------------------------
_main_hlayout = QtImport.QHBoxLayout(self)
_main_hlayout.addWidget(self._status_bar_widget)
_main_hlayout.setSpacing(0)
_main_hlayout.setContentsMargins(2, 2, 2, 2)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
# Other ---------------------------------------------------------------
GUILogHandler.GUILogHandler().register(self)
示例11: __init__
def __init__(self, *args):
BaseWidget.__init__(self, *args)
# Internal values -----------------------------------------------------
self.target_menu = None
self.image_scale_list = []
# Properties ----------------------------------------------------------
self.add_property(
"targetMenu", "combo", ("menuBar", "toolBar", "both"), "menuBar"
)
self.add_property("beamDefiner", "boolean", False)
# Signals ------------------------------------------------------------
# Slots ---------------------------------------------------------------
# Graphic elements ----------------------------------------------------
self.tools_menu = None
self.measure_distance_action = None
self.measure_angle_action = None
self.measure_area_action = None
self.define_beam_action = None
self.move_beam_mark_manual_action = None
self.move_beam_mark_auto_action = None
self.display_beam_size_action = None
self.display_grid_action = None
self.magnification_action = None
self.image_scale_menu = None
示例12: __init__
def __init__(self, *args):
BaseWidget.__init__(self, *args)
# Internal variables --------------------------------------------------
# Properties ----------------------------------------------------------
# Signals ------------------------------------------------------------
# Slots ---------------------------------------------------------------
# Graphic elements ----------------------------------------------------
_main_groupbox = QtImport.QGroupBox("Detector status", self)
self.status_label = QtImport.QLabel("<b>unknown status</b>", _main_groupbox)
self.frame_rate_label = QtImport.QLabel(" Frame rate : ", _main_groupbox)
self.temperature_label = QtImport.QLabel(" Temperature:", _main_groupbox)
self.humidity_label = QtImport.QLabel(" Humidity: ", _main_groupbox)
# Layout --------------------------------------------------------------
_main_groupbox_vlayout = QtImport.QVBoxLayout(_main_groupbox)
_main_groupbox_vlayout.addWidget(self.status_label)
_main_groupbox_vlayout.addWidget(self.frame_rate_label)
_main_groupbox_vlayout.addWidget(self.temperature_label)
_main_groupbox_vlayout.addWidget(self.humidity_label)
_main_groupbox_vlayout.setSpacing(2)
_main_groupbox_vlayout.setContentsMargins(4, 4, 4, 4)
main_layout = QtImport.QVBoxLayout(self)
main_layout.addWidget(_main_groupbox)
main_layout.setSpacing(0)
main_layout.setContentsMargins(0, 0, 0, 0)
# SizePolicies -------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
# Other ---------------------------------------------------------------
Colors.set_widget_color(
self.status_label, DetectorStatusBrick.DETECTOR_STATES["uninitialized"]
)
Colors.set_widget_color(
self.temperature_label, DetectorStatusBrick.STATES["unknown"]
)
Colors.set_widget_color(
self.humidity_label, DetectorStatusBrick.STATES["unknown"]
)
Colors.set_widget_color(self.frame_rate_label, DetectorStatusBrick.STATES["OK"])
self.status_label.setMinimumHeight(20)
self.status_label.setAlignment(QtImport.Qt.AlignCenter)
self.temperature_label.setMinimumHeight(20)
self.humidity_label.setMinimumHeight(20)
self.frame_rate_label.setMinimumHeight(20)
self.connect(api.detector, "temperatureChanged", self.temperature_changed)
self.connect(api.detector, "humidityChanged", self.humidity_changed)
self.connect(api.detector, "statusChanged", self.status_changed)
self.connect(api.detector, "frameRateChanged", self.frame_rate_changed)
示例13: property_changed
def property_changed(self, property_name, old_value, new_value):
if property_name == "level":
self.filter_level = logging.NOTSET
if new_value == "INFO":
self.filter_level = logging.INFO
elif new_value == "WARNING":
self.filter_level = logging.WARNING
elif new_value == "ERROR":
self.filter_level = logging.ERROR
elif property_name == "showDebug":
if self["appearance"] == "tabs":
if not new_value:
self.tab_widget.removeTab(self.tab_widget.indexOf(self.debug_log))
elif property_name == "emailAddresses":
self.feedback_log.email_addresses = new_value
elif property_name == "fromEmailAddress":
self.feedback_log.from_email_address = new_value
elif property_name == "enableFeedback":
if self["appearance"] == "tabs":
if not new_value:
self.tab_widget.removeTab(
self.tab_widget.indexOf(self.feedback_log)
)
elif property_name == "appearance":
if new_value == "list":
self.tab_levels = {
logging.NOTSET: self.info_log,
logging.DEBUG: self.info_log,
logging.INFO: self.info_log,
logging.WARNING: self.info_log,
logging.ERROR: self.info_log,
logging.CRITICAL: self.info_log,
}
self.tab_widget.removeTab(self.tab_widget.indexOf(self.details_log))
self.tab_widget.removeTab(self.tab_widget.indexOf(self.debug_log))
elif new_value == "tabs":
self.tab_levels = {
logging.NOTSET: self.details_log,
logging.DEBUG: self.debug_log,
logging.INFO: self.info_log,
logging.WARNING: self.details_log,
logging.ERROR: self.details_log,
logging.CRITICAL: self.details_log,
}
elif property_name == "maxLogLines":
self.details_log.set_max_log_lines(new_value)
self.info_log.set_max_log_lines(new_value)
self.debug_log.set_max_log_lines(new_value)
else:
BaseWidget.property_changed(self, property_name, old_value, new_value)
示例14: property_changed
def property_changed(self, property_name, old_value, new_value):
if property_name == "targetMenu":
self.target_menu = new_value
# elif property_name == 'cameraControls':
# self.camera_control_action.setEnabled(new_value)
# elif property_name == 'beamDefiner':
# self.define_beam_action.setEnabled(new_value)
else:
BaseWidget.property_changed(self, property_name, old_value, new_value)
示例15: __init__
def __init__(self, *args):
BaseWidget.__init__(self, *args)
# Hardware objects ----------------------------------------------------
self.beam_info_hwobj = None
# Internal values -----------------------------------------------------
# Properties ----------------------------------------------------------
self.add_property("formatString", "formatString", "#.#")
# Signals ------------------------------------------------------------
# Slots ---------------------------------------------------------------
# Graphic elements ----------------------------------------------------
self.main_gbox = QtImport.QGroupBox("Beam size", self)
hor_label = QtImport.QLabel("Horizontal:", self.main_gbox)
self.hor_size_ledit = QtImport.QLineEdit(self.main_gbox)
self.hor_size_ledit.setMaximumWidth(120)
self.hor_size_ledit.setEnabled(False)
self.hor_size_ledit.setAlignment(QtImport.Qt.AlignRight)
ver_label = QtImport.QLabel("Vertical:", self.main_gbox)
self.ver_size_ledit = QtImport.QLineEdit(self.main_gbox)
self.ver_size_ledit.setMaximumWidth(120)
self.ver_size_ledit.setEnabled(False)
self.ver_size_ledit.setAlignment(QtImport.Qt.AlignRight)
bold_font = self.hor_size_ledit.font()
bold_font.setBold(True)
self.hor_size_ledit.setFont(bold_font)
self.ver_size_ledit.setFont(bold_font)
# Layout --------------------------------------------------------------
_main_gbox_gridlayout = QtImport.QGridLayout(self.main_gbox)
_main_gbox_gridlayout.addWidget(hor_label, 0, 0)
_main_gbox_gridlayout.addWidget(self.hor_size_ledit, 0, 1)
_main_gbox_gridlayout.addWidget(ver_label, 1, 0)
_main_gbox_gridlayout.addWidget(self.ver_size_ledit, 1, 1)
_main_gbox_gridlayout.setRowStretch(2, 10)
_main_gbox_gridlayout.setSpacing(2)
_main_gbox_gridlayout.setContentsMargins(0, 0, 0, 0)
_main_vlayout = QtImport.QVBoxLayout(self)
_main_vlayout.addWidget(self.main_gbox)
_main_vlayout.setSpacing(0)
_main_vlayout.setContentsMargins(2, 2, 2, 2)
# SizePolicies --------------------------------------------------------
# Qt signal/slot connections ------------------------------------------
# Other ---------------------------------------------------------------
self.connect(api.beam_info, "beamInfoChanged", self.beam_info_changed)