diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-07 19:56:59 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-11-08 00:47:56 +0100 |
commit | 1b06a7d48bf3cb8503eae556f0cbf4b0b5128edf (patch) | |
tree | c6f317e450a57faf120cfb1250188927764162b4 /src | |
parent | 9c688795d1c9381c71d0883285b357cdf21e2e37 (diff) | |
download | poezio-1b06a7d48bf3cb8503eae556f0cbf4b0b5128edf.tar.gz poezio-1b06a7d48bf3cb8503eae556f0cbf4b0b5128edf.tar.bz2 poezio-1b06a7d48bf3cb8503eae556f0cbf4b0b5128edf.tar.xz poezio-1b06a7d48bf3cb8503eae556f0cbf4b0b5128edf.zip |
Add a warning in case of theme not found, and now unsetting 'theme',
setting it to 'default' or a number of spaces has the same effect
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 4 | ||||
-rw-r--r-- | src/theming.py | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/core.py b/src/core.py index 2441aa16..baeb6693 100644 --- a/src/core.py +++ b/src/core.py @@ -1221,7 +1221,9 @@ class Core(object): self.xmpp.plugin['xep_0030'].get_items(jid=server, block=False, callback=list_tab.on_muc_list_item_received) def command_theme(self, arg): - theming.reload_theme() + warning = theming.reload_theme() + if warning: + self.information(warning, 'Warning') self.refresh_window() def command_win(self, arg): diff --git a/src/theming.py b/src/theming.py index 4bfdad42..0a7ab22d 100644 --- a/src/theming.py +++ b/src/theming.py @@ -240,16 +240,17 @@ def reload_theme(): os.makedirs(themes_dir) except OSError: pass - theme_name = config.get('theme', '') - if not theme_name: + theme_name = config.get('theme', 'default') + global theme + if theme_name == 'default' or not theme_name.strip(): + theme = Theme() return try: file_path = os.path.join(themes_dir, theme_name)+'.py' log.debug('Theme file to load: %s' %(file_path,)) new_theme = imp.load_source('theme', os.path.join(themes_dir, theme_name)+'.py') - except: # TODO warning: theme not found - return - global theme + except: + return 'Theme not found' theme = new_theme.theme if __name__ == '__main__': |