mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix crash when instantiating pluginwidget multiple times
This commit is contained in:
parent
44f6c0a1f5
commit
223e115f42
@ -11,15 +11,17 @@ from calibre.gui2 import gprefs
|
|||||||
from calibre.gui2.catalog.catalog_csv_xml_ui import Ui_Form
|
from calibre.gui2.catalog.catalog_csv_xml_ui import Ui_Form
|
||||||
from PyQt4.Qt import QWidget
|
from PyQt4.Qt import QWidget
|
||||||
|
|
||||||
class PluginWidget(QWidget,Ui_Form):
|
class PluginWidget(QWidget, Ui_Form):
|
||||||
|
|
||||||
TITLE = _('CSV/XML Output')
|
TITLE = _('CSV/XML Output')
|
||||||
HELP = _('Options specific to')+' CSV/XML '+_('output')
|
HELP = _('Options specific to')+' CSV/XML '+_('output')
|
||||||
sync_enabled = False
|
sync_enabled = False
|
||||||
|
|
||||||
def initialize(self, name):
|
def __init__(self, parent=None):
|
||||||
QWidget.__init__(self)
|
QWidget.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
|
def initialize(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
# Restore the activated fields from last use
|
# Restore the activated fields from last use
|
||||||
for x in range(self.db_fields.count()):
|
for x in range(self.db_fields.count()):
|
||||||
|
@ -17,7 +17,6 @@ from calibre.customize.ui import catalog_plugins
|
|||||||
|
|
||||||
class Catalog(QDialog, Ui_Dialog):
|
class Catalog(QDialog, Ui_Dialog):
|
||||||
''' Catalog Dialog builder'''
|
''' Catalog Dialog builder'''
|
||||||
widgets = []
|
|
||||||
|
|
||||||
def __init__(self, parent, dbspec, ids):
|
def __init__(self, parent, dbspec, ids):
|
||||||
import re, cStringIO
|
import re, cStringIO
|
||||||
@ -40,7 +39,7 @@ class Catalog(QDialog, Ui_Dialog):
|
|||||||
# GwR *** Add option tabs for built-in formats
|
# GwR *** Add option tabs for built-in formats
|
||||||
# This code models #69 in calibre/gui2/dialogs/config/__init__.py
|
# This code models #69 in calibre/gui2/dialogs/config/__init__.py
|
||||||
|
|
||||||
self.fmts = []
|
self.fmts, self.widgets = [], []
|
||||||
|
|
||||||
from calibre.customize.builtins import plugins as builtin_plugins
|
from calibre.customize.builtins import plugins as builtin_plugins
|
||||||
|
|
||||||
@ -99,9 +98,9 @@ class Catalog(QDialog, Ui_Dialog):
|
|||||||
else:
|
else:
|
||||||
info("No dynamic tab resources found for %s" % name)
|
info("No dynamic tab resources found for %s" % name)
|
||||||
|
|
||||||
self.widgets = sorted(self.widgets, key=lambda x:(x.TITLE, x.TITLE))
|
self.widgets = sorted(self.widgets, cmp=lambda x,y:cmp(x.TITLE, y.TITLE))
|
||||||
for pw in self.widgets:
|
for pw in self.widgets:
|
||||||
self.tabs.addTab(pw,pw.TITLE)
|
self.tabs.addTab(pw, pw.TITLE)
|
||||||
|
|
||||||
# Generate a sorted list of installed catalog formats/sync_enabled pairs
|
# Generate a sorted list of installed catalog formats/sync_enabled pairs
|
||||||
fmts = sorted([x[0] for x in self.fmts])
|
fmts = sorted([x[0] for x in self.fmts])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user