Keep position when deleting tags in the tag editor

Fixes #1226093 [[Enhancement] Tag editor should remember place](https://bugs.launchpad.net/calibre/+bug/1226093)
This commit is contained in:
Kovid Goyal 2013-09-17 15:27:43 +05:30
parent 7c101e4e09
commit fe26aea85a

View File

@ -69,6 +69,7 @@ class TagEditor(QDialog, Ui_TagEditor):
if not items:
error_dialog(self, 'No tags selected', 'You must select at least one tag from the list of Available tags.').exec_()
return
pos = self.available_tags.verticalScrollBar().value()
for item in items:
used = self.db.is_tag_used(unicode(item.text())) \
if self.key is None else \
@ -92,6 +93,7 @@ class TagEditor(QDialog, Ui_TagEditor):
label=self.key)
self.db.refresh_ids(bks)
self.available_tags.takeItem(self.available_tags.row(item))
self.available_tags.verticalScrollBar().setValue(pos)
def apply_tags(self, item=None):
items = self.available_tags.selectedItems() if item is None else [item]