/[thuban]/branches/WIP-pyshapelib-bramz/Extensions/wms/infodialog.py
ViewVC logotype

Contents of /branches/WIP-pyshapelib-bramz/Extensions/wms/infodialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2160 - (show annotations)
Sun Apr 11 18:15:33 2004 UTC (20 years, 10 months ago) by joey
Original Path: trunk/thuban/Extensions/wms/infodialog.py
File MIME type: text/x-python
File size: 3325 byte(s)
Adjusted the class documentation

1 # Copyright (c) 2004 by Intevation GmbH
2 # Authors:
3 # Martin Schulze <[email protected]>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 """
20 Information dialog to display various information about a WMS layer.
21
22 class wmsInfoDialog(ThubanFrame):
23 __init__
24
25 dialog_layout(text)
26
27 calcText(layer)
28
29 """
30
31 __version__ = "$Revision$"
32 # $Source$
33 # $Id$
34
35 from Thuban import _
36 from Thuban.UI.dialogs import ThubanFrame
37
38 from wxPython.wx import wxBoxSizer, wxTextCtrl, wxVERTICAL, \
39 wxHORIZONTAL, wxTE_READONLY, wxTE_MULTILINE, wxTE_LINEWRAP, \
40 wxEXPAND, wxALL, wxButton, wxALIGN_CENTER_HORIZONTAL, wxID_OK, \
41 EVT_BUTTON
42
43
44 class wmsInfoDialog(ThubanFrame):
45 """
46 Representation for a simple information dialog
47
48 This dialog will display the title of the WMS resource
49 """
50
51 def __init__(self, parent, name, title, layer):
52 """
53 Build the information dialog
54 """
55 ThubanFrame.__init__(self, parent, name, title)
56
57 self.dialog_layout(self.calcText(layer))
58
59
60 def dialog_layout(self, text):
61 """
62 Set up the information dialog
63 """
64
65 vbox = wxBoxSizer(wxVERTICAL)
66
67 textBox = wxTextCtrl(self, -1, text,
68 style=wxTE_READONLY|wxTE_MULTILINE|wxTE_LINEWRAP)
69 w, h = (500, 300)
70 textBox.SetSizeHints(w, h)
71 textBox.SetSize((w, h))
72
73 vbox.Add(textBox, 1, wxEXPAND|wxALL, 10)
74
75 buttons = wxBoxSizer(wxHORIZONTAL)
76 buttons.Add(wxButton(self, wxID_OK, _("Close")), 0, wxALL, 4)
77 vbox.Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10)
78
79 EVT_BUTTON(self, wxID_OK, self.OnClose)
80
81 self.SetAutoLayout(True)
82 self.SetSizer(vbox)
83 vbox.Fit(self)
84 vbox.SetSizeHints(self)
85
86
87 def calcText(self, layer):
88 """
89 Generate the text to be displayed in the information window
90
91 It will use several nodes returned by the GetCapabilities
92 request, such as the title, the abstract, fees and access
93 constraints, if they are documented.
94 """
95
96 text = ''
97
98 foo = layer.capabilities.getTitle()
99 if foo != "":
100 text += foo.encode('latin1') + "\n\n"
101
102 foo = layer.capabilities.getAbstract()
103 if foo != "":
104 text += foo + "\n\n"
105
106 foo = layer.capabilities.getFees()
107 if foo != "":
108 text += _("Fees:") + "\n\n" + foo + "\n\n"
109
110 foo = layer.capabilities.getAccessConstraints()
111 if foo != "":
112 text += _("Acces Constraints:") + "\n\n" + foo + "\n\n"
113
114 text += "URL: " + layer.url
115
116 return text

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26