From 4645bd7a2fe73e6168d2494f85265436aca0cc40 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 17 Feb 2014 20:21:54 +0100 Subject: Documentation update ssl page (img & ref) theming (compile errors, format and typos) --- doc/source/images/ssl_warning.png | Bin 881 -> 2496 bytes doc/source/misc/ssl.rst | 2 +- src/theming.py | 34 +++++++++++++++++++--------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/doc/source/images/ssl_warning.png b/doc/source/images/ssl_warning.png index 348a81a4..3862f315 100644 Binary files a/doc/source/images/ssl_warning.png and b/doc/source/images/ssl_warning.png differ diff --git a/doc/source/misc/ssl.rst b/doc/source/misc/ssl.rst index 3c2a591a..dd18ef12 100644 --- a/doc/source/misc/ssl.rst +++ b/doc/source/misc/ssl.rst @@ -59,7 +59,7 @@ connections. If you are paranoid (or run poezio for the first time in an unsafe -environment), you can set the _certificate_ value of your config file yourself +environment), you can set the :term:`certificate` value of your config file yourself (the hash, not colon-separated). diff --git a/src/theming.py b/src/theming.py index b81563b3..16280bc7 100644 --- a/src/theming.py +++ b/src/theming.py @@ -21,41 +21,45 @@ 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. -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) +A color tuple is of the form ``(foreground, background, optional)`` A color of -1 means the default color. So if you do not want to have -a background color, use (x, -1). +a background color, use ``(x, -1)``. The optional third value of the tuple defines additional information. It -is a string and can contain one or more of these characteres: -'b': bold -'u': underlined -'x': blink +is a string and can contain one or more of these characters: -For example, (200, 208, 'bu') is bold, underlined and pink foreground on orange background. +- ``b``: bold +- ``u``: underlined +- ``x``: blink + +For example, ``(200, 208, 'bu')`` is bold, underlined and pink foreground on +orange background. A theme file is a python file containing one object named 'theme', which is an instance of a class (derived from the Theme class) defined in that same file. For example, in pinkytheme.py: -import theming -class PinkyTheme(theming.Theme): - COLOR_NORMAL_TEXT = (200, -1) +.. code-block:: python + + import theming + class PinkyTheme(theming.Theme): + COLOR_NORMAL_TEXT = (200, -1) -theme = PinkyTheme() + theme = PinkyTheme() if the command '/theme pinkytheme' is issued, we import the pinkytheme.py file and set the global variable 'theme' to pinkytheme.theme. -And in poezio's code we just use theme.COLOR_NORMAL_TEXT etc +And in poezio's code we just use ``theme.COLOR_NORMAL_TEXT`` etc Since a theme inherites from the Theme class (defined here), if a color is not defined in a theme file, the color is the default one. Some values in that class are a list of color tuple. -For example [(1, -1), (2, -1), (3, -1)] -Such a list SHOULD contain at list one color tuple. +For example ``[(1, -1), (2, -1), (3, -1)]`` +Such a list SHOULD contain at least one color tuple. It is used for example to define color gradient, etc. """ -- cgit v1.2.3