From dc84d3dd65d96428fdef8b0d37445ecde42e373c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 May 2015 21:06:43 +0530 Subject: [PATCH] Edit book: When importing multiple files into the book, import them in the order sorted by their filenames --- src/calibre/gui2/tweak_book/boss.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index a5d35e8b51..7ec499e679 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -47,6 +47,7 @@ from calibre.gui2.tweak_book.widgets import ( RationalizeFolders, MultiSplit, ImportForeign, QuickOpen, InsertLink, InsertSemantics, BusyCursor, InsertTag, FilterCSS, AddCover) from calibre.utils.config import JSONConfig +from calibre.utils.icu import numeric_sort_key _diff_dialogs = [] @@ -446,7 +447,8 @@ class Boss(QObject): for x, folder in folder_map.iteritems()} self.add_savepoint(_('Before Add files')) c = current_container() - for path, name in files.iteritems(): + for path in sorted(files, key=numeric_sort_key): + name = files[path] i = 0 while c.exists(name) or c.manifest_has_name(name): i += 1