diff --git a/src/calibre/gui2/dialogs/edit_authors_dialog.py b/src/calibre/gui2/dialogs/edit_authors_dialog.py index 80c8ee510b..e0cefbd2c2 100644 --- a/src/calibre/gui2/dialogs/edit_authors_dialog.py +++ b/src/calibre/gui2/dialogs/edit_authors_dialog.py @@ -38,6 +38,8 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): except: pass + self.buttonBox.button(QDialogButtonBox.Ok).setText(_('&OK')) + self.buttonBox.button(QDialogButtonBox.Cancel).setText(_('&Cancel')) self.buttonBox.accepted.connect(self.accepted) # Set up the column headings @@ -114,6 +116,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): self.find_box.lineEdit().returnPressed.connect(self.do_find) self.find_box.editTextChanged.connect(self.find_text_changed) self.find_button.clicked.connect(self.do_find) + self.find_button.setDefault(True) l = QLabel(self.table) self.not_found_label = l diff --git a/src/calibre/gui2/dialogs/tag_list_editor.py b/src/calibre/gui2/dialogs/tag_list_editor.py index 026e68494d..39ea8fb997 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.py +++ b/src/calibre/gui2/dialogs/tag_list_editor.py @@ -1,7 +1,8 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -from PyQt5.Qt import (Qt, QDialog, QTableWidgetItem, QIcon, QByteArray, QSize) +from PyQt5.Qt import (Qt, QDialog, QTableWidgetItem, QIcon, QByteArray, QSize, + QDialogButtonBox) from calibre.gui2.dialogs.tag_list_editor_ui import Ui_TagListEditor from calibre.gui2 import question_dialog, error_dialog, info_dialog, gprefs @@ -147,10 +148,17 @@ class TagListEditor(QDialog, Ui_TagListEditor): self.rename_button.clicked.connect(self.rename_tag) self.table.itemDoubleClicked.connect(self._rename_tag) self.table.itemChanged.connect(self.finish_editing) + + self.buttonBox.button(QDialogButtonBox.Ok).setText(_('&OK')) + self.buttonBox.button(QDialogButtonBox.Cancel).setText(_('&Cancel')) self.buttonBox.accepted.connect(self.accepted) self.search_box.initialize('tag_list_search_box_' + cat_name) + self.search_box.editTextChanged.connect(self.find_text_changed) self.search_button.clicked.connect(self.search_clicked) + self.search_button.setDefault(True) + + self.start_find_pos = -1 try: geom = gprefs.get('tag_list_editor_dialog_geometry', None) @@ -161,21 +169,21 @@ class TagListEditor(QDialog, Ui_TagListEditor): except: pass + def find_text_changed(self): + self.start_find_pos = -1 + def search_clicked(self): search_for = icu_lower(unicode(self.search_box.text())) if not search_for: error_dialog(self, _('Find'), _('You must enter some text to search for'), show=True, show_copy_button=False) return - row = self.table.currentRow() - if row < 0: - row = 0 rows = self.table.rowCount() for i in range(0, rows): - row += 1 - if row >= rows: - row = 0 - item = self.table.item(row, 0) + self.start_find_pos += 1 + if self.start_find_pos >= rows: + self.start_find_pos = 0 + item = self.table.item(self.start_find_pos, 0) if search_for in icu_lower(unicode(item.text())): self.table.setCurrentItem(item) return diff --git a/src/calibre/gui2/dialogs/tag_list_editor.ui b/src/calibre/gui2/dialogs/tag_list_editor.ui index be0da561fb..ec434c6d09 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.ui +++ b/src/calibre/gui2/dialogs/tag_list_editor.ui @@ -18,19 +18,35 @@ :/images/chapters.png:/images/chapters.png - + + + + + &Search for: + + + search_box + + + Search for an item in the Tag column + + + 100 + 0 + + - + - Find + &Find Copy the selected color name to the clipboard