本文整理汇总了Python中PyQt4.Qt.QCheckBox.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QCheckBox.setToolTip方法的具体用法?Python QCheckBox.setToolTip怎么用?Python QCheckBox.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QCheckBox
的用法示例。
在下文中一共展示了QCheckBox.setToolTip方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_ui
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
def setup_ui(self):
from calibre.gui2.convert.look_and_feel_ui import Ui_Form
f, w = Ui_Form(), QWidget()
f.setupUi(w)
self.l = l = QFormLayout(self)
self.setLayout(l)
l.addRow(QLabel(_('Select what style information you want completely removed:')))
self.h = h = QHBoxLayout()
for name, text in {
'fonts':_('&Fonts'), 'margins':_('&Margins'), 'padding':_('&Padding'), 'floats':_('Flo&ats'), 'colors':_('&Colors')}.iteritems():
c = QCheckBox(text)
setattr(self, 'opt_' + name, c)
h.addWidget(c)
c.setToolTip(getattr(f, 'filter_css_' + name).toolTip())
l.addRow(h)
self.others = o = QLineEdit(self)
l.addRow(_('&Other CSS properties:'), o)
o.setToolTip(f.filter_css_others.toolTip())
if self.current_name is not None:
self.filter_current = c = QCheckBox(_('Only filter CSS in the current file (%s)') % self.current_name)
l.addRow(c)
l.addRow(self.bb)
示例2: do_user_config
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
def do_user_config(self, parent=None):
'''
This method shows a configuration dialog for this plugin. It returns
True if the user clicks OK, False otherwise. The changes are
automatically applied.
'''
from PyQt4.Qt import (QDialog, QDialogButtonBox, QVBoxLayout,
QLabel, Qt, QLineEdit, QCheckBox)
config_dialog = QDialog(parent)
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
v = QVBoxLayout(config_dialog)
def size_dialog():
config_dialog.resize(config_dialog.sizeHint())
button_box.accepted.connect(config_dialog.accept)
button_box.rejected.connect(config_dialog.reject)
config_dialog.setWindowTitle(_('Customize') + ' ' + self.name)
from calibre.customize.ui import (plugin_customization,
customize_plugin)
help_text = self.customization_help(gui=True)
help_text = QLabel(help_text, config_dialog)
help_text.setWordWrap(True)
help_text.setTextInteractionFlags(Qt.LinksAccessibleByMouse
| Qt.LinksAccessibleByKeyboard)
help_text.setOpenExternalLinks(True)
v.addWidget(help_text)
bf = QCheckBox(_('Add linked files in breadth first order'))
bf.setToolTip(_('Normally, when following links in HTML files'
' calibre does it depth first, i.e. if file A links to B and '
' C, but B links to D, the files are added in the order A, B, D, C. '
' With this option, they will instead be added as A, B, C, D'))
sc = plugin_customization(self)
if not sc:
sc = ''
sc = sc.strip()
enc = sc.partition('|')[0]
bfs = sc.partition('|')[-1]
bf.setChecked(bfs == 'bf')
sc = QLineEdit(enc, config_dialog)
v.addWidget(sc)
v.addWidget(bf)
v.addWidget(button_box)
size_dialog()
config_dialog.exec_()
if config_dialog.result() == QDialog.Accepted:
sc = unicode(sc.text()).strip()
if bf.isChecked():
sc += '|bf'
customize_plugin(self, sc)
return config_dialog.result()
示例3: ConfigWidget
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
class ConfigWidget(DefaultConfigWidget):
def __init__(self, plugin):
DefaultConfigWidget.__init__(self, plugin)
c = plugin_prefs[STORE_NAME]
all_tags = get_current_db().all_tags()
self.gb.setMaximumHeight(80)
genre_group_box = QGroupBox('Shelfari genre to calibre tag mappings', self)
self.l.addWidget(genre_group_box, self.l.rowCount(), 0, 1, 2)
genre_group_box_layout = QVBoxLayout()
genre_group_box.setLayout(genre_group_box_layout)
tags_layout = QHBoxLayout()
genre_group_box_layout.addLayout(tags_layout)
self.edit_table = GenreTagMappingsTableWidget(self, all_tags)
tags_layout.addWidget(self.edit_table)
button_layout = QVBoxLayout()
tags_layout.addLayout(button_layout)
add_mapping_button = QtGui.QToolButton(self)
add_mapping_button.setToolTip('Add genre mapping')
add_mapping_button.setIcon(QIcon(I('plus.png')))
add_mapping_button.clicked.connect(self.add_mapping)
button_layout.addWidget(add_mapping_button)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
button_layout.addItem(spacerItem1)
remove_mapping_button = QtGui.QToolButton(self)
remove_mapping_button.setToolTip('Delete genre mapping')
remove_mapping_button.setIcon(QIcon(I('minus.png')))
remove_mapping_button.clicked.connect(self.delete_mapping)
button_layout.addWidget(remove_mapping_button)
spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
button_layout.addItem(spacerItem3)
rename_genre_button = QtGui.QToolButton(self)
rename_genre_button.setToolTip('Rename Goodreads genre')
rename_genre_button.setIcon(QIcon(I('edit-undo.png')))
rename_genre_button.clicked.connect(self.rename_genre)
button_layout.addWidget(rename_genre_button)
spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
button_layout.addItem(spacerItem2)
reset_defaults_button = QtGui.QToolButton(self)
reset_defaults_button.setToolTip('Reset to plugin default mappings')
reset_defaults_button.setIcon(QIcon(I('clear_left.png')))
reset_defaults_button.clicked.connect(self.reset_to_defaults)
button_layout.addWidget(reset_defaults_button)
self.l.setRowStretch(self.l.rowCount()-1, 2)
other_group_box = QGroupBox('Other options', self)
self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2)
other_group_box_layout = QVBoxLayout()
other_group_box.setLayout(other_group_box_layout)
self.get_editions_checkbox = QCheckBox('Scan multiple editions for title/author searches (slower)', self)
self.get_editions_checkbox.setToolTip('When checked will perform an additional search to scan the top ranked\n'
'Shelfari editions (if available) to exclude audiobook editions.\n'
'Without this enabled you will get a faster search, using the "best".\n'
'edition ranked by Shelfari which can in some cases be an audiobook.')
self.get_editions_checkbox.setChecked(c[KEY_GET_EDITIONS])
other_group_box_layout.addWidget(self.get_editions_checkbox)
self.all_authors_checkbox = QCheckBox('Get all contributing authors (e.g. illustrators, series editors etc)', self)
self.all_authors_checkbox.setToolTip('Shelfari for some books will list all of the contributing authors and\n'
'the type of contribution like (Editor), (Illustrator) etc.\n\n'
'When this option is checked, all contributing authors are retrieved.\n\n'
'When unchecked (default) only the primary author(s) are returned which\n'
'are those that either have no contribution type specified, or have the\n'
'value of (Shelfari Author).\n\n'
'If there is no primary author then only those with the same contribution\n'
'type as the first author are returned.\n'
'e.g. "A, B (Illustrator)" will return author A\n'
'e.g. "A (Shelfari Author)" will return author A\n'
'e.g. "A (Editor), B (Editor), C (Illustrator)" will return authors A & B\n'
'e.g. "A (Editor), B (Series Editor)" will return author A\n')
self.all_authors_checkbox.setChecked(c[KEY_GET_ALL_AUTHORS])
other_group_box_layout.addWidget(self.all_authors_checkbox)
self.edit_table.populate_table(c[KEY_GENRE_MAPPINGS])
def commit(self):
DefaultConfigWidget.commit(self)
new_prefs = {}
new_prefs[KEY_GET_EDITIONS] = self.get_editions_checkbox.checkState() == Qt.Checked
new_prefs[KEY_GET_ALL_AUTHORS] = self.all_authors_checkbox.checkState() == Qt.Checked
new_prefs[KEY_GENRE_MAPPINGS] = self.edit_table.get_data()
plugin_prefs[STORE_NAME] = new_prefs
def add_mapping(self):
new_genre_name, ok = QInputDialog.getText(self, 'Add new mapping',
'Enter a Shelfari genre name to create a mapping for:', text='')
if not ok:
# Operation cancelled
return
new_genre_name = unicode(new_genre_name).strip()
if not new_genre_name:
return
# Verify it does not clash with any other mappings in the list
data = self.edit_table.get_data()
for genre_name in data.keys():
if genre_name.lower() == new_genre_name.lower():
return error_dialog(self, 'Add Failed', 'A genre with the same name already exists', show=True)
#.........这里部分代码省略.........
示例4: ConfigWidget
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
class ConfigWidget(DefaultConfigWidget):
def __init__(self, plugin):
DefaultConfigWidget.__init__(self, plugin)
c = plugin_prefs[STORE_NAME]
all_tags = get_current_db().all_tags()
self.gb.setMaximumHeight(80)
genre_group_box = QGroupBox(_('Aladin tag to Calibre tag mappings'), self)
self.l.addWidget(genre_group_box, self.l.rowCount(), 0, 1, 2)
genre_group_box_layout = QVBoxLayout()
genre_group_box.setLayout(genre_group_box_layout)
# Aladin tag convert to calibre tag 20140312
self.get_convert_tag_checkbox = QCheckBox(_('Convert Aladin tag to Calibre tag'), self)
self.get_convert_tag_checkbox.setToolTip(_('Convert Aladin tag(korean tag) to Calibre tag.'))
self.get_convert_tag_checkbox.setChecked(c.get(KEY_CONVERT_TAG,DEFAULT_STORE_VALUES[KEY_CONVERT_TAG]))
genre_group_box_layout.addWidget(self.get_convert_tag_checkbox)
tags_layout = QHBoxLayout()
genre_group_box_layout.addLayout(tags_layout)
self.edit_table = GenreTagMappingsTableWidget(self, all_tags)
tags_layout.addWidget(self.edit_table)
button_layout = QVBoxLayout()
tags_layout.addLayout(button_layout)
add_mapping_button = QtGui.QToolButton(self)
add_mapping_button.setToolTip(_('Add genre mapping'))
add_mapping_button.setIcon(QIcon(I('plus.png')))
add_mapping_button.clicked.connect(self.add_mapping)
button_layout.addWidget(add_mapping_button)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
button_layout.addItem(spacerItem1)
remove_mapping_button = QtGui.QToolButton(self)
remove_mapping_button.setToolTip(_('Delete genre mapping'))
remove_mapping_button.setIcon(QIcon(I('minus.png')))
remove_mapping_button.clicked.connect(self.delete_mapping)
button_layout.addWidget(remove_mapping_button)
spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
button_layout.addItem(spacerItem3)
rename_genre_button = QtGui.QToolButton(self)
rename_genre_button.setToolTip(_('Rename Aladin genre'))
rename_genre_button.setIcon(QIcon(I('edit-undo.png')))
rename_genre_button.clicked.connect(self.rename_genre)
button_layout.addWidget(rename_genre_button)
spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
button_layout.addItem(spacerItem2)
reset_defaults_button = QtGui.QToolButton(self)
reset_defaults_button.setToolTip(_('Reset to plugin default mappings'))
reset_defaults_button.setIcon(QIcon(I('clear_left.png')))
reset_defaults_button.clicked.connect(self.reset_to_defaults)
button_layout.addWidget(reset_defaults_button)
self.l.setRowStretch(self.l.rowCount()-1, 2)
other_group_box = QGroupBox(_('Other options'), self)
self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2)
other_group_box_layout = QVBoxLayout()
other_group_box.setLayout(other_group_box_layout)
# DID: category | v0.1.0 20140315
self.get_category_checkbox = QCheckBox(_('Add Aladin Categories to Calibre tags'), self)
self.get_category_checkbox.setToolTip(_('Add Aladin Categories to Calibre tags.\n'
'This Plugin will change delimiter ">" to delimiter "." for Category Hierarchy.\n'
'(ex, "Category Prefix"History.Korea Culture.History Journey)\n '))
self.get_category_checkbox.stateChanged.connect(self.get_category_checkbox_changed)
other_group_box_layout.addWidget(self.get_category_checkbox)
self.category_group_box = QGroupBox(self)
category_group_box_layout = QtGui.QGridLayout()
self.category_group_box.setLayout(category_group_box_layout)
other_group_box_layout.addWidget(self.category_group_box)
# DID: 주제분류 category - 머리글 | v0.2.0 20140330
category_prefix_label = QtGui.QLabel(_('Category Prefix'),self)
category_prefix_label.setToolTip(_('Set strings before categories to distinguish other tags.\n'
'(예, ☞History.Korea Culture.History Journey)\n '))
category_group_box_layout.addWidget(category_prefix_label, 0, 0, 1, 1)
self.category_prefix_edit = QtGui.QLineEdit(self)
self.category_prefix_edit.setText(c.get(KEY_CATEGORY_PREFIX,DEFAULT_STORE_VALUES[KEY_CATEGORY_PREFIX]))
category_group_box_layout.addWidget(self.category_prefix_edit, 0, 1, 1, 1)
self.get_category_checkbox.setChecked(c.get(KEY_GET_CATEGORY,DEFAULT_STORE_VALUES[KEY_GET_CATEGORY]))
# DID: 책표지(cover)를 큰것/작은것(big/small) 선택할 수 있도록 하자. | v0.2.0 20140330
self.small_cover_checkbox = QCheckBox(_('Download small cover.'), self)
self.small_cover_checkbox.setToolTip(_('Download small cover from aladin.'))
self.small_cover_checkbox.setChecked(c.get(KEY_SMALL_COVER, DEFAULT_STORE_VALUES[KEY_SMALL_COVER]))
other_group_box_layout.addWidget(self.small_cover_checkbox)
self.all_authors_checkbox = QCheckBox(_('Get all contributing authors (e.g. illustrators, series editors etc)'), self)
self.all_authors_checkbox.setToolTip(_('Aladin for some books will list all of the contributing authors and\n'
'the type of contribution like (Editor), (Illustrator) etc.\n\n'
'When this option is checked, all contributing authors are retrieved.\n\n'
'When unchecked (default) only the primary author(s) are returned which\n'
'are those that either have no contribution type specified, or have the\n'
'value of (Aladin Author).\n\n'
'If there is no primary author then only those with the same contribution\n'
#.........这里部分代码省略.........
示例5: ConfigWidget
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
#.........这里部分代码省略.........
self.column1_layout = QVBoxLayout()
self.l.addLayout(self.column1_layout, 0, 0)
self.column2_layout = QVBoxLayout()
self.l.addLayout(self.column2_layout, 0, 1)
# ----------------------------- 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)
示例6: __init__
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
def __init__(self, parent, rc, imgman):
"""An ImageControlDialog is initialized with a parent widget, a RenderControl object,
and an ImageManager object"""
QDialog.__init__(self, parent)
image = rc.image
self.setWindowTitle("%s: Colour Controls" % image.name)
self.setWindowIcon(pixmaps.colours.icon())
self.setModal(False)
self.image = image
self._rc = rc
self._imgman = imgman
self._currier = PersistentCurrier()
# init internal state
self._prev_range = self._display_range = None, None
self._hist = None
self._geometry = None
# create layouts
lo0 = QVBoxLayout(self)
# lo0.setContentsMargins(0,0,0,0)
# histogram plot
whide = self.makeButton("Hide", self.hide, width=128)
whide.setShortcut(Qt.Key_F9)
lo0.addWidget(Separator(self, "Histogram and ITF", extra_widgets=[whide]))
lo1 = QHBoxLayout()
lo1.setContentsMargins(0, 0, 0, 0)
self._histplot = QwtPlot(self)
self._histplot.setAutoDelete(False)
lo1.addWidget(self._histplot, 1)
lo2 = QHBoxLayout()
lo2.setContentsMargins(0, 0, 0, 0)
lo2.setSpacing(2)
lo0.addLayout(lo2)
lo0.addLayout(lo1)
self._wautozoom = QCheckBox("autozoom", self)
self._wautozoom.setChecked(True)
self._wautozoom.setToolTip("""<P>If checked, then the histrogram plot will zoom in automatically when
you narrow the current intensity range.</P>""")
self._wlogy = QCheckBox("log Y", self)
self._wlogy.setChecked(True)
self._ylogscale = True
self._wlogy.setToolTip(
"""<P>If checked, a log-scale Y axis is used for the histogram plot instead of a linear one.""")
QObject.connect(self._wlogy, SIGNAL("toggled(bool)"), self._setHistLogScale)
self._whistunzoom = self.makeButton("", self._unzoomHistogram, icon=pixmaps.full_range.icon())
self._whistzoomout = self.makeButton("-", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(.1)))
self._whistzoomin = self.makeButton("+", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(10)))
self._whistzoomin.setToolTip("""<P>Click to zoom into the histogram plot by one step. This does not
change the current intensity range.</P>""")
self._whistzoomout.setToolTip("""<P>Click to zoom out of the histogram plot by one step. This does not
change the current intensity range.</P>""")
self._whistunzoom.setToolTip("""<P>Click to reset the histogram plot back to its full extent.
This does not change the current intensity range.</P>""")
self._whistzoom = QwtWheel(self)
self._whistzoom.setOrientation(Qt.Horizontal)
self._whistzoom.setMaximumWidth(80)
self._whistzoom.setRange(10, 0)
self._whistzoom.setStep(0.1)
self._whistzoom.setTickCnt(30)
self._whistzoom.setTracking(False)
QObject.connect(self._whistzoom, SIGNAL("valueChanged(double)"), self._zoomHistogramFinalize)
QObject.connect(self._whistzoom, SIGNAL("sliderMoved(double)"), self._zoomHistogramPreview)
self._whistzoom.setToolTip("""<P>Use this wheel control to zoom in/out of the histogram plot.
This does not change the current intensity range.
Note that the zoom wheel should also respond to your mouse wheel, if you have one.</P>""")
# This works around a stupid bug in QwtSliders -- when using the mousewheel, only sliderMoved() signals are emitted,
# with no final valueChanged(). If we want to do a fast preview of something on sliderMoved(), and a "slow" final
# step on valueChanged(), we're in trouble. So we start a timer on sliderMoved(), and if the timer expires without
# anything else happening, do a valueChanged().
# Here we use a timer to call zoomHistogramFinalize() w/o an argument.
self._whistzoom_timer = QTimer(self)
self._whistzoom_timer.setSingleShot(True)
self._whistzoom_timer.setInterval(500)
QObject.connect(self._whistzoom_timer, SIGNAL("timeout()"), self._zoomHistogramFinalize)
# set same size for all buttons and controls
width = 24
for w in self._whistunzoom, self._whistzoomin, self._whistzoomout:
w.setMinimumSize(width, width)
w.setMaximumSize(width, width)
self._whistzoom.setMinimumSize(80, width)
self._wlab_histpos_text = "(hover here for help)"
self._wlab_histpos = QLabel(self._wlab_histpos_text, self)
self._wlab_histpos.setToolTip("""
<P>The plot shows a histogram of either the full image or its selected subset
(as per the "Data subset" section below).</P>
<P>The current intensity range is indicated by the grey box
in the plot.</P>
<P>Use the left mouse button to change the low intensity limit, and the right
button (on Macs, use Ctrl-click) to change the high limit.</P>
<P>Use Shift with the left mouse button to zoom into an area of the histogram,
or else use the "zoom wheel" control or the plus/minus toolbuttons above the histogram to zoom in or out.
To zoom back out to the full extent of the histogram, click on the rightmost button above the histogram.</P>
""")
lo2.addWidget(self._wlab_histpos, 1)
lo2.addWidget(self._wautozoom)
lo2.addWidget(self._wlogy, 0)
lo2.addWidget(self._whistzoomin, 0)
lo2.addWidget(self._whistzoom, 0)
#.........这里部分代码省略.........
示例7: ImageControlDialog
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
class ImageControlDialog(QDialog):
def __init__(self, parent, rc, imgman):
"""An ImageControlDialog is initialized with a parent widget, a RenderControl object,
and an ImageManager object"""
QDialog.__init__(self, parent)
image = rc.image
self.setWindowTitle("%s: Colour Controls" % image.name)
self.setWindowIcon(pixmaps.colours.icon())
self.setModal(False)
self.image = image
self._rc = rc
self._imgman = imgman
self._currier = PersistentCurrier()
# init internal state
self._prev_range = self._display_range = None, None
self._hist = None
self._geometry = None
# create layouts
lo0 = QVBoxLayout(self)
# lo0.setContentsMargins(0,0,0,0)
# histogram plot
whide = self.makeButton("Hide", self.hide, width=128)
whide.setShortcut(Qt.Key_F9)
lo0.addWidget(Separator(self, "Histogram and ITF", extra_widgets=[whide]))
lo1 = QHBoxLayout()
lo1.setContentsMargins(0, 0, 0, 0)
self._histplot = QwtPlot(self)
self._histplot.setAutoDelete(False)
lo1.addWidget(self._histplot, 1)
lo2 = QHBoxLayout()
lo2.setContentsMargins(0, 0, 0, 0)
lo2.setSpacing(2)
lo0.addLayout(lo2)
lo0.addLayout(lo1)
self._wautozoom = QCheckBox("autozoom", self)
self._wautozoom.setChecked(True)
self._wautozoom.setToolTip("""<P>If checked, then the histrogram plot will zoom in automatically when
you narrow the current intensity range.</P>""")
self._wlogy = QCheckBox("log Y", self)
self._wlogy.setChecked(True)
self._ylogscale = True
self._wlogy.setToolTip(
"""<P>If checked, a log-scale Y axis is used for the histogram plot instead of a linear one.""")
QObject.connect(self._wlogy, SIGNAL("toggled(bool)"), self._setHistLogScale)
self._whistunzoom = self.makeButton("", self._unzoomHistogram, icon=pixmaps.full_range.icon())
self._whistzoomout = self.makeButton("-", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(.1)))
self._whistzoomin = self.makeButton("+", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(10)))
self._whistzoomin.setToolTip("""<P>Click to zoom into the histogram plot by one step. This does not
change the current intensity range.</P>""")
self._whistzoomout.setToolTip("""<P>Click to zoom out of the histogram plot by one step. This does not
change the current intensity range.</P>""")
self._whistunzoom.setToolTip("""<P>Click to reset the histogram plot back to its full extent.
This does not change the current intensity range.</P>""")
self._whistzoom = QwtWheel(self)
self._whistzoom.setOrientation(Qt.Horizontal)
self._whistzoom.setMaximumWidth(80)
self._whistzoom.setRange(10, 0)
self._whistzoom.setStep(0.1)
self._whistzoom.setTickCnt(30)
self._whistzoom.setTracking(False)
QObject.connect(self._whistzoom, SIGNAL("valueChanged(double)"), self._zoomHistogramFinalize)
QObject.connect(self._whistzoom, SIGNAL("sliderMoved(double)"), self._zoomHistogramPreview)
self._whistzoom.setToolTip("""<P>Use this wheel control to zoom in/out of the histogram plot.
This does not change the current intensity range.
Note that the zoom wheel should also respond to your mouse wheel, if you have one.</P>""")
# This works around a stupid bug in QwtSliders -- when using the mousewheel, only sliderMoved() signals are emitted,
# with no final valueChanged(). If we want to do a fast preview of something on sliderMoved(), and a "slow" final
# step on valueChanged(), we're in trouble. So we start a timer on sliderMoved(), and if the timer expires without
# anything else happening, do a valueChanged().
# Here we use a timer to call zoomHistogramFinalize() w/o an argument.
self._whistzoom_timer = QTimer(self)
self._whistzoom_timer.setSingleShot(True)
self._whistzoom_timer.setInterval(500)
QObject.connect(self._whistzoom_timer, SIGNAL("timeout()"), self._zoomHistogramFinalize)
# set same size for all buttons and controls
width = 24
for w in self._whistunzoom, self._whistzoomin, self._whistzoomout:
w.setMinimumSize(width, width)
w.setMaximumSize(width, width)
self._whistzoom.setMinimumSize(80, width)
self._wlab_histpos_text = "(hover here for help)"
self._wlab_histpos = QLabel(self._wlab_histpos_text, self)
self._wlab_histpos.setToolTip("""
<P>The plot shows a histogram of either the full image or its selected subset
(as per the "Data subset" section below).</P>
<P>The current intensity range is indicated by the grey box
in the plot.</P>
<P>Use the left mouse button to change the low intensity limit, and the right
button (on Macs, use Ctrl-click) to change the high limit.</P>
<P>Use Shift with the left mouse button to zoom into an area of the histogram,
or else use the "zoom wheel" control or the plus/minus toolbuttons above the histogram to zoom in or out.
To zoom back out to the full extent of the histogram, click on the rightmost button above the histogram.</P>
""")
lo2.addWidget(self._wlab_histpos, 1)
lo2.addWidget(self._wautozoom)
lo2.addWidget(self._wlogy, 0)
lo2.addWidget(self._whistzoomin, 0)
#.........这里部分代码省略.........
示例8: MakeBrickDialog
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
class MakeBrickDialog(QDialog):
def __init__(self, parent, modal=True, flags=Qt.WindowFlags()):
QDialog.__init__(self, parent, flags)
self.setModal(modal)
self.setWindowTitle("Convert sources to FITS brick")
lo = QVBoxLayout(self)
lo.setMargin(10)
lo.setSpacing(5)
# file selector
self.wfile = FileSelector(self, label="FITS filename:", dialog_label="Output FITS file", default_suffix="fits",
file_types="FITS files (*.fits *.FITS)", file_mode=QFileDialog.ExistingFile)
lo.addWidget(self.wfile)
# reference frequency
lo1 = QHBoxLayout()
lo.addLayout(lo1)
lo1.setContentsMargins(0, 0, 0, 0)
label = QLabel("Frequency, MHz:", self)
lo1.addWidget(label)
tip = """<P>If your sky model contains spectral information (such as spectral indices), then a brick may be generated
for a specific frequency. If a frequency is not specified here, the reference frequency of the model sources will be assumed.</P>"""
self.wfreq = QLineEdit(self)
self.wfreq.setValidator(QDoubleValidator(self))
label.setToolTip(tip)
self.wfreq.setToolTip(tip)
lo1.addWidget(self.wfreq)
# beam gain
lo1 = QHBoxLayout()
lo.addLayout(lo1)
lo1.setContentsMargins(0, 0, 0, 0)
self.wpb_apply = QCheckBox("Apply primary beam expression:", self)
self.wpb_apply.setChecked(True)
lo1.addWidget(self.wpb_apply)
tip = """<P>If this option is specified, a primary power beam gain will be applied to the sources before inserting
them into the brick. This can be any valid Python expression making use of the variables 'r' (corresponding
to distance from field centre, in radians) and 'fq' (corresponding to frequency.)</P>"""
self.wpb_exp = QLineEdit(self)
self.wpb_apply.setToolTip(tip)
self.wpb_exp.setToolTip(tip)
lo1.addWidget(self.wpb_exp)
# overwrite or add mode
lo1 = QHBoxLayout()
lo.addLayout(lo1)
lo1.setContentsMargins(0, 0, 0, 0)
self.woverwrite = QRadioButton("overwrite image", self)
self.woverwrite.setChecked(True)
lo1.addWidget(self.woverwrite)
self.waddinto = QRadioButton("add into image", self)
lo1.addWidget(self.waddinto)
# add to model
self.wadd = QCheckBox("Add resulting brick to sky model as a FITS image component", self)
lo.addWidget(self.wadd)
lo1 = QHBoxLayout()
lo.addLayout(lo1)
lo1.setContentsMargins(0, 0, 0, 0)
self.wpad = QLineEdit(self)
self.wpad.setValidator(QDoubleValidator(self))
self.wpad.setText("1.1")
lab = QLabel("...with padding factor:", self)
lab.setToolTip("""<P>The padding factor determines the amount of null padding inserted around the image during
the prediction stage. Padding alleviates the effects of tapering and detapering in the uv-brick, which can show
up towards the edges of the image. For a factor of N, the image will be padded out to N times its original size.
This increases memory use, so if you have no flux at the edges of the image anyway, then a pad factor of 1 is
perfectly fine.</P>""")
self.wpad.setToolTip(lab.toolTip())
QObject.connect(self.wadd, SIGNAL("toggled(bool)"), self.wpad.setEnabled)
QObject.connect(self.wadd, SIGNAL("toggled(bool)"), lab.setEnabled)
self.wpad.setEnabled(False)
lab.setEnabled(False)
lo1.addStretch(1)
lo1.addWidget(lab, 0)
lo1.addWidget(self.wpad, 1)
self.wdel = QCheckBox("Remove from the sky model sources that go into the brick", self)
lo.addWidget(self.wdel)
# OK/cancel buttons
lo.addSpacing(10)
lo2 = QHBoxLayout()
lo.addLayout(lo2)
lo2.setContentsMargins(0, 0, 0, 0)
lo2.setMargin(5)
self.wokbtn = QPushButton("OK", self)
self.wokbtn.setMinimumWidth(128)
QObject.connect(self.wokbtn, SIGNAL("clicked()"), self.accept)
self.wokbtn.setEnabled(False)
cancelbtn = QPushButton("Cancel", self)
cancelbtn.setMinimumWidth(128)
QObject.connect(cancelbtn, SIGNAL("clicked()"), self.reject)
lo2.addWidget(self.wokbtn)
lo2.addStretch(1)
lo2.addWidget(cancelbtn)
self.setMinimumWidth(384)
# signals
QObject.connect(self.wfile, SIGNAL("filenameSelected"), self._fileSelected)
# internal state
self.qerrmsg = QErrorMessage(self)
def setModel(self, model):
self.model = model
pb = self.model.primaryBeam()
if pb:
self.wpb_exp.setText(pb)
#.........这里部分代码省略.........
示例9: ConfigWidget
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setToolTip [as 别名]
class ConfigWidget(QWidget):
def __init__(self, plugin_action):
QWidget.__init__(self)
self.plugin_action = plugin_action
layout = QVBoxLayout(self)
self.setLayout(layout)
c = plugin_prefs[STORE_NAME]
avail_columns = self.get_custom_columns()
library_config = get_library_config(self.plugin_action.gui.current_db)
pages_algorithm = library_config.get(KEY_PAGES_ALGORITHM, DEFAULT_LIBRARY_VALUES[KEY_PAGES_ALGORITHM])
button_default = c.get(KEY_BUTTON_DEFAULT, DEFAULT_STORE_VALUES[KEY_BUTTON_DEFAULT])
# Fudge the button default to cater for the options no longer supported by plugin as of 1.5
if button_default in ['Estimate', 'EstimatePage', 'EstimateWord']:
button_default = 'Estimate'
else:
button_default = 'Goodreads'
overwrite_existing = c.get(KEY_OVERWRITE_EXISTING, DEFAULT_STORE_VALUES[KEY_OVERWRITE_EXISTING])
# --- Pages ---
page_group_box = QGroupBox('Page count options:', self)
layout.addWidget(page_group_box)
page_group_box_layout = QGridLayout()
page_group_box.setLayout(page_group_box_layout)
page_column_label = QLabel('&Custom column:', self)
page_column_label.setToolTip('Leave this blank if you do not want to count pages')
page_col = library_config.get(KEY_PAGES_CUSTOM_COLUMN, '')
self.page_column_combo = CustomColumnComboBox(self, avail_columns, page_col)
page_column_label.setBuddy(self.page_column_combo)
page_group_box_layout.addWidget(page_column_label, 0, 0, 1, 1)
page_group_box_layout.addWidget(self.page_column_combo, 0, 1, 1, 2)
page_algorithm_label = QLabel('&Algorithm:', self)
page_algorithm_label.setToolTip('Choose which algorithm to use if you have specified a page count column')
self.page_algorithm_combo = AlgorithmComboBox(self, PAGE_ALGORITHMS, pages_algorithm)
page_algorithm_label.setBuddy(self.page_algorithm_combo)
page_group_box_layout.addWidget(page_algorithm_label, 1, 0, 1, 1)
page_group_box_layout.addWidget(self.page_algorithm_combo, 1, 1, 1, 2)
# --- Words ---
layout.addSpacing(5)
word_group_box = QGroupBox('Word count options:', self)
layout.addWidget(word_group_box)
word_group_box_layout = QGridLayout()
word_group_box.setLayout(word_group_box_layout)
word_column_label = QLabel('C&ustom column:', self)
word_column_label.setToolTip('Leave this blank if you do not want to count words')
word_col = library_config.get(KEY_WORDS_CUSTOM_COLUMN, '')
self.word_column_combo = CustomColumnComboBox(self, avail_columns, word_col)
word_column_label.setBuddy(self.word_column_combo)
word_group_box_layout.addWidget(word_column_label, 0, 0, 1, 1)
word_group_box_layout.addWidget(self.word_column_combo, 0, 1, 1, 2)
# --- Readability ---
layout.addSpacing(5)
readability_group_box = QGroupBox('Readability options:', self)
layout.addWidget(readability_group_box)
readability_layout = QGridLayout()
readability_group_box.setLayout(readability_layout)
readability_label = QLabel('Readability statistics available are <a href="http://en.wikipedia.org/wiki/Flesch–Kincaid_readability_test">Flesch-Kincaid</a> '
'or <a href="http://en.wikipedia.org/wiki/Gunning_fog_index">Gunning Fog Index</a>.', self)
readability_layout.addWidget(readability_label, 0, 0, 1, 3)
readability_label.linkActivated.connect(self._link_activated)
flesch_reading_column_label = QLabel('&Flesch Reading Ease:', self)
flesch_reading_column_label.setToolTip('Specify the custom column to store a computed Flesch Reading Ease score.\n'
'Leave this blank if you do not want to calculate it')
flesch_reading_col = library_config.get(KEY_FLESCH_READING_CUSTOM_COLUMN, '')
self.flesch_reading_column_combo = CustomColumnComboBox(self, avail_columns, flesch_reading_col)
flesch_reading_column_label.setBuddy(self.flesch_reading_column_combo)
readability_layout.addWidget(flesch_reading_column_label, 1, 0, 1, 1)
readability_layout.addWidget(self.flesch_reading_column_combo, 1, 1, 1, 2)
flesch_grade_column_label = QLabel('Flesch-&Kincaid Grade:', self)
flesch_grade_column_label.setToolTip('Specify the custom column to store a computed Flesch-Kincaid Grade Level score.\n'
'Leave this blank if you do not want to calculate it')
flesch_grade_col = library_config.get(KEY_FLESCH_GRADE_CUSTOM_COLUMN, '')
self.flesch_grade_column_combo = CustomColumnComboBox(self, avail_columns, flesch_grade_col)
flesch_grade_column_label.setBuddy(self.flesch_grade_column_combo)
readability_layout.addWidget(flesch_grade_column_label, 2, 0, 1, 1)
readability_layout.addWidget(self.flesch_grade_column_combo, 2, 1, 1, 2)
gunning_fog_column_label = QLabel('&Gunning Fox Index:', self)
gunning_fog_column_label.setToolTip('Specify the custom column to store a computed Gunning Fog Index score.\n'
'Leave this blank if you do not want to calculate it')
gunning_fog_col = library_config.get(KEY_GUNNING_FOG_CUSTOM_COLUMN, '')
self.gunning_fog_column_combo = CustomColumnComboBox(self, avail_columns, gunning_fog_col)
gunning_fog_column_label.setBuddy(self.gunning_fog_column_combo)
readability_layout.addWidget(gunning_fog_column_label, 3, 0, 1, 1)
readability_layout.addWidget(self.gunning_fog_column_combo, 3, 1, 1, 2)
# --- Other options ---
layout.addSpacing(5)
other_group_box = QGroupBox('Other options:', self)
layout.addWidget(other_group_box)
other_group_box_layout = QGridLayout()
#.........这里部分代码省略.........