Tags editor: restore the focus to the last box typed in.

This commit is contained in:
Charles Haley 2015-07-13 13:10:09 +02:00
parent 3c68d52fae
commit b2333c1773

View File

@ -73,7 +73,11 @@ class TagEditor(QDialog, Ui_TagEditor):
self.available_filter_input.textChanged.connect(self.filter_tags)
self.applied_filter_input.textChanged.connect(partial(self.filter_tags, which='applied_tags'))
self.available_filter_input.setFocus()
# Restore the focus to the last input box used (typed into)
self.add_tag_input.textChanged.connect(partial(self.edit_box_changed, which="add_tag_input"))
self.available_filter_input.textChanged.connect(partial(self.edit_box_changed, which="available_filter_input"))
self.applied_filter_input.textChanged.connect(partial(self.edit_box_changed, which="applied_filter_input"))
getattr(self, gprefs.get('tag_editor_last_filter', 'add_tag_input')).setFocus()
if islinux:
self.available_tags.itemDoubleClicked.connect(self.apply_tags)
@ -85,6 +89,10 @@ class TagEditor(QDialog, Ui_TagEditor):
if geom is not None:
self.restoreGeometry(geom)
def edit_box_changed(self, which):
gprefs['tag_editor_last_filter'] = which
def delete_tags(self, item=None):
confirms, deletes = [], []
items = self.available_tags.selectedItems() if item is None else [item]