mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Polish Books: Remember the last used settings
This commit is contained in:
parent
e32d413060
commit
e161c5f090
@ -65,9 +65,11 @@ class Polish(QDialog): # {{{
|
|||||||
('jacket', _('Add metadata as a "book jacket" page')),
|
('jacket', _('Add metadata as a "book jacket" page')),
|
||||||
('remove_jacket', _('Remove a previously inserted book jacket')),
|
('remove_jacket', _('Remove a previously inserted book jacket')),
|
||||||
])
|
])
|
||||||
|
prefs = gprefs.get('polishing_settings', {})
|
||||||
for name, text in self.all_actions.iteritems():
|
for name, text in self.all_actions.iteritems():
|
||||||
count += 1
|
count += 1
|
||||||
x = QCheckBox(text, self)
|
x = QCheckBox(text, self)
|
||||||
|
x.setChecked(prefs.get(name, False))
|
||||||
x.stateChanged.connect(partial(self.option_toggled, name))
|
x.stateChanged.connect(partial(self.option_toggled, name))
|
||||||
l.addWidget(x, count, 0, 1, 1)
|
l.addWidget(x, count, 0, 1, 1)
|
||||||
setattr(self, 'opt_'+name, x)
|
setattr(self, 'opt_'+name, x)
|
||||||
@ -110,7 +112,7 @@ class Polish(QDialog): # {{{
|
|||||||
l.addWidget(bb, count+1, 1, 1, -1)
|
l.addWidget(bb, count+1, 1, 1, -1)
|
||||||
self.setup_load_button()
|
self.setup_load_button()
|
||||||
|
|
||||||
self.resize(QSize(900, 600))
|
self.resize(QSize(950, 600))
|
||||||
|
|
||||||
def select_all(self, enable):
|
def select_all(self, enable):
|
||||||
for action in self.all_actions:
|
for action in self.all_actions:
|
||||||
@ -172,16 +174,18 @@ class Polish(QDialog): # {{{
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
self.actions = ac = {}
|
self.actions = ac = {}
|
||||||
|
saved_prefs = {}
|
||||||
gprefs['polish_show_reports'] = bool(self.show_reports.isChecked())
|
gprefs['polish_show_reports'] = bool(self.show_reports.isChecked())
|
||||||
something = False
|
something = False
|
||||||
for action in self.all_actions:
|
for action in self.all_actions:
|
||||||
ac[action] = bool(getattr(self, 'opt_'+action).isChecked())
|
ac[action] = saved_prefs[action] = bool(getattr(self, 'opt_'+action).isChecked())
|
||||||
if ac[action]:
|
if ac[action]:
|
||||||
something = True
|
something = True
|
||||||
if not something:
|
if not something:
|
||||||
return error_dialog(self, _('No actions selected'),
|
return error_dialog(self, _('No actions selected'),
|
||||||
_('You must select at least one action, or click Cancel.'),
|
_('You must select at least one action, or click Cancel.'),
|
||||||
show=True)
|
show=True)
|
||||||
|
gprefs['polishing_settings'] = saved_prefs
|
||||||
self.queue_files()
|
self.queue_files()
|
||||||
return super(Polish, self).accept()
|
return super(Polish, self).accept()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user