Mercurial > pyarq-presupuestos
annotate Generic/globalVars.py @ 15:2a13413dcc13
gettext on windows
author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
---|---|
date | Sun, 02 Jan 2011 10:27:16 +0100 |
parents | 29a4044a95ff |
children | 60bc5117926c |
rev | line source |
---|---|
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1 #!/usr/bin/python |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
3 ## File globalVars.py |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4 ## This file is part of pyArq-Presupuestos. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
6 ## Copyright (C) 2010 Miguel Ángel Bárcena Rodríguez |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
7 ## <miguelangel@obraencurso.es> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
8 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
9 ## pyArq-Presupuestos is free software: you can redistribute it and/or modify |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
10 ## it under the terms of the GNU General Public License as published by |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
11 ## the Free Software Foundation, either version 3 of the License, or |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
12 ## (at your option) any later version. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
13 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
14 ## pyArq-Presupuestos is distributed in the hope that it will be useful, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
17 ## GNU General Public License for more details. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
18 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
19 ## You should have received a copy of the GNU General Public License |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
20 ## along with this program. If not, see <http://www.gnu.org/licenses/>. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
21 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
22 # module for global variables |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
23 import os |
12
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
24 import sys |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
25 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
26 version = "pyArq Presupuestos v0.0.0" |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
27 changeset = 10 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
28 baseversion = 0 |
12
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
29 |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
30 # path: Paths where find the program files needed |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
31 path = { |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
32 "HOME" : "", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
33 "APPDATA" : "", |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
34 "DURUS-DATABASE": "/pyArq-Presupuestos/durus/", |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
35 "BUDGET": "/pyArq-Presupuestos/budget/", |
12
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
36 "ICON" : "/images/pyArq-Presupuestos.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
37 "CHAPTER-ICON" : "/images/chapter.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
38 "UNIT-ICON" : "/images/unit.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
39 "MATERIAL-ICON" : "/images/material.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
40 "MACHINERY-ICON" : "/images/machinery.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
41 "LABOURFORCE-ICON": "/images/labourforce.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
42 "MENU-ICON": "/images/menu.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
43 "CONNECTED-ICON": "/images/connected.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
44 "DISCONNECTED-ICON": "/images/disconnected.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
45 "CLOSE-ICON": "/images/close.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
46 "DESCRIPTION-ICON": "/images/description.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
47 "SHEET-ICON": "/images/sheet.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
48 "DECOMPOSITION-ICON" : "/images/decomposition.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
49 "MEASURE-ICON" : "/images/measure.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
50 "ACUMULATEDLINE-ICON" : "/images/acumulatedline.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
51 "PARCIALLINE-ICON" : "/images/parcialline.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
52 "NORMALLINE-ICON" : "/images/normalline.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
53 "CALCULATEDLINE-ICON" : "/images/calculatedline.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
54 "ARROW-ICON": "/images/arrow.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
55 "IMAGE-ICON": "/images/image.png", |
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
56 "DXF-ICON": "/images/dxf.png", |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
57 "THROBBER-ICON": "/images/throbber.png", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
58 "THROBBER-GIF": "/images/throbber.gif", |
12
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
59 "BUDGET-ICON": "/images/budget.png", |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
60 "PYARQ-ICON": "/images/pyArq.png", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
61 } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
62 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
63 color = { |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
64 "ACTIVE" : "#CDD7FF", # blue |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
65 "INDEX-EVEN" : "#C4C4C4", # dark grey |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
66 "INDEX-UNEVEN" : "#DDDDDD", # grey |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
67 "EVEN" : "#E6E6E6", # dark white |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
68 "UNEVEN": "#FFFFFF", # white |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
69 "CHAPTER-EVEN": "#D8E6E6", # dark cian |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
70 "CHAPTER-UNEVEN": "#F0FFFF", # cian |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
71 "TEXT": "#000000", # black |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
72 "CALCULATED-TEXT": "#FF00FF", # |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
73 "SUBTOTAL": "#FAC8C8", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
74 "SUBTOTAL-PARCIAL": "#ADD8E6", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
75 } |
12
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
76 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
77 desktop = { |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
78 "autodetect" : True, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
79 "desktop" : "", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
80 "browser" : "firefox", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
81 "mailapp" : "evolution", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
82 "imageapp" : "gthumb", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
83 "cadapp" : "qcad", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
84 } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
85 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
86 def getAppPath(key): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
87 return path["APPDATA"] + path[key] |
12
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
88 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
89 def getHomePath(key): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
90 return path["HOME"] + path[key] |
12
29a4044a95ff
svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
91 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
92 if os.name == 'posix': |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
93 path["HOME"] = os.environ.get('HOME') |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
94 elif sys.platform == 'win32': |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
95 path["HOME"] = os.environ.get('HOMEPATH') |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
96 # TODO: Mac Os, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
97 # TODO: Test in diferents os |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
98 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
99 #-# |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
100 path["BUDGET"] = "/pyArq-Presupuestos/" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
101 #-# |