mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix bug 743645: Match any/all combo reverts on restart
This commit is contained in:
parent
177d15bdbb
commit
1982507fba
@ -81,6 +81,8 @@ def _config():
|
||||
help=_('Use Roman numerals for series number'))
|
||||
c.add_opt('sort_tags_by', default='name',
|
||||
help=_('Sort tags list by name, popularity, or rating'))
|
||||
c.add_opt('match_tags_type', default='any',
|
||||
help=_('Match tags by any or all.'))
|
||||
c.add_opt('cover_flow_queue_length', default=6,
|
||||
help=_('Number of covers to show in the cover browsing mode'))
|
||||
c.add_opt('LRF_conversion_defaults', default=[],
|
||||
|
@ -158,11 +158,14 @@ class TagsView(QTreeView): # {{{
|
||||
self.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||
pop = config['sort_tags_by']
|
||||
self.sort_by.setCurrentIndex(self.db.CATEGORY_SORTS.index(pop))
|
||||
match_pop = config['match_tags_type']
|
||||
self.tag_match.setCurrentIndex(self.db.MATCH_TYPE.index(match_pop))
|
||||
if not self.made_connections:
|
||||
self.clicked.connect(self.toggle)
|
||||
self.customContextMenuRequested.connect(self.show_context_menu)
|
||||
self.refresh_required.connect(self.recount, type=Qt.QueuedConnection)
|
||||
self.sort_by.currentIndexChanged.connect(self.sort_changed)
|
||||
self.tag_match.currentIndexChanged.connect(self.match_changed)
|
||||
self.made_connections = True
|
||||
self.refresh_signal_processed = True
|
||||
db.add_listener(self.database_changed)
|
||||
@ -180,6 +183,9 @@ class TagsView(QTreeView): # {{{
|
||||
config.set('sort_tags_by', self.db.CATEGORY_SORTS[pop])
|
||||
self.recount()
|
||||
|
||||
def match_changed(self, pop):
|
||||
config.set('match_tags_type', self.db.MATCH_TYPE[pop])
|
||||
|
||||
def set_search_restriction(self, s):
|
||||
if s:
|
||||
self.search_restriction = s
|
||||
@ -2114,6 +2120,7 @@ class TagBrowserWidget(QWidget): # {{{
|
||||
parent.sort_by.setCurrentIndex(0)
|
||||
self._layout.addWidget(parent.sort_by)
|
||||
|
||||
# Must be in the same order as db2.MATCH_TYPE
|
||||
parent.tag_match = QComboBox(parent)
|
||||
for x in (_('Match any'), _('Match all')):
|
||||
parent.tag_match.addItem(x)
|
||||
|
@ -1228,6 +1228,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
########## data structures for get_categories
|
||||
|
||||
CATEGORY_SORTS = ('name', 'popularity', 'rating')
|
||||
MATCH_TYPE = ('any', 'all')
|
||||
|
||||
class TCat_Tag(object):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user