annotate Generic/globalVars.py @ 25:189f8274aecd

gui. switch navigation menu on switch page
author Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
date Mon, 20 May 2019 13:18:33 +0200
parents 2b393934f1db
children 16f91684686b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 ##
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
6 ## Copyright (C) 2010-2019 Miguel Ángel Bárcena Rodríguez
1
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
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
23 # not translatable strings here _("strig")
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
24
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
25 import os
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
26 import sys
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
27
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
28 name = "pyArq Presupuestos"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
29 version = "v0.0.0"
25
189f8274aecd gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 24
diff changeset
30 changeset = "c25"
7
0359329a1c26 Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 6
diff changeset
31 baseversion = 0
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
32
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
33 # path: Paths where find the program files needed
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
34 path = {
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
35 "HOME" : "",
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
36 "APPDATA" : "",
7
0359329a1c26 Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 6
diff changeset
37 "BUDGET": "/pyArq-Presupuestos/budget/",
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
38 "ICON" : "/images/pyArq-Presupuestos.png",
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
39 "ICON16" : "/images/pyArq-Presupuestos-16.svg",
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
40 "ICON32" : "/images/pyArq-Presupuestos-32.svg",
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
41 "ICON64" : "/images/pyArq-Presupuestos-64.svg",
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
42 "ICON128" : "/images/pyArq-Presupuestos-128.svg",
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
43 "CHAPTER-ICON" : "/images/chapter.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
44 "UNIT-ICON" : "/images/unit.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
45 "MATERIAL-ICON" : "/images/material.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
46 "MACHINERY-ICON" : "/images/machinery.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
47 "LABOURFORCE-ICON": "/images/labourforce.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
48 "MENU-ICON": "/images/menu.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
49 "CONNECTED-ICON": "/images/connected.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
50 "DISCONNECTED-ICON": "/images/disconnected.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
51 "CLOSE-ICON": "/images/close.png",
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
52 "HORIZONTAL": "/images/horizontal.svg",
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
53 "VERTICAL": "/images/vertical.svg",
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
54 "DESCRIPTION-ICON": "/images/description.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
55 "SHEET-ICON": "/images/sheet.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
56 "DECOMPOSITION-ICON" : "/images/decomposition.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
57 "MEASURE-ICON" : "/images/measure.png",
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
58 "FILEVIEW-ICON" : "/images/fileview.png",
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
59 "COMPANY-ICON" : "/images/company.png",
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
60 "ACUMULATEDLINE-ICON" : "/images/acumulatedline.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
61 "PARCIALLINE-ICON" : "/images/parcialline.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
62 "NORMALLINE-ICON" : "/images/normalline.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
63 "CALCULATEDLINE-ICON" : "/images/calculatedline.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
64 "ARROW-ICON": "/images/arrow.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
65 "IMAGE-ICON": "/images/image.png",
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
66 "DXF-ICON": "/images/dxf.png",
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
67 "PDF-ICON": "/images/pdf.png",
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
68 "BUDGET-ICON": "/images/budget.png",
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
69 "PYARQ-ICON": "/images/pyArq.png",
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
70 }
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
71
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
72 color = {
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
73 "ACTIVE" : "#CDD7FF", # Lavender Blue (205,215,255,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
74 "INDEX-EVEN" : "#C4C4C4", # Silver, dark grey (196,196,196,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
75 "INDEX-UNEVEN" : "#DDDDDD", # Gainsboro, grey (221,221,221,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
76 "EVEN" : "#E6E6E6", # Whisper, dark white (230,230,230,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
77 "UNEVEN": "#FFFFFF", # White (255,255,255,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
78 "CHAPTER-EVEN": "#D8E6E6", # Zircon, dark cian (216,230,230,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
79 "CHAPTER-UNEVEN": "#F0FFFF", # Azure, cian (240,255,255,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
80 "TEXT": "#000000", # Black ( 0, 0, 0,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
81 "CALCULATED-TEXT": "#FF00FF", # Magenta (255, 0,255,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
82 "SUBTOTAL": "#FAC8C8", # Coral Candy (250,200,200,1)
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
83 "SUBTOTAL-PARCIAL": "#ADD8E6", # Light Blue (173,216,230,1)
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
84 }
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
85
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
86 desktop = {
23
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
87 "autodetect" : True, # True: try to autodect desktop
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
88 "desktop" : "", # "linux", "macosx" or "windows"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
89 "browser" : "", # "firefox"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
90 "mailapp" : "", # "evolution"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
91 "imageapp" : "", # "gthumb"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
92 "wmfapp" : "", # "inkscape"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
93 "cadapp" : "", # "librecad"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
94 "videoapp" : "", # "vlc"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
95 "officeapp" : "", # "libreoffice"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
96 "txtapp" : "", # "gedit"
65e7ae0d0e63 GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 22
diff changeset
97 "rtfapp" : "", # "libreoffice"
1
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 def getAppPath(key):
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
101 return path["APPDATA"] + path[key]
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
102
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
103 def getHomePath(key):
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
104 return path["HOME"] + path[key]
12
29a4044a95ff svg to png
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 11
diff changeset
105
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
106 if os.name == 'posix':
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
107 path["HOME"] = os.environ.get('HOME')
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
108 elif sys.platform == 'win32':
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
109 path["HOME"] = os.environ.get('HOMEPATH')
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
110 # TODO: Mac Os,
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
111 # TODO: Test in diferents os
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
112
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
113 #-#
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
114 path["BUDGET"] = "/pyArq-Presupuestos/"
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
115 #-#