mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make sorting robust against tweak_fmt_order
This commit is contained in:
parent
ed866257df
commit
7f4487d318
@ -110,7 +110,12 @@ class TweakEpubAction(InterfaceActionWithLibraryDrop):
|
||||
tprefs.refresh() # In case they were changed in a Tweak Book process
|
||||
if len(tweakable_fmts) > 1:
|
||||
if tprefs['choose_tweak_fmt']:
|
||||
d = Choose(title, sorted(tweakable_fmts, key=tprefs.defaults['tweak_fmt_order'].index), self.gui)
|
||||
def index(x):
|
||||
try:
|
||||
return tprefs.defaults['tweak_fmt_order'].index(x)
|
||||
except Exception:
|
||||
return len(tprefs.defaults['tweak_fmt_order'])
|
||||
d = Choose(title, sorted(tweakable_fmts, key=index), self.gui)
|
||||
if d.exec() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
tweakable_fmts = {d.fmt}
|
||||
|
Loading…
x
Reference in New Issue
Block a user