summaryrefslogtreecommitdiff
path: root/src/theming.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2012-02-15 20:10:00 +0100
committerFlorent Le Coz <louiz@louiz.org>2012-02-15 20:10:00 +0100
commit695a7ebebaf6a277420dcb42cd96d92d77df0379 (patch)
tree8c9da1e5bf988356ad110f42113949aab94a5866 /src/theming.py
parent0606c2b351ac87f110e1240d2f4ba1b94b275930 (diff)
parentb89cd8fd8322bf8aa23130398a0a70defcba708d (diff)
downloadpoezio-695a7ebebaf6a277420dcb42cd96d92d77df0379.tar.gz
poezio-695a7ebebaf6a277420dcb42cd96d92d77df0379.tar.bz2
poezio-695a7ebebaf6a277420dcb42cd96d92d77df0379.tar.xz
poezio-695a7ebebaf6a277420dcb42cd96d92d77df0379.zip
Merge branch 'master' of https://git.louiz.org/poezio
Diffstat (limited to 'src/theming.py')
-rw-r--r--src/theming.py34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/theming.py b/src/theming.py
index 7e90a5a7..c29d044d 100644
--- a/src/theming.py
+++ b/src/theming.py
@@ -11,16 +11,17 @@ used when drawing the interface.
Colors are numbers from -1 to 7 (if only 8 colors are supported) or -1 to 255
if 256 colors are available.
-We check the number of available colors at startup, and we load a theme accordingly.
-A 8 color theme should NEVER use colors not in the -1 -> 7 range. We won't check that
-at run time. If the case occurs, the THEME should be fixed.
+If only 8 colors are available, all colors > 8 are converted using the
+table_256_to_16 dict.
+
XHTML-IM colors are converted to -1 -> 255 colors if available, or directly to
-1 -> 8 if we are in 8-color-mode.
A pair_color is a background-foreground pair. All possible pairs are not created
at startup, because that would create 256*256 pairs, and almost all of them
would never be used.
-So, a theme should define color tuples, like (200, -1), and when they are to
+
+A theme should define color tuples, like (200, -1), and when they are to
be used by poezio's interface, they will be created once, and kept in a list for
later usage.
A color tuple is of the form (foreground, background, optional)
@@ -78,7 +79,7 @@ class Theme(object):
"""
# Message text color
COLOR_NORMAL_TEXT = (-1, -1)
- COLOR_INFORMATION_TEXT = (137, -1) # TODO
+ COLOR_INFORMATION_TEXT = (5, -1) # TODO
COLOR_HIGHLIGHT_NICK = (3, 5, 'b')
# User list color
@@ -100,6 +101,13 @@ class Theme(object):
CHAR_CHATSTATE_COMPOSING = 'X'
CHAR_CHATSTATE_PAUSED = 'p'
+ # These characters are used for the affiliation in the user list
+ # in a MUC
+ CHAR_AFFILIATION_OWNER = '~'
+ CHAR_AFFILIATION_ADMIN = '&'
+ CHAR_AFFILIATION_MEMBER = '+'
+ CHAR_AFFILIATION_NONE = '-'
+
# Separators
COLOR_VERTICAL_SEPARATOR = (4, -1)
COLOR_NEW_TEXT_SEPARATOR = (2, -1)
@@ -114,17 +122,21 @@ class Theme(object):
# Tabs
COLOR_TAB_NORMAL = (7, 4)
+ COLOR_TAB_JOINED = (82, 4)
COLOR_TAB_CURRENT = (7, 6)
COLOR_TAB_NEW_MESSAGE = (7, 5)
- COLOR_TAB_HIGHLIGHT = (7, 1)
+ COLOR_TAB_HIGHLIGHT = (7, 3)
COLOR_TAB_PRIVATE = (7, 2)
+ COLOR_TAB_ATTENTION = (7, 1)
COLOR_TAB_DISCONNECTED = (7, 8)
COLOR_VERTICAL_TAB_NORMAL = (4, -1)
+ COLOR_VERTICAL_TAB_JOINED = (82, -1)
COLOR_VERTICAL_TAB_CURRENT = (7, 4)
COLOR_VERTICAL_TAB_NEW_MESSAGE = (5, -1)
- COLOR_VERTICAL_TAB_HIGHLIGHT = (1, -1)
+ COLOR_VERTICAL_TAB_HIGHLIGHT = (3, -1)
COLOR_VERTICAL_TAB_PRIVATE = (2, -1)
+ COLOR_VERTICAL_TAB_ATTENTION = (1, -1)
COLOR_VERTICAL_TAB_DISCONNECTED = (8, -1)
# Nickname colors
@@ -161,8 +173,8 @@ class Theme(object):
CHAR_JOIN = '--->'
CHAR_QUIT = '<---'
CHAR_KICK = '-!-'
- CHAR_COLUMN_ASC = ' ▲'
- CHAR_COLUMN_DESC =' ▼'
+ CHAR_COLUMN_ASC = ' ▲'
+ CHAR_COLUMN_DESC =' ▼'
COLOR_JOIN_CHAR = (4, -1)
COLOR_QUIT_CHAR = (1, -1)
@@ -270,8 +282,8 @@ def reload_theme():
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:
- return 'Theme not found'
+ except Exception as e:
+ return 'Failed to load theme: %s' % (e,)
theme = new_theme.theme
if __name__ == '__main__':