diff --git a/src/calibre/ebooks/conversion/config.py b/src/calibre/ebooks/conversion/config.py
index e8b923a1d7..00e44136f0 100644
--- a/src/calibre/ebooks/conversion/config.py
+++ b/src/calibre/ebooks/conversion/config.py
@@ -51,6 +51,9 @@ def load_specifics(db, book_id):
r.from_string(raw)
return r
+def delete_specifics(db, book_id):
+ db.delete_conversion_options(book_id, 'PIPE')
+
class GuiRecommendations(dict):
def __new__(cls, *args):
diff --git a/src/calibre/gui2/convert/single.py b/src/calibre/gui2/convert/single.py
index d14f5c905d..c8a4b6bb97 100644
--- a/src/calibre/gui2/convert/single.py
+++ b/src/calibre/gui2/convert/single.py
@@ -23,6 +23,7 @@ from calibre.gui2.convert.debug import DebugWidget
from calibre.ebooks.conversion.plumber import Plumber, supported_input_formats
+from calibre.ebooks.conversion.config import delete_specifics
from calibre.customize.ui import available_output_formats
from calibre.customize.conversion import OptionRecommendation
from calibre.utils.config import prefs
@@ -115,9 +116,10 @@ class Config(ResizableDialog, Ui_Dialog):
def __init__(self, parent, db, book_id,
preferred_input_format=None, preferred_output_format=None):
ResizableDialog.__init__(self, parent)
- self.setup_input_output_formats(db, book_id, preferred_input_format,
- preferred_output_format)
self.db, self.book_id = db, book_id
+
+ self.setup_input_output_formats(self.db, self.book_id, preferred_input_format,
+ preferred_output_format)
self.setup_pipeline()
self.connect(self.input_formats, SIGNAL('currentIndexChanged(QString)'),
@@ -130,8 +132,14 @@ class Config(ResizableDialog, Ui_Dialog):
self.show_pane)
self.connect(self.groups, SIGNAL('entered(QModelIndex)'),
self.show_group_help)
+ rb = self.buttonBox.button(self.buttonBox.RestoreDefaults)
+ self.connect(rb, SIGNAL('clicked()'), self.restore_defaults)
self.groups.setMouseTracking(True)
+ def restore_defaults(self):
+ delete_specifics(self.db, self.book_id)
+ self.setup_pipeline()
+
@property
def input_format(self):
return unicode(self.input_formats.currentText()).lower()
diff --git a/src/calibre/gui2/convert/single.ui b/src/calibre/gui2/convert/single.ui
index f6da306b2d..6fe57f86a2 100644
--- a/src/calibre/gui2/convert/single.ui
+++ b/src/calibre/gui2/convert/single.ui
@@ -108,8 +108,8 @@
0
0
- 800
- 471
+ 810
+ 492
@@ -138,7 +138,7 @@
Qt::Horizontal
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults
diff --git a/src/calibre/library/database.py b/src/calibre/library/database.py
index 3806679337..e04df68949 100644
--- a/src/calibre/library/database.py
+++ b/src/calibre/library/database.py
@@ -1081,6 +1081,10 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
return cPickle.loads(str(data))
return None
+ def delete_conversion_options(self, id, format):
+ self.conn.execute('DELETE FROM conversion_options WHERE book=? AND format=?',
+ (id, format.upper()))
+
def add_format(self, index, ext, stream, index_is_id=False):
'''