annotate pyArq-Presupuestos.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 d9e718bdee41
children 65e7ae0d0e63
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 -*-
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
3 ## File presupuestos.py
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
15
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
22 # Modules
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
23 import sys
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
24 import gettext
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
25 # pyArq-Presupuestos modules
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
26 from Generic import globalVars
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
27 from Generic import win32Locale
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
28
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
29 def _take_APPDATA_path():
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
30 # take path to find mo file
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
31 _path = sys.path[0]
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
32 globalVars.path["APPDATA"]= _path
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
33
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
34 def _translate():
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
35 """def translate()
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
36
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
37 Translates the program using gettext module
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
38 """
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
39 _app = "pyArq-Presupuestos"
6
2fc6b47dbe70 rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 3
diff changeset
40 _dir = globalVars.path["APPDATA"] + "/mo/"
15
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
41 if sys.platform == 'win32':
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
42 win32Locale.check_win32_locale()
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
43 gettext.install(_app, _dir, unicode=1)
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
44
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
45 def _run_gui():
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
46 """def _run_gui
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
47
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
48 Shows main window and starts the GTK+ event processing loop.
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
49 """
15
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
50 from Gtk import gui
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
51 _window = gui.MainWindow()
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
52
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
53 # Run pyArq-Presupuestos
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
54 if __name__ == "__main__":
15
2a13413dcc13 gettext on windows
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents: 14
diff changeset
55 _take_APPDATA_path()
1
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
56 _translate()
2ac1551ad2ab add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff changeset
57 _run_gui()