Prise en charge du mode.
[minwii.git] / src / app / globals.py
1 # -*- coding: utf-8 -*-
2 """
3 constantes globales partagées par plusieurs modules.
4
5 $Id$
6 $URL$
7 """
8 from colorsys import hls_to_rgb
9 from math import floor
10
11 BACKGROUND_LAYER = 0
12 FOREGROUND_LAYER = 1
13 CURSOR_LAYER = 2
14 PLAYING_MODES = (('EASY' , u'Facile'),
15 ('NORMAL' , u'Normal'),
16 ('ADVANCED', u'Avancé'),
17 ('EXPERT' , u'Expert'))
18
19
20
21 PLAYING_MODES_DICT = dict([(v[0], i) for i, v in enumerate(PLAYING_MODES)])
22
23 def hls_to_rgba_8bits(h, l, s, a=1) :
24 #convert to rgb ranging from 0 to 255
25 rgba = [floor(255 * i) for i in hls_to_rgb(h, l, s) + (a,)]
26 return tuple(rgba)
27