本文整理汇总了Python中PyQt4.QtGui.QGroupBox.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QGroupBox.setToolTip方法的具体用法?Python QGroupBox.setToolTip怎么用?Python QGroupBox.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGroupBox
的用法示例。
在下文中一共展示了QGroupBox.setToolTip方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_field
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setToolTip [as 别名]
def _build_field(self):
#build option
if self.option.is_compound:
#make container
container = QGroupBox(self.title, self.parent)
container.setToolTip(self.option.formatted_desc)
layout = QGridLayout(container)
self._addRow(container, self.parent.layout())
#make option
if not self.option.is_poly or self.value_required or self.field is not None:
field = dict((opt.name, Field(opt, container)) for opt in self.option.options)
self._add_or_set('container', container)
self._add_or_set('field', field)
#add +/- buttons if poly-option
if self.option.is_poly:
new_row = layout.rowCount()
if self.field is not None and len(self.field) > int(self.value_required):
del_button = QPushButton('-', container)
del_button.setToolTip('Delete this %s' % self.title)
del_option_gui = trigger(self._del_instance, self.field[-1], self.container[-1])
del_button.clicked.connect(del_option_gui)
layout.addWidget(del_button, new_row, 0)
add_button = QPushButton('+', container)
add_button.setToolTip('Add another %s' % self.title)
add_button.clicked.connect(self._add_instance)
layout.addWidget(add_button, new_row, 1)
else:
field = self._make_simple_field(self.option, self.parent)
self._add_or_set('field', field)
示例2: create_fontgroup
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setToolTip [as 别名]
def create_fontgroup(self, option=None, text=None,
tip=None, fontfilters=None):
"""Option=None -> setting plugin font"""
fontlabel = QLabel(_("Font: "))
fontbox = QFontComboBox()
if fontfilters is not None:
fontbox.setFontFilters(fontfilters)
sizelabel = QLabel(" "+_("Size: "))
sizebox = QSpinBox()
sizebox.setRange(7, 100)
self.fontboxes[(fontbox, sizebox)] = option
layout = QHBoxLayout()
for subwidget in (fontlabel, fontbox, sizelabel, sizebox):
layout.addWidget(subwidget)
layout.addStretch(1)
if text is None:
text = _("Font style")
group = QGroupBox(text)
group.setLayout(layout)
if tip is not None:
group.setToolTip(tip)
return group
示例3: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setToolTip [as 别名]
class Main(plugin.Plugin):
' main class for plugin '
def initialize(self, *args, **kwargs):
' class init '
super(Main, self).initialize(*args, **kwargs)
self.group0 = QGroupBox()
self.group0.setTitle(' Options ')
self.group0.setCheckable(True)
self.group0.toggled.connect(lambda: self.group0.hide())
self.spin1, self.spin2, self.spin3 = QSpinBox(), QSpinBox(), QSpinBox()
self.spin4, self.spin5, self.spin6 = QSpinBox(), QSpinBox(), QSpinBox()
self.spin7, self.spin8, self.spin9 = QSpinBox(), QSpinBox(), QSpinBox()
self.spin10, self.output = QSpinBox(), QTextEdit()
self.reset = QPushButton(QIcon.fromTheme("face-smile"), 'Reset Options')
self.reset.clicked.connect(self.reset_options)
self.reset_options()
self.output.setReadOnly(True)
vboxg3 = QVBoxLayout(self.group0)
for each_widget in (QLabel('<b>Max Attributes Per Class:'), self.spin1,
QLabel('<b>Max Methods Per Class:'), self.spin2,
QLabel('<b>Max Functions Per File:'), self.spin3,
QLabel('<b>Max Classes Per File:'), self.spin4,
QLabel('<b>Max Parameters Per Function:'), self.spin5,
QLabel('<b>Max Lines Per Function:'), self.spin6,
QLabel('<b>Max ControlStatements Per Function:'), self.spin7,
QLabel('<b>Max Lines Per File:'), self.spin8,
QLabel('<b>Max Indentation Levels:'), self.spin9,
QLabel('<b>Max Tabs:'), self.spin10, self.reset):
vboxg3.addWidget(each_widget)
self.group1, self.auto = QGroupBox(), QComboBox()
self.group1.setTitle(' Automation ')
self.group1.setCheckable(True)
self.group1.setToolTip('<font color="red"><b>WARNING:Advanced Setting!')
self.group1.toggled.connect(lambda: self.group1.hide())
self.auto.addItems(['Never run automatically', 'Run when File Saved',
'Run when File Executed', 'Run when Tab Changed',
'Run when File Opened', 'Run before File Saved'])
self.auto.currentIndexChanged.connect(self.on_auto_changed)
QVBoxLayout(self.group1).addWidget(self.auto)
self.button = QPushButton(' Analyze for Best Practice ')
self.button.setMinimumSize(75, 50)
self.button.clicked.connect(self.run)
glow = QGraphicsDropShadowEffect(self)
glow.setOffset(0)
glow.setBlurRadius(99)
glow.setColor(QColor(99, 255, 255))
self.button.setGraphicsEffect(glow)
class TransientWidget(QWidget):
' persistant widget thingy '
def __init__(self, widget_list):
' init sub class '
super(TransientWidget, self).__init__()
vbox = QVBoxLayout(self)
for each_widget in widget_list:
vbox.addWidget(each_widget)
tw = TransientWidget((QLabel('<i>Best Practice analyzer'),
self.group0, self.group1, QLabel('<b>Best Practice Errors:'),
self.output, self.button))
self.scrollable, self.dock = QScrollArea(), QDockWidget()
self.scrollable.setWidgetResizable(True)
self.scrollable.setWidget(tw)
self.dock.setWindowTitle(__doc__)
self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
self.dock.setWidget(self.scrollable)
ExplorerContainer().addTab(self.dock, "Check")
QPushButton(QIcon.fromTheme("help-about"), 'About', self.dock
).clicked.connect(lambda:
QMessageBox.information(self.dock, __doc__, HELPMSG))
def run(self):
' run the actions '
global MAXVAL
self.output.clear()
self.button.setDisabled(True)
maxvalues = {'maxAttributesPerClass': int(self.spin1.value()),
'maxFunctionsPerClass': int(self.spin2.value()),
'maxFunctionsPerFile': int(self.spin3.value()),
'maxClassesPerFile': int(self.spin4.value()),
'maxParametersPerFunction': int(self.spin5.value()),
'maxLinesPerFunction': int(self.spin6.value()),
'maxControlStatementsPerFunction': int(self.spin7.value()),
'maxLinesPerFile': int(self.spin8.value()),
'maxIndentationLevel': int(self.spin9.value()),
'maxTabs': int(self.spin10.value())}
MAXVAL = maxvalues
self.output.append(SimplePythonChecker().analyze(str(
self.locator.get_service("editor").get_opened_documents()[
self.locator.get_service("editor").get_tab_manager().currentIndex()
]), maxvalues))
self.output.setFocus()
self.button.setEnabled(True)
def on_auto_changed(self):
' automation connects '
if self.auto.currentIndex() is 1:
self.locator.get_service('editor').fileSaved.connect(lambda:
#.........这里部分代码省略.........
示例4: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setToolTip [as 别名]
class Main(plugin.Plugin):
' main class for plugin '
def initialize(self, *args, **kwargs):
' class init '
super(Main, self).initialize(*args, **kwargs)
self.process = QProcess()
self.process.readyReadStandardOutput.connect(self.readOutput)
self.process.readyReadStandardError.connect(self.readErrors)
self.process.finished.connect(self._process_finished)
self.process.error.connect(self._process_finished)
# directory auto completer
self.completer, self.dirs = QCompleter(self), QDirModel(self)
self.dirs.setFilter(QDir.Dirs | QDir.NoDotAndDotDot)
self.completer.setModel(self.dirs)
self.completer.setCaseSensitivity(Qt.CaseInsensitive)
self.completer.setCompletionMode(QCompleter.PopupCompletion)
menu = QMenu('Clones')
menu.addAction('Analyze for Code Clones here', lambda: self.make_clon())
self.locator.get_service('explorer').add_project_menu(menu, lang='all')
self.group1 = QGroupBox()
self.group1.setTitle(' Target ')
self.outdir, self.igndir = QLineEdit(path.expanduser("~")), QLineEdit()
self.outdir.setCompleter(self.completer)
self.btn1 = QPushButton(QIcon.fromTheme("document-open"), ' Open ')
self.btn1.clicked.connect(lambda: self.outdir.setText(str(
QFileDialog.getExistingDirectory(self.dock,
'Please, Open a Target Directory...', path.expanduser("~")))))
self.btn1a = QPushButton(QIcon.fromTheme("face-smile"),
'Get from Ninja active project')
self.btn1a.clicked.connect(lambda: self.outdir.setText(
self.locator.get_service('explorer').get_current_project_item().path))
self.ignckb, self.ignmor = QComboBox(), QTextEdit()
self.ignckb.addItems(['Single Directory', 'Multiple Directories CSV'])
self.ignckb.currentIndexChanged.connect(self.on_ignore_changed)
self.ignmor.hide()
self.igndir.setPlaceholderText('Exclude directory')
self.igndir.setCompleter(self.completer)
self.btn2 = QPushButton(QIcon.fromTheme("document-open"), ' Open ')
self.btn2.clicked.connect(lambda: self.igndir.setText(str(
QFileDialog.getExistingDirectory(self.dock,
'Please, Open a Ignore Directory...', path.expanduser("~")))))
vboxg1 = QVBoxLayout(self.group1)
for each_widget in (QLabel('<b>Target directory path: '), self.outdir,
self.btn1, self.btn1a, QLabel('<b>Ignore directory path: '),
self.ignckb, self.ignmor, self.igndir, self.btn2, ):
vboxg1.addWidget(each_widget)
self.group2 = QGroupBox()
self.group2.setTitle(' Output ')
self.outfle = QLineEdit(path.join(path.expanduser("~"), 'output.html'))
self.outfle.setPlaceholderText('Exclude directory')
self.outfle.setCompleter(self.completer)
self.btn3 = QPushButton(QIcon.fromTheme("document-save"), ' Save ')
self.btn3.clicked.connect(lambda: self.outfle.setText(
QFileDialog.getSaveFileName(self.dock, 'Save', path.expanduser("~"),
'XML(*.xml)' if self.xmlo.isChecked() is True else 'HTML(*.html)')))
vboxg2 = QVBoxLayout(self.group2)
for each_widget in (QLabel('<b>Output report file path:'),
self.outfle, self.btn3):
vboxg2.addWidget(each_widget)
self.group3 = QGroupBox()
self.group3.setTitle(' Options ')
self.group3.setCheckable(True)
self.group3.setGraphicsEffect(QGraphicsBlurEffect(self))
self.group3.graphicsEffect().setEnabled(False)
self.group3.toggled.connect(self.toggle_options_group)
self.qckb1, self.qckb2 = QCheckBox('Recursive'), QCheckBox('Time-less')
self.qckb3, self.qckb4 = QCheckBox('Force Diff'), QCheckBox('Fast Mode')
self.qckb5, self.tm = QCheckBox('Save a LOG file to target'), QLabel('')
self.xmlo = QCheckBox('XML Output instead of HTML')
self.opeo = QCheckBox('Open Clones Report when done')
self.chrt = QCheckBox('LOW CPU priority for Backend Process')
self.mdist, self.hdep, self.output = QSpinBox(), QSpinBox(), QTextEdit()
self.ign_func = QLineEdit('test, forward, backward, Migration')
self.mdist.setValue(5)
self.hdep.setValue(1)
self.mdist.setToolTip('''<b>Maximum amount of difference between pair of
sequences in clone pair (5 default).Larger value more false positive''')
self.hdep.setToolTip('''<b>Computation can be speeded up by increasing
this value, but some clones can be missed (1 default)''')
[a.setChecked(True) for a in (self.qckb1, self.qckb3, self.qckb5,
self.chrt, self.opeo)]
vboxg3 = QVBoxLayout(self.group3)
for each_widget in (self.qckb1, self.qckb2, self.qckb3, self.qckb4,
self.qckb5, self.chrt, self.xmlo, self.opeo,
QLabel('<b>Max Distance Threshold:'), self.mdist,
QLabel('<b>Max Hashing Depth:'), self.hdep,
QLabel('<b>Ignore code block prefix:'), self.ign_func):
vboxg3.addWidget(each_widget)
self.group4, self.auto = QGroupBox(), QComboBox()
self.group4.setTitle(' Automation ')
self.group4.setCheckable(True)
self.group4.setToolTip('<font color="red"><b>WARNING:Advanced Setting!')
self.group4.toggled.connect(lambda: self.group4.hide())
self.auto.addItems(['Never run automatically', 'Run when File Saved',
#.........这里部分代码省略.........
示例5: RatingWidget
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setToolTip [as 别名]
class RatingWidget(QWidget):
"""
Last panel. Gives point cost of idea set and lists any penalty flags.
"""
def __init__(self, parent=None):
super().__init__(parent=parent)
# cost display
self.cost = QGroupBox("National ideas")
costLayout = QFormLayout()
self.costRating = QLineEdit()
self.costRating.setReadOnly(True)
costLayout.addRow(QLabel("Rating:"), self.costRating)
self.costDisplay = QLineEdit()
self.costDisplay.setReadOnly(True)
costLayout.addRow(QLabel("Cost:"), self.costDisplay)
possibleRatings = QGroupBox("Possible ratings")
possibleRatingsLayout = QFormLayout()
for cost, rating in ideaRatings:
if cost is not None:
possibleRatingsLayout.addRow(QLabel("Up to %0.1f:" % (cost),), QLabel(rating))
else:
possibleRatingsLayout.addRow(QLabel("Above:"), QLabel(rating))
possibleRatings.setLayout(possibleRatingsLayout)
costLayout.addRow(possibleRatings)
breakdown = QGroupBox("Breakdown")
breakdownLayout = QFormLayout()
self.breakdownLabels = []
self.breakdownCosts = []
for i in range(9):
breakdownLabel = QLabel()
self.breakdownLabels.append(breakdownLabel)
breakdownCost = QLineEdit()
breakdownCost.setReadOnly(True)
self.breakdownCosts.append(breakdownCost)
breakdownLayout.addRow(breakdownLabel, breakdownCost)
breakdown.setLayout(breakdownLayout)
costLayout.addRow(breakdown)
self.cost.setLayout(costLayout)
self.cost.setToolTip(costToolTipText)
# penalty display
self.penalties = QGroupBox("Penalties")
penaltiesLayout = QFormLayout()
# self.penaltiesRating = QLineEdit()
# self.penaltiesRating.setReadOnly(True)
# penaltiesLayout.addRow(QLabel("Rating:"), self.penaltiesRating)
self.yellowCardCount = QLineEdit()
self.yellowCardCount.setReadOnly(True)
penaltiesLayout.addRow(QLabel("Yellow cards:"), self.yellowCardCount)
self.yellowCardDisplay = QListView()
self.yellowCardDisplay.setSelectionMode(QAbstractItemView.NoSelection)
self.yellowCards = QStringListModel()
self.yellowCardDisplay.setModel(self.yellowCards)
penaltiesLayout.addRow(self.yellowCardDisplay)
self.redCardCount = QLineEdit()
self.redCardCount.setReadOnly(True)
penaltiesLayout.addRow(QLabel("Red cards:"), self.redCardCount)
self.redCardDisplay = QListView()
self.redCardDisplay.setSelectionMode(QAbstractItemView.NoSelection)
self.redCards = QStringListModel()
self.redCardDisplay.setModel(self.redCards)
penaltiesLayout.addRow(self.redCardDisplay)
self.penalties.setLayout(penaltiesLayout)
self.penalties.setToolTip(penaltiesToolTipText)
layout = QHBoxLayout()
layout.addWidget(self.cost)
layout.addWidget(self.penalties)
self.setLayout(layout)
def handleCostChanged(self, costs):
totalCost = sum(costs)
self.costDisplay.setText("%0.2f" % (totalCost,))
self.costRating.setText(getIdeaRating(totalCost))
for i, cost in enumerate(costs):
self.breakdownCosts[i].setText("%0.2f" % cost)
def handleIdeaNamesChanged(self, names):
for i, name in enumerate(names):
self.breakdownLabels[i].setText(name)
#.........这里部分代码省略.........
示例6: Ui_option
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setToolTip [as 别名]
class Ui_option(object):
def createLine(self):
line = QFrame()
line.setFrameShape(QFrame.HLine)
line.setFrameShadow(QFrame.Sunken)
return line
def createSquareLabel(self):
label = QLabel()
label.setEnabled(False)
label.setFixedSize(24, 24)
label.setFrameShape(QFrame.StyledPanel)
return label
def addVerticalStretch(self, page_layout):
vert_spacer = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Expanding)
page_layout.addItem(vert_spacer, page_layout.rowCount(), 0, 1, page_layout.columnCount())
def createConnSection(self, page_layout, label, combobox, num_column):
conn_layout = QHBoxLayout()
conn_layout.setSpacing(5)
conn_layout.setContentsMargins(0, 0, 0, 0)
conn_layout.addWidget(label)
conn_layout.addItem(QSpacerItem(40, 20, QSizePolicy.Fixed, QSizePolicy.Minimum))
conn_layout.addWidget(combobox, 1)
page_layout.addLayout(conn_layout, page_layout.rowCount(), 0, 1, num_column)
page_layout.addWidget(self.createLine(), page_layout.rowCount(), 0, 1, num_column)
vert_spacer = QSpacerItem(20, 20, QSizePolicy.Fixed, QSizePolicy.Fixed)
page_layout.addItem(vert_spacer, page_layout.rowCount(), 0, 1, num_column)
def createConnPage(self):
self.conn_page = QWidget()
self.conn_page.setObjectName("conn_page")
self.conn_page.setToolTip(QApplication.translate("option",
"<b>Add/Modify/Delete a connection for a MUD server.</b>"
"<p>Set the IP or hostname and the port of the MUD server.<br/>"
"You have to define a connection to use all the functionality "
"related (accounts, aliases, macros and triggers).</p>"))
page_layout = QGridLayout(self.conn_page)
page_layout.setSpacing(7)
page_layout.setContentsMargins(10, 20, 0, 10)
page_layout.setColumnMinimumWidth(0, 100)
self.label_conn = QLabel()
self.label_conn.setText(QApplication.translate("option", "Connection"))
page_layout.addWidget(self.label_conn, 0, 0)
self.list_conn = QComboBox()
self.list_conn.addItem(QApplication.translate("option", "Create New"))
page_layout.addWidget(self.list_conn, 0, 1, 1, 2)
self.label_name_conn = QLabel()
self.label_name_conn.setText(QApplication.translate("option", "Name"))
page_layout.addWidget(self.label_name_conn, 1, 0)
self.name_conn = QLineEdit()
page_layout.addWidget(self.name_conn, 1, 1, 1, 2)
self.label_host_conn = QLabel()
self.label_host_conn.setText(QApplication.translate("option", "Host"))
page_layout.addWidget(self.label_host_conn, 2, 0)
self.host_conn = QLineEdit()
page_layout.addWidget(self.host_conn, 2, 1, 1, 2)
self.label_port_conn = QLabel()
self.label_port_conn.setText(QApplication.translate("option", "Port"))
page_layout.addWidget(self.label_port_conn, 3, 0)
page_layout.addItem(QSpacerItem(80, 20), 3, 1) # horizontal spacer
self.port_conn = QLineEdit()
self.port_conn.setMaxLength(8)
page_layout.addWidget(self.port_conn, 3, 2)
vert_spacer = QSpacerItem(271,20,QSizePolicy.Minimum,QSizePolicy.Fixed)
page_layout.addItem(vert_spacer, 4, 0, 1, 3)
buttons_box = QHBoxLayout()
buttons_box.setSpacing(5)
buttons_box.setContentsMargins(0, 0, 0, 0)
self.save_conn = QPushButton()
self.save_conn.setFixedHeight(28)
self.save_conn.setIcon(QIcon(":/images/button-save.png"))
self.save_conn.setText(QApplication.translate("option", "Save"))
buttons_box.addWidget(self.save_conn)
self.delete_conn = QPushButton()
self.delete_conn.setFixedHeight(28)
self.delete_conn.setIcon(QIcon(":/images/button-cancel.png"))
self.delete_conn.setText(QApplication.translate("option", "Delete"))
buttons_box.addWidget(self.delete_conn)
page_layout.addLayout(buttons_box, 5, 0, 1, 3, Qt.AlignRight)
self.addVerticalStretch(page_layout)
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setToolTip [as 别名]
def __init__(self, toolbox):
super(Spanners, self).__init__(toolbox, 'spanner',
i18n("Spanners"), symbol='slur_solid',
tooltip=i18n("Slurs, spanners, etcetera."))
layout = QVBoxLayout(self)
layout.setSpacing(0)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
box = QGroupBox(i18n("Spanners"))
box.setToolTip(i18n(
"These spanners need a music fragment to be selected."))
grid = QGridLayout()
grid.setSpacing(0)
box.setLayout(grid)
self.spanners = {}
for num, (name, title, symbol) in enumerate((
('slur', i18n("Slur"), 'slur_solid'),
('phrasing_slur', i18n("Phrasing Slur"), 'slur_solid'),
('beam', i18n("Beam"), 'spanner_beam16'),
('trill', i18n("Trill"), 'spanner_trill'),
)):
self.spanners[name] = (symbol, title)
b = ActionButton(self, name, title, symbol)
row, col = divmod(num, COLUMNS)
grid.addWidget(b, row, col)
layout.addWidget(box)
box = QGroupBox(i18n("Arpeggios"))
box.setToolTip(i18n(
"Arpeggios are used with chords with multiple notes."))
grid = QGridLayout()
grid.setSpacing(0)
box.setLayout(grid)
self.arpeggios = {}
for num, (name, title) in enumerate((
('arpeggio_normal', i18n("Arpeggio")),
('arpeggio_arrow_up', i18n("Arpeggio with Up Arrow")),
('arpeggio_arrow_down', i18n("Arpeggio with Down Arrow")),
('arpeggio_bracket', i18n("Bracket Arpeggio")),
('arpeggio_parenthesis', i18n("Parenthesis Arpeggio")),
)):
self.arpeggios[name] = title
b = ActionButton(self, name, title, name)
row, col = divmod(num, COLUMNS)
grid.addWidget(b, row, col)
layout.addWidget(box)
box = QGroupBox(i18n("Glissandos"))
box.setToolTip(i18n(
"Glissandos are attached to a note and automatically "
"extend to the next note."))
grid = QGridLayout()
grid.setSpacing(0)
box.setLayout(grid)
self.glissandos = {}
for num, (name, title) in enumerate((
('glissando_normal', i18n("Glissando")),
('glissando_dashed', i18n("Dashed Glissando")),
('glissando_dotted', i18n("Dotted Glissando")),
('glissando_zigzag', i18n("Zigzag Glissando")),
('glissando_trill', i18n("Trill Glissando")),
)):
self.glissandos[name] = title
b = ActionButton(self, name, title, name)
row, col = divmod(num, COLUMNS)
grid.addWidget(b, row, col)
layout.addWidget(box)
layout.addStretch()