mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Clean up tag browser context and config menus a bit.
- When right-clicking in tag browser white space, remove any context menu that depends on having an index. - Remove general subcategorization menu options from the context menu. These are global, not part of context for the current index. - Add a menu option to the config menu to open Prefs / L&F / Tag browser. This permits easily getting to the global subcat and display options, avoiding adding more menu lines to the config menu.
This commit is contained in:
parent
d592a8d338
commit
cd0d2eb53b
@ -879,6 +879,10 @@ class TagBrowserWidget(QFrame): # {{{
|
||||
action=ac, group=_('Tag browser'))
|
||||
ac.triggered.connect(self.filter_book_list)
|
||||
|
||||
l.m.addSeparator()
|
||||
ac = l.m.addAction(QIcon.ic('config.png'), _('Preferences / Look & feel / Tag browser'))
|
||||
ac.triggered.connect(self.show_tag_browser_preferences)
|
||||
|
||||
ac = QAction(parent)
|
||||
parent.addAction(ac)
|
||||
parent.keyboard.register_shortcut('tag browser toggle item',
|
||||
@ -897,6 +901,11 @@ class TagBrowserWidget(QFrame): # {{{
|
||||
# self.leak_test_timer.timeout.connect(self.test_for_leak)
|
||||
# self.leak_test_timer.start(5000)
|
||||
|
||||
def show_tag_browser_preferences(self):
|
||||
from calibre.gui2.ui import get_gui
|
||||
get_gui().iactions['Preferences'].do_config(initial_plugin=('Interface', 'Look & Feel', 'tag_browser_tab'),
|
||||
close_after_initial=True)
|
||||
|
||||
def about_to_show_configure_menu(self):
|
||||
ac = self.alter_tb.m.show_counts_action
|
||||
p = gprefs['tag_browser_show_counts']
|
||||
|
@ -1203,9 +1203,10 @@ class TagsView(QTreeView): # {{{
|
||||
self.context_menu.addSeparator()
|
||||
add_show_hidden_categories()
|
||||
|
||||
if key is not None:
|
||||
# partitioning. If partitioning is active, provide a way to turn it on or
|
||||
# off for this category.
|
||||
if gprefs['tags_browser_partition_method'] != 'disable' and key is not None:
|
||||
if gprefs['tags_browser_partition_method'] != 'disable':
|
||||
m = self.context_menu
|
||||
p = self.db.prefs.get('tag_browser_dont_collapse', gprefs['tag_browser_dont_collapse'])
|
||||
# Use the prefix for a user category. The
|
||||
@ -1224,33 +1225,6 @@ class TagsView(QTreeView): # {{{
|
||||
partial(self.context_menu_handler, action='dont_collapse_category',
|
||||
category=cat, key=k, extra=p))
|
||||
a.setIcon(QIcon.ic('config.png'))
|
||||
# Set the partitioning scheme
|
||||
m = self.context_menu.addMenu(_('Change sub-categorization scheme'))
|
||||
m.setIcon(QIcon.ic('config.png'))
|
||||
da = m.addAction(_('Disable'),
|
||||
partial(self.context_menu_handler, action='categorization', category='disable'))
|
||||
fla = m.addAction(_('By first letter'),
|
||||
partial(self.context_menu_handler, action='categorization', category='first letter'))
|
||||
pa = m.addAction(_('Partition'),
|
||||
partial(self.context_menu_handler, action='categorization', category='partition'))
|
||||
if self.collapse_model == 'disable':
|
||||
da.setCheckable(True)
|
||||
da.setChecked(True)
|
||||
elif self.collapse_model == 'first letter':
|
||||
fla.setCheckable(True)
|
||||
fla.setChecked(True)
|
||||
else:
|
||||
pa.setCheckable(True)
|
||||
pa.setChecked(True)
|
||||
|
||||
if config['sort_tags_by'] != "name":
|
||||
fla.setEnabled(False)
|
||||
m.hovered.connect(self.collapse_menu_hovered)
|
||||
fla.setToolTip(_('First letter is usable only when sorting by name'))
|
||||
# Apparently one cannot set a tooltip to empty, so use a star and
|
||||
# deal with it in the hover method
|
||||
da.setToolTip('*')
|
||||
pa.setToolTip('*')
|
||||
|
||||
# Add expand menu items
|
||||
self.context_menu.addSeparator()
|
||||
|
Loading…
x
Reference in New Issue
Block a user