mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Clearer description of match type menu for alter tag browser
This commit is contained in:
parent
3a52138c71
commit
42ec55a59e
@ -23,7 +23,7 @@ from calibre.gui2.dialogs.tag_categories import TagCategories
|
|||||||
from calibre.gui2.dialogs.tag_list_editor import TagListEditor
|
from calibre.gui2.dialogs.tag_list_editor import TagListEditor
|
||||||
from calibre.gui2.dialogs.edit_authors_dialog import EditAuthorsDialog
|
from calibre.gui2.dialogs.edit_authors_dialog import EditAuthorsDialog
|
||||||
|
|
||||||
class TagBrowserMixin(object): # {{{
|
class TagBrowserMixin(object): # {{{
|
||||||
|
|
||||||
def __init__(self, db):
|
def __init__(self, db):
|
||||||
self.library_view.model().count_changed_signal.connect(self.tags_view.recount)
|
self.library_view.model().count_changed_signal.connect(self.tags_view.recount)
|
||||||
@ -60,7 +60,7 @@ class TagBrowserMixin(object): # {{{
|
|||||||
self.do_saved_search_edit, (None,), 'search')
|
self.do_saved_search_edit, (None,), 'search')
|
||||||
):
|
):
|
||||||
m = self.alter_tb.manage_menu
|
m = self.alter_tb.manage_menu
|
||||||
m.addAction( QIcon(I(category_icon_map[cat_name])), text,
|
m.addAction(QIcon(I(category_icon_map[cat_name])), text,
|
||||||
partial(func, *args))
|
partial(func, *args))
|
||||||
|
|
||||||
def do_restriction_error(self):
|
def do_restriction_error(self):
|
||||||
@ -213,9 +213,9 @@ class TagBrowserMixin(object): # {{{
|
|||||||
tag_to_match=tag, data=result, sorter=key)
|
tag_to_match=tag, data=result, sorter=key)
|
||||||
d.exec_()
|
d.exec_()
|
||||||
if d.result() == d.Accepted:
|
if d.result() == d.Accepted:
|
||||||
to_rename = d.to_rename # dict of old id to new name
|
to_rename = d.to_rename # dict of old id to new name
|
||||||
to_delete = d.to_delete # list of ids
|
to_delete = d.to_delete # list of ids
|
||||||
orig_name = d.original_names # dict of id: name
|
orig_name = d.original_names # dict of id: name
|
||||||
|
|
||||||
rename_func = None
|
rename_func = None
|
||||||
if category == 'tags':
|
if category == 'tags':
|
||||||
@ -227,7 +227,7 @@ class TagBrowserMixin(object): # {{{
|
|||||||
elif category == 'publisher':
|
elif category == 'publisher':
|
||||||
rename_func = db.rename_publisher
|
rename_func = db.rename_publisher
|
||||||
delete_func = db.delete_publisher_using_id
|
delete_func = db.delete_publisher_using_id
|
||||||
else: # must be custom
|
else: # must be custom
|
||||||
cc_label = db.field_metadata[category]['label']
|
cc_label = db.field_metadata[category]['label']
|
||||||
rename_func = partial(db.rename_custom_item, label=cc_label)
|
rename_func = partial(db.rename_custom_item, label=cc_label)
|
||||||
delete_func = partial(db.delete_custom_item_using_id, label=cc_label)
|
delete_func = partial(db.delete_custom_item_using_id, label=cc_label)
|
||||||
@ -265,7 +265,7 @@ class TagBrowserMixin(object): # {{{
|
|||||||
delete_func = db.delete_series_using_id
|
delete_func = db.delete_series_using_id
|
||||||
elif category == 'publisher':
|
elif category == 'publisher':
|
||||||
delete_func = db.delete_publisher_using_id
|
delete_func = db.delete_publisher_using_id
|
||||||
else: # must be custom
|
else: # must be custom
|
||||||
cc_label = db.field_metadata[category]['label']
|
cc_label = db.field_metadata[category]['label']
|
||||||
delete_func = partial(db.delete_custom_item_using_id, label=cc_label)
|
delete_func = partial(db.delete_custom_item_using_id, label=cc_label)
|
||||||
m = self.tags_view.model()
|
m = self.tags_view.model()
|
||||||
@ -280,7 +280,7 @@ class TagBrowserMixin(object): # {{{
|
|||||||
def do_tag_item_renamed(self):
|
def do_tag_item_renamed(self):
|
||||||
# Clean up library view and search
|
# Clean up library view and search
|
||||||
# get information to redo the selection
|
# get information to redo the selection
|
||||||
rows = [r.row() for r in \
|
rows = [r.row() for r in
|
||||||
self.library_view.selectionModel().selectedRows()]
|
self.library_view.selectionModel().selectedRows()]
|
||||||
m = self.library_view.model()
|
m = self.library_view.model()
|
||||||
ids = [m.id(r) for r in rows]
|
ids = [m.id(r) for r in rows]
|
||||||
@ -315,7 +315,7 @@ class TagBrowserMixin(object): # {{{
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class TagBrowserWidget(QWidget): # {{{
|
class TagBrowserWidget(QWidget): # {{{
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QWidget.__init__(self, parent)
|
QWidget.__init__(self, parent)
|
||||||
@ -407,22 +407,24 @@ class TagBrowserWidget(QWidget): # {{{
|
|||||||
a = sb.m.addAction(x)
|
a = sb.m.addAction(x)
|
||||||
sb.bg.addAction(a)
|
sb.bg.addAction(a)
|
||||||
a.setCheckable(True)
|
a.setCheckable(True)
|
||||||
if i == 0: a.setChecked(True)
|
if i == 0:
|
||||||
|
a.setChecked(True)
|
||||||
sb.setToolTip(
|
sb.setToolTip(
|
||||||
_('Set the sort order for entries in the Tag Browser'))
|
_('Set the sort order for entries in the Tag Browser'))
|
||||||
sb.setStatusTip(sb.toolTip())
|
sb.setStatusTip(sb.toolTip())
|
||||||
|
|
||||||
ma = l.m.addAction(_('Match type'))
|
ma = l.m.addAction(_('Search type when selecting multiple items'))
|
||||||
ma.m = l.match_menu = QMenu(l.m)
|
ma.m = l.match_menu = QMenu(l.m)
|
||||||
ma.setMenu(ma.m)
|
ma.setMenu(ma.m)
|
||||||
ma.ag = QActionGroup(ma)
|
ma.ag = QActionGroup(ma)
|
||||||
|
|
||||||
# Must be in the same order as db2.MATCH_TYPE
|
# Must be in the same order as db2.MATCH_TYPE
|
||||||
for i, x in enumerate((_('Match any'), _('Match all'))):
|
for i, x in enumerate((_('Match any of the items'), _('Match all of the items'))):
|
||||||
a = ma.m.addAction(x)
|
a = ma.m.addAction(x)
|
||||||
ma.ag.addAction(a)
|
ma.ag.addAction(a)
|
||||||
a.setCheckable(True)
|
a.setCheckable(True)
|
||||||
if i == 0: a.setChecked(True)
|
if i == 0:
|
||||||
|
a.setChecked(True)
|
||||||
ma.setToolTip(
|
ma.setToolTip(
|
||||||
_('When selecting multiple entries in the Tag Browser '
|
_('When selecting multiple entries in the Tag Browser '
|
||||||
'match any or all of them'))
|
'match any or all of them'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user