13 |
# $Source$ |
# $Source$ |
14 |
# $Id$ |
# $Id$ |
15 |
|
|
16 |
from wxPython.wx import * |
import wx |
17 |
|
|
18 |
from locale import getdefaultlocale |
from Thuban import _, internal_from_unicode, get_internal_encoding |
|
|
|
|
from Thuban import _ |
|
19 |
from Thuban.version import versions |
from Thuban.version import versions |
20 |
from Thuban.Model.resource import gdal_support_status |
from Thuban.Model.resource import gdal_support_status |
21 |
|
|
22 |
from Thuban.UI.extensionregistry import ext_registry |
from Thuban.UI.extensionregistry import ext_registry |
23 |
|
|
24 |
class About(wxDialog): |
class About(wx.Dialog): |
25 |
|
|
26 |
def __init__(self, parent): |
def __init__(self, parent): |
27 |
wxDialog.__init__(self, parent, -1, _("About Thuban"), |
wx.Dialog.__init__(self, parent, -1, _("About Thuban"), |
28 |
style = wxDEFAULT_DIALOG_STYLE |
style = wx.DEFAULT_DIALOG_STYLE |
29 |
| wxSYSTEM_MENU |
| wx.SYSTEM_MENU |
30 |
| wxMINIMIZE_BOX |
| wx.MINIMIZE_BOX |
31 |
| wxMAXIMIZE_BOX |
| wx.MAXIMIZE_BOX |
32 |
| wxRESIZE_BORDER, |
| wx.RESIZE_BORDER, |
33 |
size = (400, 250)) |
size = (400, 250)) |
34 |
|
|
35 |
# Note: The source code is in ASCII, so we escape some |
# Note: The source code is in ASCII, so we escape some |
37 |
lead_developer = 'Bernhard Herzog' |
lead_developer = 'Bernhard Herzog' |
38 |
developers = [ 'Jonathan Coles', |
developers = [ 'Jonathan Coles', |
39 |
'Frank Koormann', |
'Frank Koormann', |
40 |
unicodeToLocale(u'Martin M\xfcller'), |
internal_from_unicode(u'Martin M\xfcller'), |
41 |
'Bernhard Reiter', |
'Bernhard Reiter', |
42 |
'Jan-Oliver Wagner' ] |
'Jan-Oliver Wagner' ] |
43 |
translators = [ ( _('French'), 'Daniel Calvelo Aros' ), |
translators = [ ( _('French'), 'Daniel Calvelo Aros' ), |
44 |
( _('German'), unicodeToLocale(u'Bj\xf6rn Broscheit')), |
( _('German'), |
45 |
|
internal_from_unicode(u'Bj\xf6rn Broscheit')), |
46 |
( _('Hungarian'), 'Norbert Solymosi'), |
( _('Hungarian'), 'Norbert Solymosi'), |
47 |
( _('Italian'), 'Maurizio Napolitano'), |
( _('Italian'), 'Maurizio Napolitano'), |
48 |
( _('Portuguese (Brazilian)'), 'Eduardo Patto Kanegae'), |
( _('Portuguese (Brazilian)'), 'Eduardo Patto Kanegae'), |
49 |
( _('Russian'), 'Alex Shevlakov'), |
( _('Russian'), 'Alex Shevlakov'), |
50 |
( _('Spanish'), 'Daniel Calvelo Aros') ] |
( _('Spanish'), 'Daniel Calvelo Aros') ] |
51 |
other_contributors = [ 'Jonathan Byron', |
other_contributors = [ 'Jonathan Byron', |
52 |
|
'Didrik Pinte', |
53 |
'Ole Rahn', |
'Ole Rahn', |
54 |
'Silke Reimer' ] |
'Silke Reimer' ] |
55 |
dyn_modules = [ ('wxPython', versions['wxPython']), |
dyn_modules = [ ('wxPython', versions['wxPython']), |
71 |
text+= '\t%s %s\n' % (name, version) |
text+= '\t%s %s\n' % (name, version) |
72 |
text += '\n' |
text += '\n' |
73 |
|
|
74 |
|
text += _('\tInternal encoding: %s\n') % get_internal_encoding() |
75 |
|
text += '\n' |
76 |
|
|
77 |
if gdal_support_status: |
if gdal_support_status: |
78 |
text += gdal_support_status + "\n\n" |
text += gdal_support_status + "\n\n" |
79 |
|
|
136 |
|
|
137 |
self.text = text |
self.text = text |
138 |
|
|
139 |
text_title = wxStaticText(self, -1, |
text_title = wx.StaticText(self, -1, |
140 |
_("Thuban is a program for exploring geographic data.\n\n") + |
_("Thuban is a program for exploring geographic data.\n\n") + |
141 |
"Copyright 2001-2004 Intevation GmbH.\n" + |
"Copyright 2001-2006 Intevation GmbH.\n" + |
142 |
_("Thuban is licensed under the GNU GPL"), |
_("Thuban is licensed under the GNU GPL"), |
143 |
style=wxST_NO_AUTORESIZE|wxALIGN_CENTRE) |
style=wx.ST_NO_AUTORESIZE|wx.ALIGN_CENTRE) |
144 |
|
|
145 |
textBox = wxTextCtrl(self, -1, text, |
textBox = wx.TextCtrl(self, -1, text, |
146 |
style=wxTE_READONLY|wxTE_MULTILINE|wxTE_LINEWRAP) |
style=wx.TE_READONLY|wx.TE_MULTILINE|wx.TE_LINEWRAP) |
147 |
w, h = (300, 150) |
w, h = (300, 150) |
148 |
textBox.SetSizeHints(w, h) |
textBox.SetSizeHints(w, h) |
149 |
textBox.SetSize((w, h)) |
textBox.SetSize((w, h)) |
150 |
|
|
151 |
button_close = wxButton(self, wxID_CANCEL, _("Close")) |
button_close = wx.Button(self, wx.ID_CANCEL, _("Close")) |
152 |
button_close.SetDefault() |
button_close.SetDefault() |
153 |
|
|
154 |
sizer = wxBoxSizer(wxVERTICAL) |
sizer = wx.BoxSizer(wx.VERTICAL) |
155 |
sizer.Add(text_title, 0, wxALL|wxEXPAND|wxADJUST_MINSIZE, 10) |
sizer.Add(text_title, 0, wx.ALL|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
156 |
sizer.Add(textBox, 1, wxALL|wxEXPAND, 10) |
sizer.Add(textBox, 1, wx.ALL|wx.EXPAND, 10) |
157 |
sizer.Add(button_close, 0, wxALL|wxALIGN_RIGHT, 10) |
sizer.Add(button_close, 0, wx.ALL|wx.ALIGN_RIGHT, 10) |
158 |
|
|
159 |
self.SetAutoLayout(True) |
self.SetAutoLayout(True) |
160 |
self.SetSizer(sizer) |
self.SetSizer(sizer) |
162 |
sizer.SetSizeHints(self) |
sizer.SetSizeHints(self) |
163 |
self.Layout() |
self.Layout() |
164 |
|
|
165 |
EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) |
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=wx.ID_CANCEL) |
166 |
|
|
167 |
def OnCancel(self, event): |
def OnCancel(self, event): |
168 |
self.EndModal(wxID_CANCEL) |
self.EndModal(wx.ID_CANCEL) |
|
|
|
|
|
|
|
def unicodeToLocale(unicodeStr): |
|
|
"Function to convert unicode to the user's locale encoding" |
|
|
# Under a german windows 2000 getlocale returns an encoding name |
|
|
# that's not direcly usable (it's missing a "cp" at the beginning). |
|
|
# getdefaultlocale does return a usable encoding name so we use that |
|
|
# instead. |
|
|
locale=getdefaultlocale()[1] |
|
|
if locale is None: |
|
|
locale = 'ascii' |
|
|
return unicodeStr.encode(locale,'replace') |
|