Edit metadata dialog: When clicking Next and Previous preserve the current tab of the edit comments widget. Fixes #1467129 [[Enhancement] HTML View in Metadata](https://bugs.launchpad.net/calibre/+bug/1467129)

This commit is contained in:
Kovid Goyal 2015-06-21 07:59:50 +05:30
parent 7ac8bf12b7
commit 0c88e6c5e2
2 changed files with 11 additions and 0 deletions

View File

@ -730,6 +730,14 @@ class Editor(QWidget): # {{{
self.editor.html = unicode(self.code_edit.toPlainText())
self.source_dirty = False
@dynamic_property
def tab(self):
def fget(self):
return 'code' if self.tabs.currentWidget() is self.code_edit else 'wyswyg'
def fset(self, val):
self.tabs.setCurrentWidget(self.code_edit if val == 'code' else self.wyswyg)
return property(fget=fget, fset=fset)
def wyswyg_dirtied(self, *args):
self.wyswyg_dirty = True

View File

@ -527,6 +527,7 @@ class MetadataSingleDialogBase(ResizableDialog):
# break_cycles has already been called, don't know why this should
# happen but a user reported it
return True
self.comments_tab_at_apply = self.comments.tab
for widget in self.basic_metadata_widgets:
try:
if hasattr(widget, 'validate_for_commit'):
@ -634,6 +635,8 @@ class MetadataSingleDialogBase(ResizableDialog):
self.button_box.button(self.button_box.Ok).setDefault(True)
self.button_box.button(self.button_box.Ok).setFocus(Qt.OtherFocusReason)
self(self.db.id(self.row_list[self.current_row]))
if getattr(self, 'comments_tab_at_apply', None) == 'code':
self.comments.tab = 'code'
def break_cycles(self):
# Break any reference cycles that could prevent python