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.book_details import BookDetails
|
||||||
from calibre.gui2.notify import get_notifier
|
from calibre.gui2.notify import get_notifier
|
||||||
|
|
||||||
|
|
||||||
_keep_refs = []
|
_keep_refs = []
|
||||||
|
|
||||||
def partial(*args, **kwargs):
|
def partial(*args, **kwargs):
|
||||||
@ -182,6 +181,7 @@ class ToolbarMixin(object): # {{{
|
|||||||
for ch in self.tool_bar.children():
|
for ch in self.tool_bar.children():
|
||||||
if isinstance(ch, QToolButton):
|
if isinstance(ch, QToolButton):
|
||||||
ch.setCursor(Qt.PointingHandCursor)
|
ch.setCursor(Qt.PointingHandCursor)
|
||||||
|
ch.setStatusTip(ch.toolTip())
|
||||||
|
|
||||||
self.tool_bar.contextMenuEvent = self.no_op
|
self.tool_bar.contextMenuEvent = self.no_op
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ class StatusBar(QStatusBar): # {{{
|
|||||||
self.notifier = get_notifier(systray)
|
self.notifier = get_notifier(systray)
|
||||||
|
|
||||||
def show_message(self, msg, timeout=0):
|
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 self.notifier is not None and not config['disable_tray_notification']:
|
||||||
if isosx and isinstance(msg, unicode):
|
if isosx and isinstance(msg, unicode):
|
||||||
try:
|
try:
|
||||||
@ -377,7 +377,8 @@ class StatusBar(QStatusBar): # {{{
|
|||||||
self.notifier(msg)
|
self.notifier(msg)
|
||||||
|
|
||||||
def clear_message(self):
|
def clear_message(self):
|
||||||
QStatusBar.clearMessage(self)
|
self.clearMessage()
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Choose saved search or enter name for new saved search</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumContentsLength">
|
<property name="minimumContentsLength">
|
||||||
<number>15</number>
|
<number>15</number>
|
||||||
|
@ -6,6 +6,8 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, \
|
from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, \
|
||||||
pyqtSignal, SIGNAL, QObject, QDialog, QCompleter, \
|
pyqtSignal, SIGNAL, QObject, QDialog, QCompleter, \
|
||||||
QAction, QKeySequence
|
QAction, QKeySequence
|
||||||
@ -368,6 +370,10 @@ class SearchBoxMixin(object):
|
|||||||
self.action_focus_search.triggered.connect(lambda x:
|
self.action_focus_search.triggered.connect(lambda x:
|
||||||
self.search.setFocus(Qt.OtherFocusReason))
|
self.search.setFocus(Qt.OtherFocusReason))
|
||||||
self.addAction(self.action_focus_search)
|
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):
|
def search_box_cleared(self):
|
||||||
self.tags_view.clear()
|
self.tags_view.clear()
|
||||||
@ -396,6 +402,12 @@ class SavedSearchBoxMixin(object):
|
|||||||
self.saved_search.delete_search_button_clicked)
|
self.saved_search.delete_search_button_clicked)
|
||||||
self.connect(self.copy_search_button, SIGNAL('clicked()'),
|
self.connect(self.copy_search_button, SIGNAL('clicked()'),
|
||||||
self.saved_search.copy_search_button_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):
|
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.library_view.model().count_changed_signal.connect(self.restriction_count_changed)
|
||||||
self.search_restriction.setSizeAdjustPolicy(self.search_restriction.AdjustToMinimumContentsLengthWithIcon)
|
self.search_restriction.setSizeAdjustPolicy(self.search_restriction.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.search_restriction.setMinimumContentsLength(10)
|
self.search_restriction.setMinimumContentsLength(10)
|
||||||
|
self.search_restriction.setStatusTip(self.search_restriction.toolTip())
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Adding and deleting books while restricted creates a complexity. When added,
|
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'),
|
for x in (_('Sort by name'), _('Sort by popularity'),
|
||||||
_('Sort by average rating')):
|
_('Sort by average rating')):
|
||||||
parent.sort_by.addItem(x)
|
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)
|
parent.sort_by.setCurrentIndex(0)
|
||||||
self._layout.addWidget(parent.sort_by)
|
self._layout.addWidget(parent.sort_by)
|
||||||
|
|
||||||
@ -776,9 +779,16 @@ class TagBrowserWidget(QWidget): # {{{
|
|||||||
parent.tag_match.addItem(x)
|
parent.tag_match.addItem(x)
|
||||||
parent.tag_match.setCurrentIndex(0)
|
parent.tag_match.setCurrentIndex(0)
|
||||||
self._layout.addWidget(parent.tag_match)
|
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)
|
parent.edit_categories = QPushButton(_('Manage &user categories'), parent)
|
||||||
self._layout.addWidget(parent.edit_categories)
|
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(
|
self.donate_action = self.system_tray_menu.addAction(
|
||||||
QIcon(I('donate.svg')), _('&Donate to support calibre'))
|
QIcon(I('donate.svg')), _('&Donate to support calibre'))
|
||||||
self.donate_button.setDefaultAction(self.donate_action)
|
self.donate_button.setDefaultAction(self.donate_action)
|
||||||
|
self.donate_button.setStatusTip(self.donate_button.toolTip())
|
||||||
self.eject_action = self.system_tray_menu.addAction(
|
self.eject_action = self.system_tray_menu.addAction(
|
||||||
QIcon(I('eject.svg')), _('&Eject connected device'))
|
QIcon(I('eject.svg')), _('&Eject connected device'))
|
||||||
self.eject_action.setEnabled(False)
|
self.eject_action.setEnabled(False)
|
||||||
|
@ -298,6 +298,14 @@ class LocationModel(QAbstractListModel):
|
|||||||
row = 3
|
row = 3
|
||||||
return row
|
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):
|
def data(self, index, role):
|
||||||
row = index.row()
|
row = index.row()
|
||||||
drow = self.get_device_row(row)
|
drow = self.get_device_row(row)
|
||||||
@ -308,12 +316,8 @@ class LocationModel(QAbstractListModel):
|
|||||||
data = QVariant(text)
|
data = QVariant(text)
|
||||||
elif role == Qt.DecorationRole:
|
elif role == Qt.DecorationRole:
|
||||||
data = self.icons[drow]
|
data = self.icons[drow]
|
||||||
elif role == Qt.ToolTipRole:
|
elif role in (Qt.ToolTipRole, Qt.StatusTipRole):
|
||||||
ans = self.tooltips[row]
|
ans = self.get_tooltip(row, drow)
|
||||||
if row > 0:
|
|
||||||
fs = self.free[drow-1]
|
|
||||||
if fs > -1:
|
|
||||||
ans += '\n\n%s '%(human_readable(fs)) + _('free')
|
|
||||||
data = QVariant(ans)
|
data = QVariant(ans)
|
||||||
elif role == Qt.SizeHintRole:
|
elif role == Qt.SizeHintRole:
|
||||||
data = QVariant(QSize(155, 90))
|
data = QVariant(QSize(155, 90))
|
||||||
@ -1011,12 +1015,14 @@ class LayoutButton(QToolButton):
|
|||||||
label =_('Show')
|
label =_('Show')
|
||||||
self.setText(label + ' ' + self.label)
|
self.setText(label + ' ' + self.label)
|
||||||
self.setToolTip(self.text())
|
self.setToolTip(self.text())
|
||||||
|
self.setStatusTip(self.text())
|
||||||
|
|
||||||
def set_state_to_hide(self, *args):
|
def set_state_to_hide(self, *args):
|
||||||
self.setChecked(True)
|
self.setChecked(True)
|
||||||
label = _('Hide')
|
label = _('Hide')
|
||||||
self.setText(label + ' ' + self.label)
|
self.setText(label + ' ' + self.label)
|
||||||
self.setToolTip(self.text())
|
self.setToolTip(self.text())
|
||||||
|
self.setStatusTip(self.text())
|
||||||
|
|
||||||
def update_state(self, *args):
|
def update_state(self, *args):
|
||||||
if self.splitter.is_side_index_hidden:
|
if self.splitter.is_side_index_hidden:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user