本文整理汇总了Python中BlissFramework.Qt4_Icons类的典型用法代码示例。如果您正苦于以下问题:Python Qt4_Icons类的具体用法?Python Qt4_Icons怎么用?Python Qt4_Icons使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Qt4_Icons类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: propertyChanged
def propertyChanged(self, property, oldValue, newValue):
if property == "light_actuator":
if self.light_actuator_hwo is not None:
self.disconnect(self.light_actuator_hwo, "wagoStateChanged", self.lightStateChanged)
self.light_actuator_hwo = self.getHardwareObject(newValue)
if self.light_actuator_hwo is not None:
self.connect(self.light_actuator_hwo, "wagoStateChanged", self.lightStateChanged)
self.lightStateChanged(self.light_actuator_hwo.getState())
elif property == "icons":
icons_list = newValue.split()
try:
self.light_off_button.setIcon(Qt4_Icons.load_icon(icons_list[0]))
self.light_on_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
except IndexError:
pass
elif property == "mnemonic":
Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.propertyChanged(self, property, oldValue, newValue)
if self.motor_hwobj is not None:
if self.motor_hwobj.isReady():
limits = self.motor_hwobj.getLimits()
motor_range = float(limits[1] - limits[0])
self["delta"] = str(motor_range / 10.0)
else:
self["delta"] = 1.0
else:
Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.propertyChanged(self, property, oldValue, newValue)
示例2: centring_in_progress_changed
def centring_in_progress_changed(self, centring_in_progress):
if centring_in_progress:
self.manager_widget.create_point_start_button.setIcon(\
Qt4_Icons.load_icon("Delete"))
else:
self.manager_widget.create_point_start_button.setIcon(\
Qt4_Icons.load_icon("VCRPlay2"))
示例3: __init__
def __init__(self, parent, caption = '', minValue = 0, maxValue = 32768, step = 1, unit = ''):
"""Constructor
parent -- the parent QObject
caption -- a caption string (default: no caption)
minValue -- minimal accepted value (default: 0)
maxValue -- maximal accepted value (default: 32768)
step -- step (default: 1)
unit -- unit string is appended to the end of the displayed value (default: no string)"""
ProcedureEntryField.__init__(self, parent, caption)
box = QWidget(self)
self.spinbox = QSpinBox(minValue, maxValue, step, box)
self.spinbox.setSuffix(' ' + str(unit))
okCancelBox = QHBox(box)
okCancelBox.setSpacing(0)
okCancelBox.setMargin(0)
self.cmdOK = QPushButton(okCancelBox)
self.cmdCancel = QPushButton(okCancelBox)
self.cmdOK.setPixmap(Qt4_Icons.load('button_ok_small')) #QPixmap(Icons.okXPM))
self.cmdOK.setFixedSize(20, 20)
self.cmdCancel.setPixmap(Qt4_Icons.load('button_cancel_small')) #QPixmap(Icons.cancelXPM))
self.cmdCancel.setFixedSize(20, 20)
QObject.connect(self.cmdOK, SIGNAL('clicked()'), self.valueChanged)
QObject.connect(self.cmdCancel, SIGNAL('clicked()'), self.cancelClicked)
QObject.connect(self.spinbox, SIGNAL('valueChanged(int)'), self.valueChanging)
QHBoxLayout(box, 0, 5)
box.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
box.layout().addWidget(self.spinbox, 0, Qt.AlignLeft)
box.layout().addWidget(okCancelBox, 0, Qt.AlignLeft)
box.layout().addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))
self.setIsOk(False)
示例4: propertyChanged
def propertyChanged(self, property_name, old_value, new_value):
"""
Descript. :
"""
if property_name == 'ldapServer':
self.ldap_connection_hwobj = self.getHardwareObject(new_value)
elif property_name == 'codes':
self.setCodes(new_value)
elif property_name == 'localLogin':
self.local_login_hwobj = self.getHardwareObject(new_value)
elif property_name == 'dbConnection':
self.lims_hwobj = self.getHardwareObject(new_value)
elif property_name == 'instanceServer':
if self.instanceServer is not None:
self.disconnect(self.instanceServer, QtCore.SIGNAL('passControl'), self.passControl)
self.disconnect(self.instanceServer, QtCore.SIGNAL('haveControl'), self.haveControl)
self.instanceServer = self.getHardwareObject(new_value)
if self.instanceServer is not None:
self.connect(self.instanceServer, QtCore.SIGNAL('passControl'), self.passControl)
self.connect(self.instanceServer, QtCore.SIGNAL('haveControl'), self.haveControl)
elif property_name == 'icons':
icons_list = new_value.split()
try:
self.login_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[0])))
except IndexError:
pass
try:
self.logout_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[1])))
except IndexError:
pass
elif property_name == 'session':
self.session_hwobj = self.getHardwareObject(new_value)
else:
BlissWidget.propertyChanged(self, property_name, old_value, new_value)
示例5: addConnection
def addConnection(senderWindow, sender, connection):
newItem = QtGui.QTreeWidgetItem(self.connections_treewidget)
windowName = senderWindow["name"]
newItem.setText(1, windowName)
if sender != senderWindow:
# object-*
newItem.setText(2, sender["name"])
newItem.setText(4, connection["receiverWindow"])
try:
receiverWindow = self.configuration.windows[connection["receiverWindow"]]
except KeyError:
receiverWindow = {}
ok = False
else:
ok = True
if len(connection["receiver"]):
# *-object
newItem.setText(5, connection["receiver"])
ok = ok and receiverInWindow(connection["receiver"], receiverWindow)
if ok:
newItem.setIcon(0, QtGui.QIcon(Qt4_Icons.load('button_ok_small')))
else:
newItem.setIcon(0, QtGui.QIcon(Qt4_Icons.load('button_cancel_small')))
newItem.setText(3, connection['signal'])
newItem.setText(6, connection['slot'])
示例6: __init__
def __init__(self, *args):
Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.__init__(self, *args)
self.light_actuator_hwo = None
self.light_saved_pos=None
self.addProperty('light_actuator', 'string', '')
self.addProperty('icons', 'string', '')
self.addProperty('out_delta', 'string', '')
self.light_off_button=QPushButton(self.main_gbox)
self.light_off_button.setIcon(Qt4_Icons.load_icon('BulbDelete'))
self.light_off_button.setFixedSize(27, 27)
self.light_on_button=QPushButton(self.main_gbox)
self.light_on_button.setIcon(Qt4_Icons.load_icon('BulbCheck'))
self.light_on_button.setFixedSize(27, 27)
self.light_off_button.clicked.connect(self.lightButtonOffClicked)
self.light_on_button.clicked.connect(self.lightButtonOnClicked)
self._gbox_hbox_layout.addWidget(self.light_off_button)
self._gbox_hbox_layout.addWidget(self.light_on_button)
self.light_off_button.setToolTip("Switches off the light and sets the intensity to zero")
self.light_on_button.setToolTip("Switches on the light and sets the intensity back to the previous setting")
self.light_off_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
self.light_on_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
示例7: __init__
def __init__(self, parent=None):
"""
Descript. : parent (QTreeWidget) : Item's QTreeWidget parent.
"""
QtGui.QWidget.__init__(self, parent)
self.OK = QtGui.QToolButton(parent)
self.OK.setAutoRaise(True)
self.OK.setIcon(QtGui.QIcon(Qt4_Icons.load('button_ok_small'))) #QPixmap(Icons.tinyOK)))
self.Cancel = QtGui.QToolButton(parent)
self.Cancel.setAutoRaise(True)
self.Cancel.setIcon(QtGui.QIcon(Qt4_Icons.load('button_cancel_small'))) #QPixmap(Icons.tinyCancel)))
self.Reset = QtGui.QToolButton(parent)
self.Reset.setIcon(QtGui.QIcon(Qt4_Icons.load('button_default_small'))) #QPixmap(Icons.defaultXPM)))
self.Reset.setAutoRaise(True)
self.setEnabled(False)
main_layout = QtGui.QHBoxLayout()
main_layout.addWidget(self.OK)
main_layout.addWidget(self.Cancel)
main_layout.addWidget(self.Reset)
main_layout.setSpacing(0)
main_layout.setContentsMargins(0,0,0,0)
self.setLayout(main_layout)
示例8: __init__
def __init__(self, parent, caption = ''):
"""Constructor
parent -- the parent QObject
caption -- a caption string (default: no caption)"""
ProcedureEntryField.__init__(self, parent, caption)
box = QWidget(self)
self.savedValue = None
self.textbox = QLineEdit('', box)
okCancelBox = QHBox(box)
okCancelBox.setSpacing(0)
okCancelBox.setMargin(0)
self.cmdOK = QPushButton(okCancelBox)
self.cmdOK.setFixedSize(20, 20)
self.cmdCancel = QPushButton(okCancelBox)
self.cmdCancel.setFixedSize(20, 20)
self.cmdOK.setPixmap(Qt4_Icons.load('button_ok_small')) #QPixmap(Icons.okXPM))
self.cmdCancel.setPixmap(Qt4_Icons.load('button_cancel_small')) #QPixmap(Icons.cancelXPM))
QObject.connect(self.textbox, SIGNAL('textChanged( const QString & )'), self.valueChanging)
QObject.connect(self.textbox, SIGNAL('returnPressed()'), self.valueChanged)
QObject.connect(self.cmdOK, SIGNAL('clicked()'), self.valueChanged)
QObject.connect(self.cmdCancel, SIGNAL('clicked()'), self.cancelClicked)
self.cmdCancel.setEnabled(False)
self.cmdOK.setEnabled(True)
QHBoxLayout(box, 0, 5)
box.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
box.layout().addWidget(self.textbox, 0, Qt.AlignLeft)
box.layout().addWidget(okCancelBox, 0, Qt.AlignLeft)
box.layout().addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))
示例9: propertyChanged
def propertyChanged(self, property, oldValue, newValue):
if property == 'mnemonic':
if self.slitbox_hwobj is not None:
self.disconnect(self.slitbox_hwobj, QtCore.SIGNAL('gapSizeChanged'), self.gap_value_changed)
self.disconnect(self.slitbox_hwobj, QtCore.SIGNAL('statusChanged'), self.gap_status_changed)
self.disconnect(self.slitbox_hwobj, QtCore.SIGNAL('focModeChanged'), self.focModeChanged)
self.disconnect(self.slitbox_hwobj, QtCore.SIGNAL('gapLimitsChanged'), self.gapLimitsChanged)
self.slitbox_hwobj = self.getHardwareObject(newValue)
if self.slitbox_hwobj is not None:
self.connect(self.slitbox_hwobj, QtCore.SIGNAL('gapSizeChanged'), self.gap_value_changed)
self.connect(self.slitbox_hwobj, QtCore.SIGNAL('statusChanged'), self.gap_status_changed)
self.connect(self.slitbox_hwobj, QtCore.SIGNAL('focModeChanged'), self.focModeChanged)
self.connect(self.slitbox_hwobj, QtCore.SIGNAL('gapLimitsChanged'), self.gapLimitsChanged)
self.slitbox_hwobj.update_values()
self.slitBoxReady()
else:
self.slitBoxNotReady()
elif property == 'icons':
icons_list=newValue.split()
try:
self.set_hor_gap_button.setIcon(Qt4_Icons.load_icon(icons_list[0]))
self.set_ver_gap_button.setIcon(Qt4_Icons.load_icon(icons_list[0]))
self.stop_hor_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
self.stop_ver_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
except IndexError:
self.set_hor_gap_button.setText("Set")
self.set_ver_gap_button.setText("Set")
self.stop_hor_button.setText("Stop")
self.stop_ver_button.setText("Stop")
else:
BlissWidget.propertyChanged(self,property,oldValue,newValue)
示例10: __init__
def __init__(self, *args):
Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.__init__(self, *args)
self.light_actuator_hwo = None
self.light_saved_pos = None
self.addProperty("light_actuator", "string", "")
self.addProperty("icons", "string", "")
self.addProperty("out_delta", "string", "")
self.light_off_button = QtGui.QPushButton("", self.extra_button_box)
self.light_off_button.setIcon(Qt4_Icons.load_icon("BulbDelete"))
self.light_on_button = QtGui.QPushButton("", self.extra_button_box)
self.light_on_button.setIcon(Qt4_Icons.load_icon("BulbCheck"))
self.light_on_button.clicked.connect(self.lightButtonOffClicked)
self.light_off_button.clicked.connect(self.lightButtonOnClicked)
self.extra_button_box_layout.addWidget(self.light_off_button)
self.extra_button_box_layout.addWidget(self.light_on_button)
# self.position_spinbox.close()
# self.step_button.close()
# self.stop_button.close()
self.light_off_button.setToolTip("Switches off the light and sets the intensity to zero")
self.light_on_button.setToolTip("Switches on the light and sets the intensity back to the previous setting")
self.light_off_button.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
self.light_on_button.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
示例11: __init__
def __init__(self, *args):
BlissWidget.__init__(self, *args)
# Hardware objects ----------------------------------------------------
self.motor_hwobj = None
# Internal values -----------------------------------------------------
self.positions = None
# Properties ----------------------------------------------------------
self.addProperty('label','string','')
self.addProperty('mnemonic', 'string', '')
self.addProperty('icons', 'string', '')
self.addProperty('showMoveButtons', 'boolean', True)
# Signals -------------------------------------------------------------
# Slots ---------------------------------------------------------------
self.defineSlot('setEnabled',())
# Graphic elements ----------------------------------------------------
_group_box = QtGui.QGroupBox(self)
self.label = QtGui.QLabel("motor:", _group_box)
self.positions_combo = QtGui.QComboBox(_group_box)
self.previous_position_button = QtGui.QPushButton(_group_box)
self.next_position_button = QtGui.QPushButton(_group_box)
# Layout --------------------------------------------------------------
_group_box_hlayout = QtGui.QHBoxLayout(_group_box)
_group_box_hlayout.addWidget(self.label)
_group_box_hlayout.addWidget(self.positions_combo)
_group_box_hlayout.addWidget(self.previous_position_button)
_group_box_hlayout.addWidget(self.next_position_button)
_group_box_hlayout.setSpacing(2)
_group_box_hlayout.setContentsMargins(2, 2, 2, 2)
main_layout = QtGui.QHBoxLayout(self)
main_layout.addWidget(_group_box)
main_layout.setSpacing(0)
main_layout.setContentsMargins(0, 0, 0, 0)
# Size Policy ---------------------------------------------------------
#box1.setSizePolicy(QtGui.QSizePolicy.Fixed,
# QtGui.QSizePolicy.Fixed)
self.label.setSizePolicy(QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
#self.setSizePolicy(QtGui.QSizePolicy.Minimum,
# QtGui.QSizePolicy.Fixed)
# Qt signal/slot connections ------------------------------------------
self.positions_combo.activated.connect(self.position_selected)
self.previous_position_button.clicked.connect(self.select_previous_position)
self.next_position_button.clicked.connect(self.select_next_position)
# Other ---------------------------------------------------------------
self.positions_combo.setToolTip("Moves the motor to a predefined position")
self.previous_position_button.setIcon(Qt4_Icons.load_icon('Minus2'))
self.previous_position_button.setFixedWidth(27)
self.next_position_button.setIcon(Qt4_Icons.load_icon('Plus2'))
self.next_position_button.setFixedWidth(27)
示例12: propertyChanged
def propertyChanged(self, property_name, old_value, new_value):
if property_name == 'label':
if new_value == "" and self.motor_hwobj is not None:
self.label.setText("<i>" + self.motor_hwobj.username + ":</i>")
else:
self.label.setText(new_value)
elif property_name == 'mnemonic':
if self.motor_hwobj is not None:
self.disconnect(self.motor_hwobj,
'stateChanged',
self.motor_state_changed)
self.disconnect(self.motor_hwobj,
'newPredefinedPositions',
self.fill_positions)
self.disconnect(self.motor_hwobj,
'predefinedPositionChanged',
self.predefined_position_changed)
self.motor_hwobj = self.getHardwareObject(new_value)
if self.motor_hwobj is not None:
self.connect(self.motor_hwobj,
'newPredefinedPositions',
self.fill_positions)
self.connect(self.motor_hwobj,
'stateChanged',
self.motor_state_changed)
self.connect(self.motor_hwobj,
'predefinedPositionChanged',
self.predefined_position_changed)
self.fill_positions()
if self.motor_hwobj.isReady():
self.predefined_position_changed(self.motor_hwobj.getCurrentPositionName(), 0)
if self['label'] == "":
lbl=self.motor_hwobj.username
self.label.setText("<i>" + lbl + ":</i>")
Qt4_widget_colors.set_widget_color(self.positions_combo,
Qt4_MotorPredefPosBrick.STATE_COLORS[0],
QPalette.Button)
self.motor_state_changed(self.motor_hwobj.getState())
elif property_name == 'showMoveButtons':
if new_value:
self.previous_position_button.show()
self.next_position_button.show()
else:
self.previous_position_button.hide()
self.next_position_button.hide()
elif property_name == 'icons':
icons_list = new_value.split()
try:
self.previous_position_button.setIcon(\
Qt4_Icons.load_icon(icons_list[0]))
self.next_position_button.setIcon(\
Qt4_Icons.load_icon(icons_list[1]))
except:
pass
else:
BlissWidget.propertyChanged(self,property_name, old_value, new_value)
示例13: __init__
def __init__(self, parent):
"""
Descript. :
"""
QDialog.__init__(self, parent)
# Graphic elements-----------------------------------------------------
#self.main_gbox = QtGui.QGroupBox('Motor step', self)
#box2 = QtGui.QWidget(self)
self.grid = QWidget(self)
label1 = QLabel("Current:", self)
self.current_step = QLineEdit(self)
self.current_step.setEnabled(False)
label2 = QLabel("Set to:", self)
self.new_step = QLineEdit(self)
self.new_step.setAlignment(Qt.AlignRight)
self.new_step.setValidator(QDoubleValidator(self))
self.button_box = QWidget(self)
self.apply_button = QPushButton("Apply", self.button_box)
self.close_button = QPushButton("Dismiss", self.button_box)
# Layout --------------------------------------------------------------
self.button_box_layout = QHBoxLayout(self.button_box)
self.button_box_layout.addWidget(self.apply_button)
self.button_box_layout.addWidget(self.close_button)
self.grid_layout = QGridLayout(self.grid)
self.grid_layout.addWidget(label1, 0, 0)
self.grid_layout.addWidget(self.current_step, 0, 1)
self.grid_layout.addWidget(label2, 1, 0)
self.grid_layout.addWidget(self.new_step, 1, 1)
self.main_layout = QVBoxLayout(self)
self.main_layout.addWidget(self.grid)
self.main_layout.addWidget(self.button_box)
self.main_layout.setSpacing(0)
self.main_layout.setContentsMargins(0, 0, 0, 0)
# Qt signal/slot connections -----------------------------------------
self.new_step.returnPressed.connect(self.apply_clicked)
self.apply_button.clicked.connect(self.apply_clicked)
self.close_button.clicked.connect(self.accept)
# SizePolicies --------------------------------------------------------
self.close_button.setSizePolicy(QSizePolicy.Fixed,
QSizePolicy.Fixed)
self.setSizePolicy(QSizePolicy.Minimum,
QSizePolicy.Minimum)
# Other ---------------------------------------------------------------
self.setWindowTitle("Motor step editor")
self.apply_button.setIcon(Qt4_Icons.load_icon("Check"))
self.close_button.setIcon(Qt4_Icons.load_icon("Delete"))
示例14: set_icons
def set_icons(self, icon_run, icon_stop):
"""
Descript. :
Args. :
Return :
"""
self.run_icon = Qt4_Icons.load_icon(icon_run)
self.stop_icon = Qt4_Icons.load_icon(icon_stop)
if self.executing:
self.setIcon(self.stop_icon)
else:
self.setIcon(self.run_icon)
示例15: propertyChanged
def propertyChanged(self, property_name, old_value, new_value):
if property_name == 'mnemonic':
hwobj_names_list = new_value.split()
for hwobj_name in hwobj_names_list:
temp_motor_hwobj = self.getHardwareObject(hwobj_name)
temp_motor_widget = Qt4_MotorSpinBoxBrick(self)
temp_motor_widget.set_motor(temp_motor_hwobj, hwobj_name)
temp_motor_widget.move_left_button.setVisible(self['showMoveButtons'])
temp_motor_widget.move_right_button.setVisible(self['showMoveButtons'])
temp_motor_widget.step_button.setVisible(self['showStep'])
temp_motor_widget.stop_button.setVisible(self['showStop'])
temp_motor_widget.set_line_step(self['defaultStep'])
temp_motor_widget['defaultStep'] = self['defaultStep']
temp_motor_widget['delta'] = self['delta']
temp_motor_widget.step_changed(None)
self.main_groupbox_hlayout.addWidget(temp_motor_widget)
self.motor_hwobj_list.append(temp_motor_hwobj)
self.motor_widget_list.append(temp_motor_widget)
self.enable_motors_buttons.setVisible(self['showEnableButtons'])
self.disable_motors_buttons.setVisible(self['showEnableButtons'])
if self['showEnableButtons']:
self.main_groupbox_hlayout.addWidget(self.enable_motors_buttons)
self.main_groupbox_hlayout.addWidget(self.disable_motors_buttons)
if len(self.motor_widget_labels):
for index, label in enumerate(self.motor_widget_labels):
self.motor_widget_list[index].setLabel(label)
elif property_name == 'moveButtonIcons':
icon_list = new_value.split()
for index in range(len(icon_list) - 1):
if index % 2 == 0:
self.motor_widget_list[index / 2].move_left_button.setIcon(\
Qt4_Icons.load_icon(icon_list[index]))
self.motor_widget_list[index / 2].move_right_button.setIcon(\
Qt4_Icons.load_icon(icon_list[index + 1]))
elif property_name == 'labels':
self.motor_widget_labels = new_value.split()
if len(self.motor_widget_list):
for index, label in enumerate(self.motor_widget_labels):
self.motor_widget_list[index].setLabel(label)
elif property_name == 'predefinedPositions':
self.predefined_positions_list = new_value.split()
for predefined_position in self.predefined_positions_list:
temp_position_button = QtGui.QPushButton(predefined_position, self.main_group_box)
self.main_groupbox_hlayout.addWidget(temp_position_button)
temp_position_button.clicked.connect(lambda: \
self.predefined_position_clicked(predefined_position))
else:
BlissWidget.propertyChanged(self,property_name, old_value, new_value)