本文整理汇总了Python中BlissFramework.Qt4_Icons.load_icon方法的典型用法代码示例。如果您正苦于以下问题:Python Qt4_Icons.load_icon方法的具体用法?Python Qt4_Icons.load_icon怎么用?Python Qt4_Icons.load_icon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlissFramework.Qt4_Icons
的用法示例。
在下文中一共展示了Qt4_Icons.load_icon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: propertyChanged
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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: propertyChanged
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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)
示例4: __init__
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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)
示例5: __init__
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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)
示例6: __init__
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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)
示例7: propertyChanged
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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)
示例8: set_icons
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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)
示例9: __init__
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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"))
示例10: propertyChanged
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
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)
示例11: propertyChanged
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
def propertyChanged(self, property_name, old_value, new_value):
"""
Descript. :
"""
if property_name == 'codes':
self.setCodes(new_value)
elif property_name == 'localLogin':
self.local_login_hwobj = self.getHardwareObject(new_value, optional=True)
elif property_name == 'dbConnection':
self.lims_hwobj = self.getHardwareObject(new_value)
self.login_as_user = self.lims_hwobj.get_login_type() == "user"
if self.login_as_user:
self.login_as_user_widget.show()
self.login_as_proposal_widget.hide()
else:
self.login_as_user_widget.hide()
self.login_as_proposal_widget.show()
elif property_name == 'instanceServer':
if self.instanceServer is not None:
self.disconnect(self.instanceServer,
'passControl',
self.passControl)
self.disconnect(self.instanceServer,
'haveControl',
self.haveControl)
self.instanceServer = self.getHardwareObject(new_value, optional=True)
if self.instanceServer is not None:
self.connect(self.instanceServer,
'passControl',
self.passControl)
self.connect(self.instanceServer,
'haveControl',
self.haveControl)
elif property_name == 'icons':
icons_list = new_value.split()
try:
self.login_button.setIcon(Qt4_Icons.load_icon(icons_list[0]))
except IndexError:
pass
try:
self.logout_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
except IndexError:
pass
elif property_name == 'session':
self.session_hwobj = self.getHardwareObject(new_value)
elif property_name == 'secondaryProposals':
self.secondary_proposals = new_value.split()
else:
BlissWidget.propertyChanged(self, property_name, old_value, new_value)
示例12: refresh_plate_location
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
def refresh_plate_location(self):
"""
Descript. :
"""
loaded_sample = self.plate_manipulator_hwobj.getLoadedSample()
new_location = self.plate_manipulator_hwobj.get_plate_location()
self.plate_navigator_cell.setEnabled(True)
if new_location and self.__current_location != new_location:
row = new_location[0]
col = new_location[1]
pos_x = new_location[2]
pos_y = new_location[3]
#pos_x *= self.plate_navigator_cell.width()
#pos_y *= self.plate_navigator_cell.height()
self.navigation_item.set_navigation_pos(pos_x, pos_y)
self.plate_navigator_cell.update()
if self.__current_location:
empty_item = QTableWidgetItem(QIcon(), "")
self.plate_navigator_table.setItem(self.__current_location[0],
self.__current_location[1],
empty_item)
new_item = QTableWidgetItem(Qt4_Icons.load_icon("sample_axis"), "")
self.plate_navigator_table.setItem(row, col, new_item)
self.__current_location = new_location
示例13: refresh_plate_location
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
def refresh_plate_location(self):
"""
Descript. :
"""
loaded_sample = self.plate_manipulator_hwobj.getLoadedSample()
new_location = self.plate_manipulator_hwobj.get_current_location()
if self.current_location != new_location:
#self.plate_widget.navigation_label_painter.setBrush(.QBrush(qt.QWidget.white, qt.Qt.SolidPattern))
#for drop_index in range(self.num_drops):
# pos_y = float(drop_index + 1) / (self.num_drops + 1) * \
# self.plate_widget.navigation_graphicsview.height()
# self.navigation_graphicsscene.drawLine(58, pos_y - 2, 62, pos_y + 2)
# self.navigation_graphicsscene.drawLine(62, pos_y - 2, 58, pos_y + 2)
if new_location:
row = new_location[0]
col = new_location[1]
pos_x = new_location[2]
pos_y = new_location[3]
self.plate_widget.current_location_ledit.setText(\
"Col: %d Row: %d X: %.2f Y: %.2f" % (col, row, pos_x, pos_y))
pos_x *= self.plate_widget.navigation_graphicsview.width()
pos_y *= self.plate_widget.navigation_graphicsview.height()
self.navigation_item.set_navigation_pos(pos_x, pos_y)
self.navigation_graphicsscene.update()
if self.current_location:
empty_item = QtGui.QTableWidgetItem("")
# QtGui.QTableWidget.Item.Never)
self.plate_widget.sample_table.setItem(self.current_location[0],
self.current_location[1],
empty_item)
new_item = QtGui.QTableWidgetItem(Qt4_Icons.load_icon("sample_axis.png"), "")
self.plate_widget.sample_table.setItem(row, col, new_item)
self.current_location = new_location
示例14: __init__
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
def __init__(self, *args):
QWidget.__init__(self, *args)
self.value_plot = None
self.title_label = QLabel(self)
self.value_widget = QWidget(self)
self.value_label = QLabel(self.value_widget)
self.value_label.setAlignment(Qt.AlignCenter)
self.history_button = QPushButton(\
Qt4_Icons.load_icon("LineGraph"), "", self.value_widget)
self.history_button.hide()
self.history_button.setFixedWidth(22)
self.history_button.setFixedHeight(22)
_value_widget_hlayout = QHBoxLayout(self.value_widget)
_value_widget_hlayout.addWidget(self.value_label)
_value_widget_hlayout.addWidget(self.history_button)
_value_widget_hlayout.setSpacing(2)
_value_widget_hlayout.setContentsMargins(0, 0, 0, 0)
self.main_vlayout = QVBoxLayout(self)
self.main_vlayout.addWidget(self.title_label)
self.main_vlayout.addWidget(self.value_widget)
self.main_vlayout.setSpacing(1)
self.main_vlayout.setContentsMargins(0, 0, 0, 0)
self.history_button.clicked.connect(self.open_history_view)
示例15: __init__
# 需要导入模块: from BlissFramework import Qt4_Icons [as 别名]
# 或者: from BlissFramework.Qt4_Icons import load_icon [as 别名]
def __init__(self, parent):
"""
Descript. :
"""
QWidget.__init__(self, parent)
self.home_url = None
self.navigation_bar = QWidget(self)
self.url_ledit = QLineEdit(self.navigation_bar)
self.url_ledit.setReadOnly(True)
self.home_button = QPushButton(self.navigation_bar)
self.back_button = QPushButton(self.navigation_bar)
self.forward_button = QPushButton(self.navigation_bar)
self.home_button.setIcon(Qt4_Icons.load_icon("Home2"))
self.back_button.setIcon(Qt4_Icons.load_icon("Left2"))
self.forward_button.setIcon(Qt4_Icons.load_icon("Right2"))
if QWEBVIEW_AVAILABLE:
self.web_page_viewer = QWebView(self)
self.web_page_viewer.settings().setObjectCacheCapacities(0,0,0)
else:
self.web_page_viewer = QTextBrowser(self)
_navigation_bar_hlayout = QHBoxLayout(self.navigation_bar)
_navigation_bar_hlayout.addWidget(self.home_button)
_navigation_bar_hlayout.addWidget(self.back_button)
_navigation_bar_hlayout.addWidget(self.forward_button)
_navigation_bar_hlayout.addWidget(self.url_ledit)
_navigation_bar_hlayout.setSpacing(2)
_navigation_bar_hlayout.setContentsMargins(2, 2, 2, 2)
_main_vlayout = QVBoxLayout(self)
_main_vlayout.addWidget(self.navigation_bar)
_main_vlayout.addWidget(self.web_page_viewer)
_main_vlayout.setSpacing(2)
_main_vlayout.setContentsMargins(2, 2, 2, 2)
self.web_page_viewer.setSizePolicy(QSizePolicy.Expanding,
QSizePolicy.Expanding)
self.home_button.clicked.connect(self.go_to_home_page)
self.back_button.clicked.connect(self.go_back)
self.forward_button.clicked.connect(self.go_forward)