From 015c313b8db907ec40b5a3bf264ead02f29912ce Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 24 Jul 2010 09:45:31 -0600 Subject: [PATCH] Don't crash if fail to decode python config file --- src/calibre/manual/customize.rst | 3 ++- src/calibre/utils/config.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/manual/customize.rst b/src/calibre/manual/customize.rst index 0852550c83..9f4d15cfd4 100644 --- a/src/calibre/manual/customize.rst +++ b/src/calibre/manual/customize.rst @@ -45,7 +45,8 @@ All static resources are stored in the resources sub-folder of the calibre insta from the calibre website it will be :file:`/opt/calibre/resources`. These paths can change depending on where you choose to install |app|. You should not change the files in this resources folder, as your changes will get overwritten the next time you update |app|. Instead, go to -:guilabel:`Preferences->Advanced` and click :guilabel:`Open calibre configuration directory`. In this configuration directory, create a sub-folder called resources and place the files you want to override in it. |app| will automatically use your custom file in preference to the builtin one the next time it is started. +:guilabel:`Preferences->Advanced` and click :guilabel:`Open calibre configuration directory`. In this configuration directory, create a sub-folder called resources and place the files you want to override in it. Place the files in the appropriate sub folders, for example place images in :file:`resources/images`, etc. +|app| will automatically use your custom file in preference to the builtin one the next time it is started. For example, if you wanted to change the icon for the :guilabel:`Remove books` action, you would first look in the builtin resources folder and see that the relevant file is :file:`resources/images/trash.svg`. Assuming you have an alternate icon in svg format called :file:`mytrash.svg` you would save it in the configuration directory as :file:`resources/images/trash.svg`. All the icons used by the calibre user interface are in :file:`resources/images` and its sub-folders. diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 720f3ca977..c8cfbadac5 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -312,10 +312,10 @@ class OptionSet(object): def parse_string(self, src): options = {'cPickle':cPickle} - if not isinstance(src, unicode): - src = src.decode('utf-8') if src is not None: try: + if not isinstance(src, unicode): + src = src.decode('utf-8') exec src in options except: print 'Failed to parse options string:'