Hi, Kovid,
calibre 5.99.4
In a plugin using your Dialog class (from calibre.gui2.widgets2 import Dialog), I still get the error you just corrected in
the post 110.
After some debug of my code, I found that it is because I use bytearray(self.saveGeometry()) in a dict of dict, instead of a simple dict.
I don't know if it worth for you to correct it, in anycase I can work this around easily.
example of code :
Code:
self.windoPos = {}
self.windowPos['geometry'] = bytearray(self.saveGeometry())
gui_prefs.set('main_window', self.windowPos)
gives this exception:
Spoiler:
File "calibre_plugins.typex.dialogs", line 110, in closeEvent
gui_prefs.set('main_window', self.windowPos)
File "calibre/utils/config.py", line 383, in set
File "calibre/utils/config.py", line 438, in __setitem__
File "calibre/utils/config.py", line 401, in commit
File "calibre/utils/config.py", line 422, in to_raw
File "calibre/utils/config_base.py", line 100, in json_dumps
File "json/__init__.py", line 238, in dumps
File "json/encoder.py", line 201, in encode
File "json/encoder.py", line 431, in _iterencode
File "json/encoder.py", line 405, in _iterencode_dict
File "json/encoder.py", line 405, in _iterencode_dict
File "json/encoder.py", line 438, in _iterencode
File "calibre/utils/config_base.py", line 53, in to_json
TypeError: <DockWidgetArea.NoDockWidgetArea: 0> is not JSON serializable
With calibre 5.32, it's working OK and gives this structure in the json:
If i change the code to
Code:
gui_prefs.set('main_window' + '-geometry', bytearray(self.saveGeometry()))
I get no exception anymore (in 5.99.4), so the work around would be easy if this case a too particular one to be fixed.
Thank you!