From 9bf8dcf4ca2588c2815eb757cf599c2903e45f2d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 May 2015 21:50:09 +0530 Subject: [PATCH] ToC Editor: Fix save/load of settings int he XPath wizard not working across restarts --- src/calibre/gui2/toc/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/toc/main.py b/src/calibre/gui2/toc/main.py index 521cfda9ba..e41723c757 100644 --- a/src/calibre/gui2/toc/main.py +++ b/src/calibre/gui2/toc/main.py @@ -75,7 +75,8 @@ class XPathDialog(QDialog): # {{{ name = unicode(name).strip() if name: saved = self.prefs.get('xpath_toc_settings', {}) - saved[name] = {i:x for i, x in enumerate(xpaths)} + # in JSON all keys have to be strings + saved[name] = {str(i):x for i, x in enumerate(xpaths)} self.prefs.set('xpath_toc_settings', saved) self.setup_load_button() @@ -98,7 +99,7 @@ class XPathDialog(QDialog): # {{{ def load_settings(self, name): saved = self.prefs.get('xpath_toc_settings', {}).get(name, {}) for i, w in enumerate(self.widgets): - txt = saved.get(i, '') + txt = saved.get(str(i), '') w.edit.setText(txt) def check(self):