mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-01 05:13:02 +02:00
Fix #7888 ({tags} control generate 'tags' word for empty tags collection). Don't refresh the Tag browser if it is hidden. SHould speed up metadata editing with large libraries, if you hide teh Tag Browser.
This commit is contained in:
commit
c20a6359d0
4 changed files with 19 additions and 7 deletions
|
|
@ -145,7 +145,7 @@ def apply_tags(self, node=None):
|
|||
index = self.all_items[node.data(Qt.UserRole).toPyObject()].index
|
||||
if index not in self.applied_items:
|
||||
self.applied_items.append(index)
|
||||
self.applied_items.sort(key=lambda x:sort_key(self.all_items[x]))
|
||||
self.applied_items.sort(key=lambda x:sort_key(self.all_items[x].name))
|
||||
self.display_filtered_categories(None)
|
||||
|
||||
def unapply_tags(self, node=None):
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ def __init__(self, parent):
|
|||
_('Tag Browser'), I('tags.png'),
|
||||
parent=parent, side_index=0, initial_side_size=200,
|
||||
shortcut=_('Shift+Alt+T'))
|
||||
parent.tb_splitter.state_changed.connect(
|
||||
self.tb_widget.set_pane_is_visible, Qt.QueuedConnection)
|
||||
parent.tb_splitter.addWidget(self.tb_widget)
|
||||
parent.tb_splitter.addWidget(parent.cb_splitter)
|
||||
parent.tb_splitter.setCollapsible(parent.tb_splitter.other_index, False)
|
||||
|
|
|
|||
|
|
@ -87,6 +87,13 @@ def __init__(self, parent=None):
|
|||
self.setDragDropMode(self.DropOnly)
|
||||
self.setDropIndicatorShown(True)
|
||||
self.setAutoExpandDelay(500)
|
||||
self.pane_is_visible = False
|
||||
|
||||
def set_pane_is_visible(self, to_what):
|
||||
pv = self.pane_is_visible
|
||||
self.pane_is_visible = to_what
|
||||
if to_what and not pv:
|
||||
self.recount()
|
||||
|
||||
def set_database(self, db, tag_match, sort_by):
|
||||
self.hidden_categories = config['tag_browser_hidden_categories']
|
||||
|
|
@ -300,7 +307,7 @@ def is_visible(self, idx):
|
|||
return self.isExpanded(idx)
|
||||
|
||||
def recount(self, *args):
|
||||
if self.disable_recounting:
|
||||
if self.disable_recounting or not self.pane_is_visible:
|
||||
return
|
||||
self.refresh_signal_processed = True
|
||||
ci = self.currentIndex()
|
||||
|
|
@ -969,6 +976,7 @@ def __init__(self, parent):
|
|||
self._layout.setContentsMargins(0,0,0,0)
|
||||
|
||||
parent.tags_view = TagsView(parent)
|
||||
self.tags_view = parent.tags_view
|
||||
self._layout.addWidget(parent.tags_view)
|
||||
|
||||
parent.sort_by = QComboBox(parent)
|
||||
|
|
@ -998,6 +1006,9 @@ def __init__(self, parent):
|
|||
_('Add your own categories to the Tag Browser'))
|
||||
parent.edit_categories.setStatusTip(parent.edit_categories.toolTip())
|
||||
|
||||
def set_pane_is_visible(self, to_what):
|
||||
self.tags_view.set_pane_is_visible(to_what)
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,10 +119,8 @@ def get_value(self, key, args, kwargs):
|
|||
try:
|
||||
b = self.book.get_user_metadata(key, False)
|
||||
except:
|
||||
if DEBUG:
|
||||
traceback.print_exc()
|
||||
traceback.print_exc()
|
||||
b = None
|
||||
|
||||
if b is not None and b['datatype'] == 'composite':
|
||||
if key in self.composite_values:
|
||||
return self.composite_values[key]
|
||||
|
|
@ -135,8 +133,7 @@ def get_value(self, key, args, kwargs):
|
|||
return val.replace('/', '_').replace('\\', '_')
|
||||
return ''
|
||||
except:
|
||||
if DEBUG:
|
||||
traceback.print_exc()
|
||||
traceback.print_exc()
|
||||
return key
|
||||
|
||||
def get_components(template, mi, id, timefmt='%b %Y', length=250,
|
||||
|
|
@ -155,6 +152,8 @@ def get_components(template, mi, id, timefmt='%b %Y', length=250,
|
|||
format_args['tags'] = mi.format_tags()
|
||||
if format_args['tags'].startswith('/'):
|
||||
format_args['tags'] = format_args['tags'][1:]
|
||||
else:
|
||||
format_args['tags'] = ''
|
||||
if mi.series:
|
||||
format_args['series'] = tsfmt(mi.series)
|
||||
if mi.series_index is not None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue