1 |
# Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH |
2 |
# Authors: |
3 |
# Jonathan Coles <[email protected]> |
4 |
# Bernhard Reiter <[email protected]> |
5 |
# Silke Reimer <[email protected]> |
6 |
# |
7 |
# This program is free software under the GPL (>=v2) |
8 |
# Read the file COPYING coming with Thuban for details. |
9 |
|
10 |
"""The About Box""" |
11 |
|
12 |
__version__ = "$Revision$" |
13 |
# $Source$ |
14 |
# $Id$ |
15 |
|
16 |
from wxPython.wx import * |
17 |
|
18 |
from locale import getlocale |
19 |
|
20 |
from Thuban import _ |
21 |
from Thuban.version import versions |
22 |
from Thuban.Model.resource import gdal_support_status |
23 |
|
24 |
from Thuban.UI.extensionregistry import ext_registry |
25 |
|
26 |
class About(wxDialog): |
27 |
|
28 |
def __init__(self, parent): |
29 |
wxDialog.__init__(self, parent, -1, _("About Thuban"), |
30 |
style = wxDEFAULT_DIALOG_STYLE |
31 |
| wxSYSTEM_MENU |
32 |
| wxMINIMIZE_BOX |
33 |
| wxMAXIMIZE_BOX |
34 |
| wxRESIZE_BORDER, |
35 |
size = (400, 250)) |
36 |
|
37 |
# Note: The source code is in ASCII, so we escape some |
38 |
# characters to get byte strings in latin1. |
39 |
lead_developer = 'Bernhard Herzog' |
40 |
developers = [ 'Jonathan Coles', 'Frank Koormann', |
41 |
unicodeToLocale(u'Martin M\xfcller'), 'Jan-Oliver Wagner' ] |
42 |
translators = [ ( _('French'), 'Daniel Calvelo Aros' ), |
43 |
( _('German'), unicodeToLocale(u'Bj\xf6rn Broscheit')), |
44 |
( _('Italian'), 'Maurizio Napolitano'), |
45 |
( _('Portuguese (Brazilian)'), 'Eduardo Patto Kanegae'), |
46 |
( _('Russian'), 'Alex Shevlakov'), |
47 |
( _('Spanish'), 'Daniel Calvelo Aros') ] |
48 |
other_contributors = [ 'Jonathan Byron', 'Silke Reimer', |
49 |
'Bernhard Reiter' ] |
50 |
dyn_modules = [ ('wxPython', versions['wxPython']), |
51 |
('Python', versions['python']), |
52 |
('PySQLite', versions['pysqlite']), |
53 |
('SQLite', versions['sqlite']), |
54 |
('GDAL', versions.get('gdal', _('- not available'))), |
55 |
('psycopg', versions.get('psycopg', |
56 |
_('- not available')))] |
57 |
direct_modules = [ \ |
58 |
('GTK', versions.get('gtk', _('- not available'))), |
59 |
('proj', versions['proj']) ] |
60 |
|
61 |
text = 'Thuban %s\n\n' % versions['thuban-long'] |
62 |
|
63 |
text += _('Currently using:\n') |
64 |
|
65 |
for name, version in dyn_modules: |
66 |
text+= '\t%s %s\n' % (name, version) |
67 |
text += '\n' |
68 |
|
69 |
if gdal_support_status: |
70 |
text += gdal_support_status + "\n\n" |
71 |
|
72 |
text += _('Compiled for:\n') |
73 |
|
74 |
for name, version in direct_modules: |
75 |
text+= '\t%s %s\n' % (name, version) |
76 |
text += '\n' |
77 |
|
78 |
text += _('Extensions:\n') |
79 |
if ext_registry: |
80 |
for ext in ext_registry: |
81 |
text += '\t%s %s\n' % (ext.name, ext.version) |
82 |
else: |
83 |
text += _('\tNone registered.\n') |
84 |
text += '\n' |
85 |
|
86 |
text += _('Lead Developer:\n') |
87 |
text += '\t%s\n\n' % lead_developer |
88 |
|
89 |
text += _('Developers:\n') |
90 |
for name in developers: |
91 |
text += '\t%s\n' % name |
92 |
text += '\n' |
93 |
|
94 |
text += _('Translators:\n') |
95 |
for lang, name in translators: |
96 |
text += '\t%s: %s\n' % (lang, name) |
97 |
text += '\n' |
98 |
|
99 |
text += _('Other Contributors:\n') |
100 |
for name in other_contributors: |
101 |
text += '\t%s\n' % name |
102 |
text += '\n' |
103 |
|
104 |
text += \ |
105 |
_("Questions and comments can be sent to the following addresses:\n" |
106 |
"\tGeneral list (public):\n\t\t<[email protected]>\n" |
107 |
"\tDevelopers list (public):\n\t\t<[email protected]>\n" |
108 |
"\tThuban team at Intevation:\n\t\t<[email protected]>\n" |
109 |
) |
110 |
|
111 |
text += '\n\n' |
112 |
|
113 |
text += _("Details on the registered extensions:\n\n") |
114 |
|
115 |
if ext_registry: |
116 |
for ext in ext_registry: |
117 |
text += '%s %s:\n' % (ext.name, ext.version) |
118 |
text += _('Copyright %s\n') % ext.copyright |
119 |
text += _('Authors:\n') |
120 |
for author in ext.authors: |
121 |
text+= '\t%s\n' % author |
122 |
text += ext.desc |
123 |
text += '\n\n' |
124 |
else: |
125 |
text += _('\tNone registered.\n') |
126 |
|
127 |
self.text = text |
128 |
|
129 |
text_title = wxStaticText(self, -1, |
130 |
_("Thuban is a program for exploring geographic data.\n\n") + |
131 |
"Copyright 2001-2004 Intevation GmbH.\n" + |
132 |
_("Thuban is licensed under the GNU GPL"), |
133 |
style=wxST_NO_AUTORESIZE|wxALIGN_CENTRE) |
134 |
|
135 |
textBox = wxTextCtrl(self, -1, text, |
136 |
style=wxTE_READONLY|wxTE_MULTILINE|wxTE_LINEWRAP) |
137 |
w, h = (300, 150) |
138 |
textBox.SetSizeHints(w, h) |
139 |
textBox.SetSize((w, h)) |
140 |
|
141 |
button_close = wxButton(self, wxID_CANCEL, _("Close")) |
142 |
button_close.SetDefault() |
143 |
|
144 |
sizer = wxBoxSizer(wxVERTICAL) |
145 |
sizer.Add(text_title, 0, wxALL|wxEXPAND|wxADJUST_MINSIZE, 10) |
146 |
sizer.Add(textBox, 1, wxALL|wxEXPAND, 10) |
147 |
sizer.Add(button_close, 0, wxALL|wxALIGN_RIGHT, 10) |
148 |
|
149 |
self.SetAutoLayout(True) |
150 |
self.SetSizer(sizer) |
151 |
sizer.Fit(self) |
152 |
sizer.SetSizeHints(self) |
153 |
self.Layout() |
154 |
|
155 |
EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) |
156 |
|
157 |
def OnCancel(self, event): |
158 |
self.EndModal(wxID_CANCEL) |
159 |
|
160 |
|
161 |
def unicodeToLocale(unicodeStr): |
162 |
"Function to convert unicode to the user's locale encoding" |
163 |
|
164 |
return unicodeStr.encode(getlocale()[1]) |
165 |
|