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
|
tprefs.refresh() # In case they were changed in a Tweak Book process
|
||||||
if len(tweakable_fmts) > 1:
|
if len(tweakable_fmts) > 1:
|
||||||
if tprefs['choose_tweak_fmt']:
|
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:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
tweakable_fmts = {d.fmt}
|
tweakable_fmts = {d.fmt}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user