mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #756807 (unhandled exception when creating catalogs in EPUB or MOBI format)
This commit is contained in:
parent
5556a1604c
commit
e35860a2b2
@ -193,7 +193,10 @@ class PluginWidget(QWidget,Ui_Form):
|
|||||||
opts_dict['header_note_source_field'] = self.header_note_source_field_name
|
opts_dict['header_note_source_field'] = self.header_note_source_field_name
|
||||||
|
|
||||||
# Append the output profile
|
# Append the output profile
|
||||||
opts_dict['output_profile'] = [load_defaults('page_setup')['output_profile']]
|
try:
|
||||||
|
opts_dict['output_profile'] = [load_defaults('page_setup')['output_profile']]
|
||||||
|
except:
|
||||||
|
opts_dict['output_profile'] = ['default']
|
||||||
if False:
|
if False:
|
||||||
print "opts_dict"
|
print "opts_dict"
|
||||||
for opt in sorted(opts_dict.keys()):
|
for opt in sorted(opts_dict.keys()):
|
||||||
|
@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
|
||||||
from PyQt4.Qt import (QAbstractTableModel, Qt)
|
from PyQt4.Qt import (QAbstractTableModel, Qt, QAbstractListModel)
|
||||||
|
|
||||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||||
from calibre.gui2.preferences.metadata_sources_ui import Ui_Form
|
from calibre.gui2.preferences.metadata_sources_ui import Ui_Form
|
||||||
@ -125,6 +125,29 @@ class SourcesModel(QAbstractTableModel): # {{{
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
class FieldsModel(QAbstractListModel): # {{{
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
QAbstractTableModel.__init__(self, parent)
|
||||||
|
|
||||||
|
self.fields = []
|
||||||
|
|
||||||
|
def rowCount(self, parent=None):
|
||||||
|
return len(self.fields)
|
||||||
|
|
||||||
|
def initialize(self):
|
||||||
|
fields = set()
|
||||||
|
for p in all_metadata_plugins():
|
||||||
|
fields |= p.touched_fields
|
||||||
|
self.fields = []
|
||||||
|
for x in fields:
|
||||||
|
if not x.startswith('identifiers:'):
|
||||||
|
self.fields.append(x)
|
||||||
|
self.reset()
|
||||||
|
|
||||||
|
|
||||||
|
# }}}
|
||||||
|
|
||||||
class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||||
|
|
||||||
def genesis(self, gui):
|
def genesis(self, gui):
|
||||||
@ -139,6 +162,10 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.sources_view.setModel(self.sources_model)
|
self.sources_view.setModel(self.sources_model)
|
||||||
self.sources_model.dataChanged.connect(self.changed_signal)
|
self.sources_model.dataChanged.connect(self.changed_signal)
|
||||||
|
|
||||||
|
self.fields_model = FieldsModel(self)
|
||||||
|
self.fields_view.setModel(self.fields_model)
|
||||||
|
self.fields_model.dataChanged.connect(self.changed_signal)
|
||||||
|
|
||||||
def configure_plugin(self):
|
def configure_plugin(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user