]> CRI, Mines Paris - PSL - minwii.git/blobdiff - src/minwii/globals.py
renommage de app en minwii (ça va tout péter…).
[minwii.git] / src / minwii / globals.py
diff --git a/src/minwii/globals.py b/src/minwii/globals.py
new file mode 100755 (executable)
index 0000000..2ce25eb
--- /dev/null
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+"""
+constantes globales partagées par plusieurs modules.
+
+$Id$
+$URL$
+"""
+from colorsys import hls_to_rgb
+from math import floor
+
+BACKGROUND_LAYER = 0
+FOREGROUND_LAYER = 1
+CURSOR_LAYER = 2
+PLAYING_MODES = (('BEGINNER' , u'Débutant'),
+                 ('EASY'     , u'Facile'),
+                 ('NORMAL'   , u'Normal'),
+                 ('ADVANCED' , u'Avancé'),
+                 ('EXPERT'   , u'Expert'))
+
+
+
+PLAYING_MODES_DICT = dict([(v[0], i) for i, v in enumerate(PLAYING_MODES)])
+
+def hls_to_rgba_8bits(h, l, s, a=1) :
+    #convert to rgb ranging from 0 to 255
+    rgba = [floor(255 * i) for i in hls_to_rgb(h, l, s) + (a,)]
+    return tuple(rgba)
+