Fix #1729605 [64bit v3.11 fails to create catalog. v3.10 works fine](https://bugs.launchpad.net/calibre/+bug/1729605)

This commit is contained in:
Kovid Goyal 2017-11-02 19:40:17 +05:30
parent 0d7aebb98e
commit 20dc23d87b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -137,6 +137,13 @@ class Catalog(QDialog, Ui_Dialog):
nh, nw = max(300, geom.height()-50), max(400, geom.width()-70) nh, nw = max(300, geom.height()-50), max(400, geom.width()-70)
return QSize(nw, nh) return QSize(nw, nh)
@property
def options_widget(self):
ans = self.tabs.widget(1)
if isinstance(ans, QScrollArea):
ans = ans.widget()
return ans
def show_plugin_tab(self, idx): def show_plugin_tab(self, idx):
cf = unicode(self.format.currentText()).lower() cf = unicode(self.format.currentText()).lower()
while self.tabs.count() > 1: while self.tabs.count() > 1:
@ -150,7 +157,7 @@ class Catalog(QDialog, Ui_Dialog):
s.setWidget(pw), s.setWidgetResizable(True) s.setWidget(pw), s.setWidgetResizable(True)
self.tabs.addTab(s, pw.TITLE) self.tabs.addTab(s, pw.TITLE)
break break
if hasattr(self.tabs.widget(1),'show_help'): if hasattr(self.options_widget, 'show_help'):
self.buttonBox.button(self.buttonBox.Help).setVisible(True) self.buttonBox.button(self.buttonBox.Help).setVisible(True)
else: else:
self.buttonBox.button(self.buttonBox.Help).setVisible(False) self.buttonBox.button(self.buttonBox.Help).setVisible(False)
@ -168,14 +175,14 @@ class Catalog(QDialog, Ui_Dialog):
When title/format change, invalidate Preset in E-book options tab When title/format change, invalidate Preset in E-book options tab
''' '''
cf = unicode(self.format.currentText()).lower() cf = unicode(self.format.currentText()).lower()
if cf in ['azw3', 'epub', 'mobi'] and hasattr(self.tabs.widget(1), 'settings_changed'): if cf in ['azw3', 'epub', 'mobi'] and hasattr(self.options_widget, 'settings_changed'):
self.tabs.widget(1).settings_changed("title/format") self.options_widget.settings_changed("title/format")
@property @property
def fmt_options(self): def fmt_options(self):
ans = {} ans = {}
if self.tabs.count() > 1: if self.tabs.count() > 1:
w = self.tabs.widget(1) w = self.options_widget
ans = w.options() ans = w.options()
return ans return ans
@ -193,7 +200,7 @@ class Catalog(QDialog, Ui_Dialog):
# Store current values without building catalog # Store current values without building catalog
self.save_catalog_settings() self.save_catalog_settings()
if self.tabs.count() > 1: if self.tabs.count() > 1:
self.tabs.widget(1).options() self.options_widget.options()
def accept(self): def accept(self):
self.save_catalog_settings() self.save_catalog_settings()
@ -213,9 +220,9 @@ class Catalog(QDialog, Ui_Dialog):
Create the help file at resources/catalog/help_<format>.html Create the help file at resources/catalog/help_<format>.html
''' '''
if self.tabs.count() > 1 and hasattr(self.tabs.widget(1),'show_help'): if self.tabs.count() > 1 and hasattr(self.options_widget,'show_help'):
try: try:
self.tabs.widget(1).show_help() self.options_widget.show_help()
except: except:
info_dialog(self, _('No help available'), info_dialog(self, _('No help available'),
_('No help available for this output format.'), _('No help available for this output format.'),