mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Add status tips for all active elements in the main GUI
This commit is contained in:
parent
5f93eb14a1
commit
d33a9dc0b5
@ -20,7 +20,6 @@ from calibre.gui2.tag_view import TagBrowserWidget
|
||||
from calibre.gui2.book_details import BookDetails
|
||||
from calibre.gui2.notify import get_notifier
|
||||
|
||||
|
||||
_keep_refs = []
|
||||
|
||||
def partial(*args, **kwargs):
|
||||
@ -182,6 +181,7 @@ class ToolbarMixin(object): # {{{
|
||||
for ch in self.tool_bar.children():
|
||||
if isinstance(ch, QToolButton):
|
||||
ch.setCursor(Qt.PointingHandCursor)
|
||||
ch.setStatusTip(ch.toolTip())
|
||||
|
||||
self.tool_bar.contextMenuEvent = self.no_op
|
||||
|
||||
@ -367,7 +367,7 @@ class StatusBar(QStatusBar): # {{{
|
||||
self.notifier = get_notifier(systray)
|
||||
|
||||
def show_message(self, msg, timeout=0):
|
||||
QStatusBar.showMessage(self, msg, timeout)
|
||||
self.showMessage(msg, timeout)
|
||||
if self.notifier is not None and not config['disable_tray_notification']:
|
||||
if isosx and isinstance(msg, unicode):
|
||||
try:
|
||||
@ -377,7 +377,8 @@ class StatusBar(QStatusBar): # {{{
|
||||
self.notifier(msg)
|
||||
|
||||
def clear_message(self):
|
||||
QStatusBar.clearMessage(self)
|
||||
self.clearMessage()
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
@ -259,7 +259,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Choose saved search or enter name for new saved search</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>15</number>
|
||||
|
@ -6,6 +6,8 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
|
||||
from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, \
|
||||
pyqtSignal, SIGNAL, QObject, QDialog, QCompleter, \
|
||||
QAction, QKeySequence
|
||||
@ -368,6 +370,10 @@ class SearchBoxMixin(object):
|
||||
self.action_focus_search.triggered.connect(lambda x:
|
||||
self.search.setFocus(Qt.OtherFocusReason))
|
||||
self.addAction(self.action_focus_search)
|
||||
self.search.setStatusTip(re.sub(r'<\w+>', ' ',
|
||||
unicode(self.search.toolTip())))
|
||||
self.advanced_search_button.setStatusTip(self.advanced_search_button.toolTip())
|
||||
self.clear_button.setStatusTip(self.clear_button.toolTip())
|
||||
|
||||
def search_box_cleared(self):
|
||||
self.tags_view.clear()
|
||||
@ -396,6 +402,12 @@ class SavedSearchBoxMixin(object):
|
||||
self.saved_search.delete_search_button_clicked)
|
||||
self.connect(self.copy_search_button, SIGNAL('clicked()'),
|
||||
self.saved_search.copy_search_button_clicked)
|
||||
self.saved_search.setToolTip(
|
||||
_('Choose saved search or enter name for new saved search'))
|
||||
self.saved_search.setStatusTip(self.saved_search.toolTip())
|
||||
for x in ('copy', 'save', 'delete'):
|
||||
b = getattr(self, x+'_search_button')
|
||||
b.setStatusTip(b.toolTip())
|
||||
|
||||
|
||||
def saved_searches_changed(self):
|
||||
|
@ -11,6 +11,7 @@ class SearchRestrictionMixin(object):
|
||||
self.library_view.model().count_changed_signal.connect(self.restriction_count_changed)
|
||||
self.search_restriction.setSizeAdjustPolicy(self.search_restriction.AdjustToMinimumContentsLengthWithIcon)
|
||||
self.search_restriction.setMinimumContentsLength(10)
|
||||
self.search_restriction.setStatusTip(self.search_restriction.toolTip())
|
||||
|
||||
'''
|
||||
Adding and deleting books while restricted creates a complexity. When added,
|
||||
|
@ -768,6 +768,9 @@ class TagBrowserWidget(QWidget): # {{{
|
||||
for x in (_('Sort by name'), _('Sort by popularity'),
|
||||
_('Sort by average rating')):
|
||||
parent.sort_by.addItem(x)
|
||||
parent.sort_by.setToolTip(
|
||||
_('Set the sort order for entries in the Tag Browser'))
|
||||
parent.sort_by.setStatusTip(parent.sort_by.toolTip())
|
||||
parent.sort_by.setCurrentIndex(0)
|
||||
self._layout.addWidget(parent.sort_by)
|
||||
|
||||
@ -776,9 +779,16 @@ class TagBrowserWidget(QWidget): # {{{
|
||||
parent.tag_match.addItem(x)
|
||||
parent.tag_match.setCurrentIndex(0)
|
||||
self._layout.addWidget(parent.tag_match)
|
||||
parent.tag_match.setToolTip(
|
||||
_('When selecting multiple entries in the Tag Browser '
|
||||
'match any or all of them'))
|
||||
parent.tag_match.setStatusTip(parent.tag_match.toolTip())
|
||||
|
||||
parent.edit_categories = QPushButton(_('Manage &user categories'), parent)
|
||||
self._layout.addWidget(parent.edit_categories)
|
||||
parent.edit_categories.setToolTip(
|
||||
_('Add your own categories to the Tag Browser'))
|
||||
parent.edit_categories.setStatusTip(parent.edit_categories.toolTip())
|
||||
|
||||
|
||||
# }}}
|
||||
|
@ -163,6 +163,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceMixin, ToolbarMixin, # {{{
|
||||
self.donate_action = self.system_tray_menu.addAction(
|
||||
QIcon(I('donate.svg')), _('&Donate to support calibre'))
|
||||
self.donate_button.setDefaultAction(self.donate_action)
|
||||
self.donate_button.setStatusTip(self.donate_button.toolTip())
|
||||
self.eject_action = self.system_tray_menu.addAction(
|
||||
QIcon(I('eject.svg')), _('&Eject connected device'))
|
||||
self.eject_action.setEnabled(False)
|
||||
|
@ -298,6 +298,14 @@ class LocationModel(QAbstractListModel):
|
||||
row = 3
|
||||
return row
|
||||
|
||||
def get_tooltip(self, row, drow):
|
||||
ans = self.tooltips[row]
|
||||
if row > 0:
|
||||
fs = self.free[drow-1]
|
||||
if fs > -1:
|
||||
ans += '\n\n%s '%(human_readable(fs)) + _('free')
|
||||
return ans
|
||||
|
||||
def data(self, index, role):
|
||||
row = index.row()
|
||||
drow = self.get_device_row(row)
|
||||
@ -308,12 +316,8 @@ class LocationModel(QAbstractListModel):
|
||||
data = QVariant(text)
|
||||
elif role == Qt.DecorationRole:
|
||||
data = self.icons[drow]
|
||||
elif role == Qt.ToolTipRole:
|
||||
ans = self.tooltips[row]
|
||||
if row > 0:
|
||||
fs = self.free[drow-1]
|
||||
if fs > -1:
|
||||
ans += '\n\n%s '%(human_readable(fs)) + _('free')
|
||||
elif role in (Qt.ToolTipRole, Qt.StatusTipRole):
|
||||
ans = self.get_tooltip(row, drow)
|
||||
data = QVariant(ans)
|
||||
elif role == Qt.SizeHintRole:
|
||||
data = QVariant(QSize(155, 90))
|
||||
@ -1011,12 +1015,14 @@ class LayoutButton(QToolButton):
|
||||
label =_('Show')
|
||||
self.setText(label + ' ' + self.label)
|
||||
self.setToolTip(self.text())
|
||||
self.setStatusTip(self.text())
|
||||
|
||||
def set_state_to_hide(self, *args):
|
||||
self.setChecked(True)
|
||||
label = _('Hide')
|
||||
self.setText(label + ' ' + self.label)
|
||||
self.setToolTip(self.text())
|
||||
self.setStatusTip(self.text())
|
||||
|
||||
def update_state(self, *args):
|
||||
if self.splitter.is_side_index_hidden:
|
||||
|
Loading…
x
Reference in New Issue
Block a user