mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement #3515 (Reset the conversion options)
This commit is contained in:
parent
2941253f31
commit
e3a0fe82da
@ -51,6 +51,9 @@ def load_specifics(db, book_id):
|
|||||||
r.from_string(raw)
|
r.from_string(raw)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
def delete_specifics(db, book_id):
|
||||||
|
db.delete_conversion_options(book_id, 'PIPE')
|
||||||
|
|
||||||
class GuiRecommendations(dict):
|
class GuiRecommendations(dict):
|
||||||
|
|
||||||
def __new__(cls, *args):
|
def __new__(cls, *args):
|
||||||
|
@ -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.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.ui import available_output_formats
|
||||||
from calibre.customize.conversion import OptionRecommendation
|
from calibre.customize.conversion import OptionRecommendation
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs
|
||||||
@ -115,9 +116,10 @@ class Config(ResizableDialog, Ui_Dialog):
|
|||||||
def __init__(self, parent, db, book_id,
|
def __init__(self, parent, db, book_id,
|
||||||
preferred_input_format=None, preferred_output_format=None):
|
preferred_input_format=None, preferred_output_format=None):
|
||||||
ResizableDialog.__init__(self, parent)
|
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.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.setup_pipeline()
|
||||||
|
|
||||||
self.connect(self.input_formats, SIGNAL('currentIndexChanged(QString)'),
|
self.connect(self.input_formats, SIGNAL('currentIndexChanged(QString)'),
|
||||||
@ -130,8 +132,14 @@ class Config(ResizableDialog, Ui_Dialog):
|
|||||||
self.show_pane)
|
self.show_pane)
|
||||||
self.connect(self.groups, SIGNAL('entered(QModelIndex)'),
|
self.connect(self.groups, SIGNAL('entered(QModelIndex)'),
|
||||||
self.show_group_help)
|
self.show_group_help)
|
||||||
|
rb = self.buttonBox.button(self.buttonBox.RestoreDefaults)
|
||||||
|
self.connect(rb, SIGNAL('clicked()'), self.restore_defaults)
|
||||||
self.groups.setMouseTracking(True)
|
self.groups.setMouseTracking(True)
|
||||||
|
|
||||||
|
def restore_defaults(self):
|
||||||
|
delete_specifics(self.db, self.book_id)
|
||||||
|
self.setup_pipeline()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def input_format(self):
|
def input_format(self):
|
||||||
return unicode(self.input_formats.currentText()).lower()
|
return unicode(self.input_formats.currentText()).lower()
|
||||||
|
@ -108,8 +108,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>810</width>
|
||||||
<height>471</height>
|
<height>492</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
@ -138,7 +138,7 @@
|
|||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1081,6 +1081,10 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
|||||||
return cPickle.loads(str(data))
|
return cPickle.loads(str(data))
|
||||||
return None
|
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):
|
def add_format(self, index, ext, stream, index_is_id=False):
|
||||||
'''
|
'''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user