本文整理汇总了Python中PyQt4.Qt.QToolButton.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Python QToolButton.setIcon方法的具体用法?Python QToolButton.setIcon怎么用?Python QToolButton.setIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QToolButton
的用法示例。
在下文中一共展示了QToolButton.setIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createToolButton
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
def _createToolButton(self, widgetParams):
"""
Returns a tool button created using the custom parameters.
@param widgetParams: A list containing tool button parameters.
@type widgetParams: list
@see: L{self._createWidgetUsingParameters} where this method is called.
"""
buttonSize = QSize(32, 32) #@ FOR TEST ONLY
buttonParams = list(widgetParams)
buttonId = buttonParams[1]
buttonText = buttonParams[2]
buttonIconPath = buttonParams[3]
buttonToolTip = buttonParams[4]
buttonShortcut = buttonParams[5]
button = QToolButton(self)
button.setText(buttonText)
if buttonIconPath:
buttonIcon = geticon(buttonIconPath)
if not buttonIcon.isNull():
button.setIcon(buttonIcon)
button.setIconSize(QSize(22, 22))
button.setToolTip(buttonToolTip)
if buttonShortcut:
button.setShortcut(buttonShortcut)
button.setFixedSize(buttonSize) #@ Currently fixed to 32 x 32.
button.setCheckable(True)
return button
示例2: DateEdit
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
class DateEdit(QDateTimeEdit):
TOOLTIP = ''
LABEL = _('&Date:')
FMT = 'dd MMM yyyy hh:mm:ss'
ATTR = 'timestamp'
TWEAK = 'gui_timestamp_display_format'
def __init__(self, parent):
QDateTimeEdit.__init__(self, parent)
self.setToolTip(self.TOOLTIP)
self.setWhatsThis(self.TOOLTIP)
fmt = tweaks[self.TWEAK]
if fmt is None:
fmt = self.FMT
self.setDisplayFormat(fmt)
self.setCalendarPopup(True)
self.cw = CalendarWidget(self)
self.cw.setVerticalHeaderFormat(self.cw.NoVerticalHeader)
self.setCalendarWidget(self.cw)
self.setMinimumDateTime(UNDEFINED_QDATETIME)
self.setSpecialValueText(_('Undefined'))
self.clear_button = QToolButton(parent)
self.clear_button.setIcon(QIcon(I('trash.png')))
self.clear_button.setToolTip(_('Clear date'))
self.clear_button.clicked.connect(self.reset_date)
def reset_date(self, *args):
self.current_val = None
@dynamic_property
def current_val(self):
def fget(self):
return qt_to_dt(self.dateTime(), as_utc=False)
def fset(self, val):
if val is None:
val = UNDEFINED_DATE
else:
val = as_local_time(val)
self.setDateTime(val)
return property(fget=fget, fset=fset)
def initialize(self, db, id_):
self.current_val = getattr(db, self.ATTR)(id_, index_is_id=True)
self.original_val = self.current_val
def commit(self, db, id_):
if self.changed:
getattr(db, 'set_'+self.ATTR)(id_, self.current_val, commit=False,
notify=False)
return True
@property
def changed(self):
o, c = self.original_val, self.current_val
return o != c
示例3: create_color_button
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
def create_color_button(key, text):
b = ColorButton(data, key, text, self)
b.changed.connect(self.changed), l.addWidget(b)
bc = QToolButton(self)
bc.setIcon(QIcon(I('clear_left.png')))
bc.setToolTip(_('Remove color'))
bc.clicked.connect(b.clear)
h = QHBoxLayout()
h.addWidget(b), h.addWidget(bc)
return h
示例4: MovedDialog
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
class MovedDialog(QDialog): # {{{
def __init__(self, stats, location, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle(_("No library found"))
self._l = l = QGridLayout(self)
self.setLayout(l)
self.stats, self.location = stats, location
loc = self.oldloc = location.replace("/", os.sep)
self.header = QLabel(
_(
"No existing calibre library was found at %s. "
"If the library was moved, select its new location below. "
"Otherwise calibre will forget this library."
)
% loc
)
self.header.setWordWrap(True)
ncols = 2
l.addWidget(self.header, 0, 0, 1, ncols)
self.cl = QLabel("<br><b>" + _("New location of this library:"))
l.addWidget(self.cl, 1, 0, 1, ncols)
self.loc = QLineEdit(loc, self)
l.addWidget(self.loc, 2, 0, 1, 1)
self.cd = QToolButton(self)
self.cd.setIcon(QIcon(I("document_open.png")))
self.cd.clicked.connect(self.choose_dir)
l.addWidget(self.cd, 2, 1, 1, 1)
self.bb = QDialogButtonBox(QDialogButtonBox.Abort)
b = self.bb.addButton(_("Library moved"), self.bb.AcceptRole)
b.setIcon(QIcon(I("ok.png")))
b = self.bb.addButton(_("Forget library"), self.bb.RejectRole)
b.setIcon(QIcon(I("edit-clear.png")))
b.clicked.connect(self.forget_library)
self.bb.accepted.connect(self.accept)
self.bb.rejected.connect(self.reject)
l.addWidget(self.bb, 3, 0, 1, ncols)
self.resize(self.sizeHint() + QSize(100, 50))
def choose_dir(self):
d = choose_dir(self, "library moved choose new loc", _("New library location"), default_dir=self.oldloc)
if d is not None:
self.loc.setText(d)
def forget_library(self):
self.stats.remove(self.location)
def accept(self):
newloc = unicode(self.loc.text())
if not db_class.exists_at(newloc):
error_dialog(self, _("No library found"), _("No existing calibre library found at %s") % newloc, show=True)
return
self.stats.rename(self.location, newloc)
self.newloc = newloc
QDialog.accept(self)
示例5: MovedDialog
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
class MovedDialog(QDialog): # {{{
def __init__(self, stats, location, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle(_('No library found'))
self._l = l = QGridLayout(self)
self.setLayout(l)
self.stats, self.location = stats, location
loc = self.oldloc = location.replace('/', os.sep)
self.header = QLabel(_('No existing calibre library was found at %s. '
'If the library was moved, select its new location below. '
'Otherwise calibre will forget this library.')%loc)
self.header.setWordWrap(True)
ncols = 2
l.addWidget(self.header, 0, 0, 1, ncols)
self.cl = QLabel('<br><b>'+_('New location of this library:'))
l.addWidget(self.cl, 1, 0, 1, ncols)
self.loc = QLineEdit(loc, self)
l.addWidget(self.loc, 2, 0, 1, 1)
self.cd = QToolButton(self)
self.cd.setIcon(QIcon(I('document_open.png')))
self.cd.clicked.connect(self.choose_dir)
l.addWidget(self.cd, 2, 1, 1, 1)
self.bb = QDialogButtonBox(self)
b = self.bb.addButton(_('Library moved'), self.bb.AcceptRole)
b.setIcon(QIcon(I('ok.png')))
b = self.bb.addButton(_('Forget library'), self.bb.RejectRole)
b.setIcon(QIcon(I('edit-clear.png')))
self.bb.accepted.connect(self.accept)
self.bb.rejected.connect(self.reject)
l.addWidget(self.bb, 3, 0, 1, ncols)
self.resize(self.sizeHint() + QSize(100, 50))
def choose_dir(self):
d = choose_dir(self, 'library moved choose new loc',
_('New library location'), default_dir=self.oldloc)
if d is not None:
self.loc.setText(d)
def reject(self):
self.stats.remove(self.location)
QDialog.reject(self)
def accept(self):
newloc = unicode(self.loc.text())
if not LibraryDatabase2.exists_at(newloc):
error_dialog(self, _('No library found'),
_('No existing calibre library found at %s')%newloc,
show=True)
return
self.stats.rename(self.location, newloc)
self.newloc = newloc
QDialog.accept(self)
示例6: makeButton
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
def makeButton(self, label, callback=None, width=None, icon=None):
btn = QToolButton(self)
# btn.setAutoRaise(True)
label and btn.setText(label)
icon and btn.setIcon(icon)
# btn = QPushButton(label,self)
# btn.setFlat(True)
if width:
btn.setMinimumWidth(width)
btn.setMaximumWidth(width)
if icon:
btn.setIcon(icon)
if callback:
QObject.connect(btn, SIGNAL("clicked()"), callback)
return btn
示例7: MultipleWidget
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
class MultipleWidget(QWidget):
def __init__(self, parent):
QWidget.__init__(self, parent)
layout = QHBoxLayout()
layout.setSpacing(5)
layout.setContentsMargins(0, 0, 0, 0)
self.tags_box = EditWithComplete(parent)
layout.addWidget(self.tags_box, stretch=1000)
self.editor_button = QToolButton(self)
self.editor_button.setToolTip(_('Open Item Editor'))
self.editor_button.setIcon(QIcon(I('chapters.png')))
layout.addWidget(self.editor_button)
self.setLayout(layout)
def get_editor_button(self):
return self.editor_button
def update_items_cache(self, values):
self.tags_box.update_items_cache(values)
def clear(self):
self.tags_box.clear()
def setEditText(self):
self.tags_box.setEditText()
def addItem(self, itm):
self.tags_box.addItem(itm)
def set_separator(self, sep):
self.tags_box.set_separator(sep)
def set_add_separator(self, sep):
self.tags_box.set_add_separator(sep)
def set_space_before_sep(self, v):
self.tags_box.set_space_before_sep(v)
def setSizePolicy(self, v1, v2):
self.tags_box.setSizePolicy(v1, v2)
def setText(self, v):
self.tags_box.setText(v)
def text(self):
return self.tags_box.text()
示例8: __init__
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
def __init__(self, parent=None):
QFrame.__init__(self, parent)
self.setFocusPolicy(Qt.StrongFocus)
self.setAutoFillBackground(True)
self.capture = 0
self.setFrameShape(self.StyledPanel)
self.setFrameShadow(self.Raised)
self._layout = l = QGridLayout(self)
self.setLayout(l)
self.header = QLabel('')
l.addWidget(self.header, 0, 0, 1, 2)
self.use_default = QRadioButton('')
self.use_custom = QRadioButton(_('Custom'))
l.addWidget(self.use_default, 1, 0, 1, 3)
l.addWidget(self.use_custom, 2, 0, 1, 3)
self.use_custom.toggled.connect(self.custom_toggled)
off = 2
for which in (1, 2):
text = _('&Shortcut:') if which == 1 else _('&Alternate shortcut:')
la = QLabel(text)
la.setStyleSheet('QLabel { margin-left: 1.5em }')
l.addWidget(la, off+which, 0, 1, 3)
setattr(self, 'label%d'%which, la)
button = QPushButton(_('None'), self)
button.clicked.connect(partial(self.capture_clicked, which=which))
button.keyPressEvent = partial(self.key_press_event, which=which)
setattr(self, 'button%d'%which, button)
clear = QToolButton(self)
clear.setIcon(QIcon(I('clear_left.png')))
clear.clicked.connect(partial(self.clear_clicked, which=which))
setattr(self, 'clear%d'%which, clear)
l.addWidget(button, off+which, 1, 1, 1)
l.addWidget(clear, off+which, 2, 1, 1)
la.setBuddy(button)
self.done_button = doneb = QPushButton(_('Done'), self)
l.addWidget(doneb, 0, 2, 1, 1)
doneb.clicked.connect(lambda : self.editing_done.emit(self))
l.setColumnStretch(0, 100)
self.custom_toggled(False)
示例9: FontFamilyChooser
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
class FontFamilyChooser(QWidget):
family_changed = pyqtSignal(object)
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.l = l = QHBoxLayout()
l.setContentsMargins(0, 0, 0, 0)
self.setLayout(l)
self.button = QPushButton(self)
self.button.setIcon(QIcon(I('font.png')))
self.button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
l.addWidget(self.button)
self.default_text = _('Choose &font family')
self.font_family = None
self.button.clicked.connect(self.show_chooser)
self.clear_button = QToolButton(self)
self.clear_button.setIcon(QIcon(I('clear_left.png')))
self.clear_button.clicked.connect(self.clear_family)
l.addWidget(self.clear_button)
self.setToolTip = self.button.setToolTip
self.toolTip = self.button.toolTip
self.clear_button.setToolTip(_('Clear the font family'))
l.addStretch(1)
def clear_family(self):
self.font_family = None
@dynamic_property
def font_family(self):
def fget(self):
return self._current_family
def fset(self, val):
if not val:
val = None
self._current_family = val
self.button.setText(val or self.default_text)
self.family_changed.emit(val)
return property(fget=fget, fset=fset)
def show_chooser(self):
d = FontFamilyDialog(self.font_family, self)
if d.exec_() == d.Accepted:
self.font_family = d.font_family
示例10: __init__
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
class parameter_dialog_or_frame:
"""
use as a pre-mixin before QDialog or QFrame
"""
####@@@@
def __init__(self, parent = None, desc = None, name = None, modal = 0, fl = 0, env = None, type = "QDialog"):
if env is None:
import foundation.env as env # this is a little weird... probably it'll be ok, and logically it seems correct.
self.desc = desc
self.typ = type
if type == "QDialog":
QDialog.__init__(self,parent,name,modal,fl)
elif type == "QTextEdit":
QTextEdit.__init__(self, parent, name)
elif type == "QFrame":
QFrame.__init__(self,parent,name)
else:
print "don't know about type == %r" % (type,)
self.image1 = QPixmap()
self.image1.loadFromData(image1_data,"PNG") # should be: title_icon ####
self.image3 = QPixmap()
self.image3.loadFromData(image3_data,"PNG")
self.image4 = QPixmap()
self.image4.loadFromData(image4_data,"PNG")
self.image5 = QPixmap()
self.image5.loadFromData(image5_data,"PNG")
self.image6 = QPixmap()
self.image6.loadFromData(image6_data,"PNG")
self.image7 = QPixmap()
self.image7.loadFromData(image7_data,"PNG")
self.image0 = QPixmap(image0_data) # should be: border_icon ####
self.image2 = QPixmap(image2_data) # should be: sponsor_pixmap ####
try:
####@@@@
title_icon_name = self.desc.options.get('title_icon')
border_icon_name = self.desc.options.get('border_icon')
if title_icon_name:
self.image1 = imagename_to_pixmap(title_icon_name) ###@@@ pass icon_path
###@@@ import imagename_to_pixmap or use env function
# or let that func itself be an arg, or have an env arg for it
###e rename it icon_name_to_pixmap, or find_icon? (the latter only if it's ok if it returns an iconset)
###e use iconset instead?
if border_icon_name:
self.image0 = imagename_to_pixmap(border_icon_name)
except:
print_compact_traceback("bug in icon-setting code, using fallback icons: ")
pass
if not name:
self.setName("parameter_dialog_or_frame") ###
###k guess this will need: if type == 'QDialog'
self.setIcon(self.image0) # should be: border_icon ####
nanotube_dialogLayout = QVBoxLayout(self,0,0,"nanotube_dialogLayout")
self.heading_frame = QFrame(self,"heading_frame")
self.heading_frame.setPaletteBackgroundColor(QColor(122,122,122))
self.heading_frame.setFrameShape(QFrame.NoFrame)
self.heading_frame.setFrameShadow(QFrame.Plain)
heading_frameLayout = QHBoxLayout(self.heading_frame,0,3,"heading_frameLayout")
self.heading_pixmap = QLabel(self.heading_frame,"heading_pixmap")
self.heading_pixmap.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.heading_pixmap.sizePolicy().hasHeightForWidth()))
self.heading_pixmap.setPixmap(self.image1) # should be: title_icon ####
self.heading_pixmap.setScaledContents(1)
heading_frameLayout.addWidget(self.heading_pixmap)
self.heading_label = QLabel(self.heading_frame,"heading_label")
self.heading_label.setPaletteForegroundColor(QColor(255,255,255))
heading_label_font = QFont(self.heading_label.font())
heading_label_font.setPointSize(12)
heading_label_font.setBold(1)
self.heading_label.setFont(heading_label_font)
heading_frameLayout.addWidget(self.heading_label)
nanotube_dialogLayout.addWidget(self.heading_frame)
self.body_frame = QFrame(self,"body_frame")
self.body_frame.setFrameShape(QFrame.StyledPanel)
self.body_frame.setFrameShadow(QFrame.Raised)
body_frameLayout = QVBoxLayout(self.body_frame,3,3,"body_frameLayout")
self.sponsor_frame = QFrame(self.body_frame,"sponsor_frame")
self.sponsor_frame.setPaletteBackgroundColor(QColor(255,255,255))
self.sponsor_frame.setFrameShape(QFrame.StyledPanel)
self.sponsor_frame.setFrameShadow(QFrame.Raised)
sponsor_frameLayout = QHBoxLayout(self.sponsor_frame,0,0,"sponsor_frameLayout")
self.sponsor_btn = QPushButton(self.sponsor_frame,"sponsor_btn")
self.sponsor_btn.setAutoDefault(0) #bruce 060703 bugfix
self.sponsor_btn.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Preferred,0,0,self.sponsor_btn.sizePolicy().hasHeightForWidth()))
self.sponsor_btn.setPaletteBackgroundColor(QColor(255,255,255))
self.sponsor_btn.setPixmap(self.image2) # should be: sponsor_pixmap #### [also we'll need to support >1 sponsor]
self.sponsor_btn.setFlat(1)
sponsor_frameLayout.addWidget(self.sponsor_btn)
body_frameLayout.addWidget(self.sponsor_frame)
#.........这里部分代码省略.........
示例11: ConfigWidget
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
#.........这里部分代码省略.........
# ----------------------------- Column 1 -----------------------------
# ~~~~~~~~ Create the Custom fields options group box ~~~~~~~~
self.cfg_custom_fields_gb = QGroupBox(self)
self.cfg_custom_fields_gb.setTitle('Custom column assignments')
self.column1_layout.addWidget(self.cfg_custom_fields_gb)
self.cfg_custom_fields_qgl = QGridLayout(self.cfg_custom_fields_gb)
current_row = 0
# ++++++++ Labels + HLine ++++++++
self.marvin_source_label = QLabel("Marvin source")
self.cfg_custom_fields_qgl.addWidget(self.marvin_source_label, current_row, 0)
self.calibre_destination_label = QLabel("calibre destination")
self.cfg_custom_fields_qgl.addWidget(self.calibre_destination_label, current_row, 1)
current_row += 1
self.sd_hl = QFrame(self.cfg_custom_fields_gb)
self.sd_hl.setFrameShape(QFrame.HLine)
self.sd_hl.setFrameShadow(QFrame.Raised)
self.cfg_custom_fields_qgl.addWidget(self.sd_hl, current_row, 0, 1, 3)
current_row += 1
# ++++++++ Annotations ++++++++
self.cfg_annotations_label = QLabel('Annotations')
self.cfg_annotations_label.setAlignment(Qt.AlignLeft)
self.cfg_custom_fields_qgl.addWidget(self.cfg_annotations_label, current_row, 0)
self.annotations_field_comboBox = QComboBox(self.cfg_custom_fields_gb)
self.annotations_field_comboBox.setObjectName('annotations_field_comboBox')
self.annotations_field_comboBox.setToolTip('Select a custom column to store Marvin annotations')
self.cfg_custom_fields_qgl.addWidget(self.annotations_field_comboBox, current_row, 1)
self.cfg_highlights_wizard = QToolButton()
self.cfg_highlights_wizard.setIcon(QIcon(I('wizard.png')))
self.cfg_highlights_wizard.setToolTip("Create a custom column to store Marvin annotations")
self.cfg_highlights_wizard.clicked.connect(partial(self.launch_cc_wizard, 'Annotations'))
self.cfg_custom_fields_qgl.addWidget(self.cfg_highlights_wizard, current_row, 2)
current_row += 1
# ++++++++ Collections ++++++++
self.cfg_collections_label = QLabel('Collections')
self.cfg_collections_label.setAlignment(Qt.AlignLeft)
self.cfg_custom_fields_qgl.addWidget(self.cfg_collections_label, current_row, 0)
self.collection_field_comboBox = QComboBox(self.cfg_custom_fields_gb)
self.collection_field_comboBox.setObjectName('collection_field_comboBox')
self.collection_field_comboBox.setToolTip('Select a custom column to store Marvin collection assignments')
self.cfg_custom_fields_qgl.addWidget(self.collection_field_comboBox, current_row, 1)
self.cfg_collections_wizard = QToolButton()
self.cfg_collections_wizard.setIcon(QIcon(I('wizard.png')))
self.cfg_collections_wizard.setToolTip("Create a custom column for Marvin collection assignments")
self.cfg_collections_wizard.clicked.connect(partial(self.launch_cc_wizard, 'Collections'))
self.cfg_custom_fields_qgl.addWidget(self.cfg_collections_wizard, current_row, 2)
current_row += 1
# ++++++++ Last read ++++++++
self.cfg_date_read_label = QLabel("Last read")
self.cfg_date_read_label.setAlignment(Qt.AlignLeft)
self.cfg_custom_fields_qgl.addWidget(self.cfg_date_read_label, current_row, 0)
self.date_read_field_comboBox = QComboBox(self.cfg_custom_fields_gb)
self.date_read_field_comboBox.setObjectName('date_read_field_comboBox')
self.date_read_field_comboBox.setToolTip('Select a custom column to store Last read date')
self.cfg_custom_fields_qgl.addWidget(self.date_read_field_comboBox, current_row, 1)
示例12: __init__
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
def __init__(self, parent):
QWidget.__init__(self, parent)
self._layout = l = QHBoxLayout()
self.setLayout(self._layout)
self._layout.setContentsMargins(0,5,0,0)
x = QToolButton(self)
x.setText(_('Vi&rtual Library'))
x.setIcon(QIcon(I('lt.png')))
x.setObjectName("virtual_library")
x.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
l.addWidget(x)
parent.virtual_library = x
x = QToolButton(self)
x.setIcon(QIcon(I('minus.png')))
x.setObjectName('clear_vl')
l.addWidget(x)
x.setVisible(False)
x.setToolTip(_('Close the Virtual Library'))
parent.clear_vl = x
x = QLabel(self)
x.setObjectName("search_count")
l.addWidget(x)
parent.search_count = x
x.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
parent.advanced_search_button = x = QToolButton(self)
parent.advanced_search_toggle_action = ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('advanced search toggle',
_('Advanced search'), default_keys=(_("Shift+Ctrl+F"),),
action=ac)
ac.triggered.connect(x.click)
x.setIcon(QIcon(I('search.png')))
l.addWidget(x)
x.setToolTip(_("Advanced search"))
x = parent.search = SearchBox2(self)
x.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
x.setObjectName("search")
x.setToolTip(_("<p>Search the list of books by title, author, publisher, "
"tags, comments, etc.<br><br>Words separated by spaces are ANDed"))
x.setMinimumContentsLength(10)
l.addWidget(x)
self.search_button = QToolButton()
self.search_button.setToolButtonStyle(Qt.ToolButtonTextOnly)
self.search_button.setText(_('&Go!'))
l.addWidget(self.search_button)
self.search_button.setSizePolicy(QSizePolicy.Minimum,
QSizePolicy.Minimum)
self.search_button.clicked.connect(parent.do_search_button)
self.search_button.setToolTip(
_('Do Quick Search (you can also press the Enter key)'))
x = parent.clear_button = QToolButton(self)
x.setIcon(QIcon(I('clear_left.png')))
x.setObjectName("clear_button")
l.addWidget(x)
x.setToolTip(_("Reset Quick Search"))
x = parent.highlight_only_button = QToolButton(self)
x.setIcon(QIcon(I('arrow-down.png')))
l.addWidget(x)
x = parent.saved_search = SavedSearchBox(self)
x.setMaximumSize(QSize(150, 16777215))
x.setMinimumContentsLength(10)
x.setObjectName("saved_search")
l.addWidget(x)
x = parent.copy_search_button = QToolButton(self)
x.setIcon(QIcon(I("search_copy_saved.png")))
x.setObjectName("copy_search_button")
l.addWidget(x)
x.setToolTip(_("Copy current search text (instead of search name)"))
x = parent.save_search_button = QToolButton(self)
x.setIcon(QIcon(I("search_add_saved.png")))
x.setObjectName("save_search_button")
l.addWidget(x)
示例13: __init__
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
#.........这里部分代码省略.........
# log cycles control
lo1.setColumnStretch(1, 1)
self._wlogcycles_label = QLabel("Log cycles: ", self)
lo1.addWidget(self._wlogcycles_label, 0, 1)
# self._wlogcycles = QwtWheel(self)
# self._wlogcycles.setTotalAngle(360)
self._wlogcycles = QwtSlider(self)
self._wlogcycles.setToolTip(
"""<P>Use this to change the log-base for the logarithmic intensity transfer function (ITF).</P>""")
# This works around a stupid bug in QwtSliders -- see comments on histogram zoom wheel above
self._wlogcycles_timer = QTimer(self)
self._wlogcycles_timer.setSingleShot(True)
self._wlogcycles_timer.setInterval(500)
QObject.connect(self._wlogcycles_timer, SIGNAL("timeout()"), self._setIntensityLogCycles)
lo1.addWidget(self._wlogcycles, 1, 1)
self._wlogcycles.setRange(1., 10)
self._wlogcycles.setStep(0.1)
self._wlogcycles.setTracking(False)
QObject.connect(self._wlogcycles, SIGNAL("valueChanged(double)"), self._setIntensityLogCycles)
QObject.connect(self._wlogcycles, SIGNAL("sliderMoved(double)"), self._previewIntensityLogCycles)
self._updating_imap = False
# lock intensity map
lo1 = QHBoxLayout()
lo1.setContentsMargins(0, 0, 0, 0)
lo0.addLayout(lo1, 0)
# lo1.addWidget(QLabel("Lock range accross",self))
wlock = QCheckBox("Lock display range", self)
wlock.setToolTip("""<P>If checked, then the intensity range will be locked. The ranges of all locked images
change simultaneously.</P>""")
lo1.addWidget(wlock)
wlockall = QToolButton(self)
wlockall.setIcon(pixmaps.locked.icon())
wlockall.setText("Lock all to this")
wlockall.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
wlockall.setAutoRaise(True)
wlockall.setToolTip("""<P>Click this to lock together the intensity ranges of all images.</P>""")
lo1.addWidget(wlockall)
wunlockall = QToolButton(self)
wunlockall.setIcon(pixmaps.unlocked.icon())
wunlockall.setText("Unlock all")
wunlockall.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
wunlockall.setAutoRaise(True)
wunlockall.setToolTip("""<P>Click this to unlock the intensity ranges of all images.</P>""")
lo1.addWidget(wunlockall)
wlock.setChecked(self._rc.isDisplayRangeLocked())
QObject.connect(wlock, SIGNAL("clicked(bool)"), self._rc.lockDisplayRange)
QObject.connect(wlockall, SIGNAL("clicked()"),
self._currier.curry(self._imgman.lockAllDisplayRanges, self._rc))
QObject.connect(wunlockall, SIGNAL("clicked()"), self._imgman.unlockAllDisplayRanges)
QObject.connect(self._rc, SIGNAL("displayRangeLocked"), wlock.setChecked)
# self._wlock_imap_axis = [ QCheckBox(name,self) for iaxis,name,labels in sliced_axes ]
# for iw,w in enumerate(self._wlock_imap_axis):
# QObject.connect(w,SIGNAL("toggled(bool)"),self._currier.curry(self._rc.lockDisplayRangeForAxis,iw))
# lo1.addWidget(w,0)
lo1.addStretch(1)
# lo0.addWidget(Separator(self,"Colourmap"))
# color bar
self._colorbar = QwtPlot(self)
lo0.addWidget(self._colorbar)
self._colorbar.setAutoDelete(False)
self._colorbar.setMinimumHeight(32)
self._colorbar.enableAxis(QwtPlot.yLeft, False)
示例14: PM_Dialog
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
#.........这里部分代码省略.........
return
def _createTopRowBtns(self):
"""
Creates the Done, Cancel, Preview, Restore Defaults and What's This
buttons row at the top of the Property Manager.
"""
topBtnSize = QSize(22, 22) # button images should be 16 x 16, though.
# Main "button group" widget (but it is not a QButtonGroup).
self.pmTopRowBtns = QHBoxLayout()
# This QHBoxLayout is (probably) not necessary. Try using just the frame
# for the foundation. I think it should work. Mark 2007-05-30
# Horizontal spacer
horizontalSpacer = QSpacerItem(1, 1,
QSizePolicy.Expanding,
QSizePolicy.Minimum)
# Widget containing all the buttons.
self.topRowBtnsContainer = QWidget()
# Create Hbox layout for main frame.
topRowBtnsHLayout = QHBoxLayout(self.topRowBtnsContainer)
topRowBtnsHLayout.setMargin(PM_TOPROWBUTTONS_MARGIN)
topRowBtnsHLayout.setSpacing(PM_TOPROWBUTTONS_SPACING)
# Set to True to center align the buttons in the PM
if False: # Left aligns the buttons.
topRowBtnsHLayout.addItem(horizontalSpacer)
# Done (OK) button.
self.done_btn = QToolButton(self.topRowBtnsContainer)
self.done_btn.setIcon(
geticon("ui/actions/Properties Manager/Done_16x16.png"))
self.done_btn.setIconSize(topBtnSize)
self.done_btn.setAutoRaise(True)
self.connect(self.done_btn,
SIGNAL("clicked()"),
self.doneButtonClicked)
self.done_btn.setToolTip("Done")
topRowBtnsHLayout.addWidget(self.done_btn)
# Cancel (Abort) button.
self.cancel_btn = QToolButton(self.topRowBtnsContainer)
self.cancel_btn.setIcon(
geticon("ui/actions/Properties Manager/Abort_16x16.png"))
self.cancel_btn.setIconSize(topBtnSize)
self.cancel_btn.setAutoRaise(True)
self.connect(self.cancel_btn,
SIGNAL("clicked()"),
self.cancelButtonClicked)
self.cancel_btn.setToolTip("Cancel")
topRowBtnsHLayout.addWidget(self.cancel_btn)
#@ abort_btn deprecated. We still need it because modes use it.
self.abort_btn = self.cancel_btn
# Restore Defaults button.
self.restore_defaults_btn = QToolButton(self.topRowBtnsContainer)
self.restore_defaults_btn.setIcon(
geticon("ui/actions/Properties Manager/Restore_16x16.png"))
self.restore_defaults_btn.setIconSize(topBtnSize)
self.restore_defaults_btn.setAutoRaise(True)
示例15: MetadataSingleDialogBase
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setIcon [as 别名]
#.........这里部分代码省略.........
self.deduce_title_sort_button.setToolTip(
_('Automatically create the title sort entry based on the current '
'title entry.\nUsing this button to create title sort will '
'change title sort from red to green.'))
self.deduce_title_sort_button.setWhatsThis(
self.deduce_title_sort_button.toolTip())
self.title_sort = TitleSortEdit(self, self.title,
self.deduce_title_sort_button, self.languages)
self.basic_metadata_widgets.extend([self.title, self.title_sort])
self.deduce_author_sort_button = b = QToolButton(self)
b.setToolTip('<p>' +
_('Automatically create the author sort entry based on the current '
'author entry. Using this button to create author sort will '
'change author sort from red to green. There is a menu of '
'functions available under this button. Click and hold '
'on the button to see it.') + '</p>')
b.m = m = QMenu()
ac = m.addAction(QIcon(I('forward.png')), _('Set author sort from author'))
ac2 = m.addAction(QIcon(I('back.png')), _('Set author from author sort'))
ac3 = m.addAction(QIcon(I('user_profile.png')), _('Manage authors'))
ac4 = m.addAction(QIcon(I('next.png')),
_('Copy author to author sort'))
ac5 = m.addAction(QIcon(I('previous.png')),
_('Copy author sort to author'))
b.setMenu(m)
self.authors = AuthorsEdit(self, ac3)
self.author_sort = AuthorSortEdit(self, self.authors, b, self.db, ac,
ac2, ac4, ac5)
self.basic_metadata_widgets.extend([self.authors, self.author_sort])
self.swap_title_author_button = QToolButton(self)
self.swap_title_author_button.setIcon(QIcon(I('swap.png')))
self.swap_title_author_button.setToolTip(_(
'Swap the author and title'))
self.swap_title_author_button.clicked.connect(self.swap_title_author)
self.manage_authors_button = QToolButton(self)
self.manage_authors_button.setIcon(QIcon(I('user_profile.png')))
self.manage_authors_button.setToolTip('<p>' + _(
'Manage authors. Use to rename authors and correct '
'individual author\'s sort values') + '</p>')
self.manage_authors_button.clicked.connect(self.authors.manage_authors)
self.series = SeriesEdit(self)
self.clear_series_button = QToolButton(self)
self.clear_series_button.setToolTip(
_('Clear series'))
self.clear_series_button.clicked.connect(self.series.clear)
self.series_index = SeriesIndexEdit(self, self.series)
self.basic_metadata_widgets.extend([self.series, self.series_index])
self.formats_manager = FormatsManager(self, self.copy_fmt)
# We want formats changes to be committed before title/author, as
# otherwise we could have data loss if the title/author changed and the
# user was trying to add an extra file from the old books directory.
self.basic_metadata_widgets.insert(0, self.formats_manager)
self.formats_manager.metadata_from_format_button.clicked.connect(
self.metadata_from_format)
self.formats_manager.cover_from_format_button.clicked.connect(
self.cover_from_format)
self.cover = Cover(self)
self.cover.download_cover.connect(self.download_cover)
self.basic_metadata_widgets.append(self.cover)