-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
82 lines (66 loc) · 2.27 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: UTF-8 -*-
# Copyright (c) 2012, Miguel Paolino <[email protected]>
# This file is part of Cuadraditos.
#
# Cuadraditos is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Cuadraditos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Cuadraditos. If not, see <http://www.gnu.org/licenses/>.
import os
from gettext import gettext as gt
import sugar.graphics.style
from sugar.activity import activity
from color import Color
class Constants:
VERSION = 1
SERVICE = "org.laptop.Cuadraditos"
IFACE = SERVICE
PATH = "/org/laptop/Cuadraditos"
activityId = None
keyName = "name"
keyMime = "mime"
keyExt = "ext"
keyIstr = "istr"
color_black = Color()
color_black.init_rgba(0, 0, 0, 255)
color_white = Color()
color_white.init_rgba(255, 255, 255, 255)
color_red = Color()
color_red.init_rgba(255, 0, 0, 255)
color_green = Color()
color_green.init_rgba(0, 255, 0, 255)
color_blue = Color()
color_blue.init_rgba(0, 0, 255, 255)
color_button = Color()
color_button.init_gdk(sugar.graphics.style.COLOR_BUTTON_GREY)
GFX_PATH = os.path.join(activity.get_bundle_path(), "gfx")
sound_click = os.path.join(GFX_PATH, 'photoShutter.wav')
MODE_VIDEO = 1
MODE_HELP = 2
#defensive method against variables not translated correctly
def _(s):
#todo: permanent variable
i_strs_test = {}
for i in range(0, 4):
i_strs_test[str(i)] = str(i)
i = s
try:
#test translating the string with many replacements
i = gt(s)
test = i % i_strs_test
except:
#if it doesn't work, revert
i = s
return i
i_str_activity_name = _('Cuadraditos')
dim_CONTROLBAR_HT = 55
def __init__(self, ca):
self.__class__.activityId = ca._activity_id