diff options
Diffstat (limited to 'src/theming.py')
-rwxr-xr-x | src/theming.py | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/theming.py b/src/theming.py index 1e9d6c40..ae71e48f 100755 --- a/src/theming.py +++ b/src/theming.py @@ -69,20 +69,18 @@ log = logging.getLogger(__name__) from config import config import curses -import imp import os from os import path -from sys import version_info -if version_info[1] >= 3: - from importlib import machinery - finder = machinery.PathFinder() +from importlib import machinery +finder = machinery.PathFinder() class Theme(object): """ - The theme class, from which all theme should inherit. - All of the following value can be replaced in subclasses, in + The theme class, from which all themes should inherit. + All of the following values can be replaced in subclasses, in order to create a new theme. + Do not edit this file if you want to change the theme to suit your needs. Create a new theme and share it if you think it can be useful for others. @@ -178,6 +176,13 @@ class Theme(object): CHAR_AFFILIATION_MEMBER = '+' CHAR_AFFILIATION_NONE = '-' + + # XML Tab + CHAR_XML_IN = 'IN ' + CHAR_XML_OUT = 'OUT' + COLOR_XML_IN = (1, -1) + COLOR_XML_OUT = (2, -1) + # Color for the /me message COLOR_ME_MESSAGE = (6, -1) @@ -305,6 +310,7 @@ class Theme(object): CHAR_ERROR = '✖' CHAR_EMPTY = ' ' CHAR_ACK_RECEIVED = CHAR_OK + CHAR_NACK = CHAR_ERROR CHAR_COLUMN_ASC = ' ▲' CHAR_COLUMN_DESC = ' ▼' CHAR_ROSTER_ERROR = CHAR_ERROR @@ -319,6 +325,7 @@ class Theme(object): CHAR_ROSTER_NONE = '⇹' COLOR_CHAR_ACK = (2, -1) + COLOR_CHAR_NACK = (1, -1) COLOR_ROSTER_GAMING = (6, -1) COLOR_ROSTER_MOOD = (2, -1) @@ -493,21 +500,13 @@ def reload_theme(): new_theme = None exc = None try: - if version_info[1] < 3: - file, filename, info = imp.find_module(theme_name, load_path) - imp.acquire_lock() - new_theme = imp.load_module(theme_name, file, filename, info) - else: - loader = finder.find_module(theme_name, load_path) - if not loader: - return 'Failed to load the theme %s' % theme_name - new_theme = loader.load_module() + loader = finder.find_module(theme_name, load_path) + if not loader: + return 'Failed to load the theme %s' % theme_name + new_theme = loader.load_module() except Exception as e: log.error('Failed to load the theme %s', theme_name, exc_info=True) exc = e - finally: - if version_info[1] < 3 and imp.lock_held(): - imp.release_lock() if not new_theme: return 'Failed to load theme: %s' % exc |