1 |
jschuengel |
2257 |
# -*- coding:latin1 -*- |
2 |
|
|
# Copyright (C) 2004 by Intevation GmbH |
3 |
|
|
# Authors: |
4 |
|
|
# Jan Schüngel <[email protected]> |
5 |
|
|
# |
6 |
|
|
# This program is free software under the GPL (>=v2) |
7 |
|
|
# Read the file COPYING coming with Thuban for details. |
8 |
|
|
|
9 |
|
|
""" |
10 |
|
|
This modul extend Thuban with the possibility to handle |
11 |
|
|
UMN MapServer mapfiles. |
12 |
|
|
""" |
13 |
|
|
|
14 |
|
|
__version__ = "$Revision$" |
15 |
|
|
# $Source$ |
16 |
|
|
# $Id$ |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
# ################################### |
20 |
|
|
# |
21 |
|
|
# import necessary modules |
22 |
|
|
# |
23 |
|
|
# ################################### |
24 |
|
|
|
25 |
|
|
import os, sys |
26 |
|
|
|
27 |
|
|
# mapscript |
28 |
|
|
from mapscript import mapObj |
29 |
|
|
|
30 |
|
|
# wxPython support |
31 |
|
|
# TODO: explicitly use from .. import |
32 |
|
|
from wxPython.wx import * |
33 |
|
|
|
34 |
|
|
# Thuban |
35 |
|
|
# use _() already now for all strings that may later be translated |
36 |
|
|
from Thuban import _ |
37 |
|
|
|
38 |
|
|
# Thuban has named commands which can be registered in the central |
39 |
|
|
# instance registry. |
40 |
|
|
from Thuban.UI.command import registry, Command |
41 |
|
|
|
42 |
|
|
# The instance of the main menu of the Thuban application |
43 |
|
|
import Thuban.UI.mainwindow |
44 |
|
|
|
45 |
|
|
# needed to add the new menu |
46 |
|
|
from Thuban.UI.mainwindow import main_menu |
47 |
|
|
|
48 |
|
|
# import Map Object for the Mapfile |
49 |
|
|
from mapfile import MF_Map |
50 |
|
|
|
51 |
|
|
from Thuban.UI.colordialog import ColorDialog |
52 |
|
|
|
53 |
|
|
from mapfile import unit_type, legend_status_type, legend_position_type, \ |
54 |
jschuengel |
2267 |
label_font_type, scalebar_status_type, scalebar_style_type, \ |
55 |
jschuengel |
2274 |
scalebar_position_type, label_position_type |
56 |
jschuengel |
2257 |
|
57 |
|
|
# ################################### |
58 |
|
|
# |
59 |
|
|
# Mainpart of the Extension |
60 |
|
|
# |
61 |
|
|
# ################################### |
62 |
|
|
|
63 |
|
|
ID_COLOR_CHANGE= 8001 |
64 |
jschuengel |
2267 |
ID_IMGCOLOR_CHANGE = 8002 |
65 |
jschuengel |
2257 |
|
66 |
|
|
class Map_Dialog(wxDialog): |
67 |
|
|
|
68 |
|
|
def __init__(self, parent, ID, title, |
69 |
|
|
pos=wxDefaultPosition, size=wxDefaultSize, |
70 |
|
|
style=wxDEFAULT_DIALOG_STYLE): |
71 |
|
|
|
72 |
|
|
# initialize the Dialog |
73 |
|
|
wxDialog.__init__(self, parent, ID, title, pos, size, style) |
74 |
|
|
|
75 |
|
|
# parent.canvas.Map() |
76 |
|
|
self.tb_map = parent.canvas.Map() |
77 |
|
|
self.tb_map_umn = self.tb_map.extension_umn_mapobj |
78 |
|
|
|
79 |
|
|
# create name |
80 |
|
|
box_name = wxBoxSizer(wxHORIZONTAL) |
81 |
|
|
box_name.Add(wxStaticText(self, -1, _("Map-Name:")), 0, |
82 |
|
|
wxALL|wxALIGN_CENTER_VERTICAL, 4) |
83 |
|
|
box_name.Add(wxStaticText(self, -1, self.tb_map.Title()), 0, |
84 |
|
|
wxALL|wxALIGN_CENTER_VERTICAL, 4) |
85 |
|
|
|
86 |
|
|
#create size settings |
87 |
jschuengel |
2271 |
insidetxt = self.tb_map_umn.get_size() |
88 |
jschuengel |
2274 |
staticSize = wxStaticBox(self, 1010, _("Size"), style = 0, |
89 |
|
|
name = "staticBox", ) |
90 |
jschuengel |
2257 |
box_size = wxStaticBoxSizer(staticSize, wxVERTICAL) |
91 |
|
|
|
92 |
|
|
box_sizepartWidth = wxBoxSizer(wxHORIZONTAL) |
93 |
|
|
box_sizepartWidth.Add(wxStaticText(self, -1, _("Width: ")), 0, wxALL, 4) |
94 |
|
|
self.text_width = wxTextCtrl(self, -1, str(insidetxt[0])) |
95 |
|
|
box_sizepartWidth.Add(self.text_width, 2, wxALL, 4) |
96 |
|
|
box_size.Add(box_sizepartWidth, 0, wxALIGN_RIGHT | wxALL, 5) |
97 |
|
|
box_sizepartHeight = wxBoxSizer(wxHORIZONTAL) |
98 |
jschuengel |
2274 |
box_sizepartHeight.Add(wxStaticText(self, -1, _("Height: ")), 0, |
99 |
|
|
wxALL, 4) |
100 |
jschuengel |
2257 |
self.text_height = wxTextCtrl(self, -1, str(insidetxt[1])) |
101 |
|
|
box_sizepartHeight.Add(self.text_height, 2, wxALL, 4) |
102 |
|
|
box_size.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 5) |
103 |
|
|
|
104 |
jschuengel |
2274 |
#unittype |
105 |
jschuengel |
2257 |
insideunit = self.tb_map_umn.get_units() |
106 |
jschuengel |
2274 |
#Unittype selector |
107 |
|
|
box_unitsStatic = wxStaticBox(self, 1011, _("Unit Type"), |
108 |
|
|
style = 0, name = "imagecolor") |
109 |
jschuengel |
2257 |
box_units = wxStaticBoxSizer(box_unitsStatic, wxVERTICAL) |
110 |
|
|
sam = [] |
111 |
|
|
for key in unit_type: |
112 |
|
|
sam.append(unit_type[key]) |
113 |
|
|
self.choice_units = wxChoice(self, 40, (80, 50), choices = sam) |
114 |
|
|
self.choice_units.SetStringSelection(insideunit) |
115 |
|
|
box_units.Add(self.choice_units,0, wxEXPAND, wxALL, 5) |
116 |
|
|
|
117 |
|
|
# color chouser |
118 |
jschuengel |
2274 |
box_colorStatic = wxStaticBox(self, 1011, _("ImageColor"), |
119 |
|
|
style = 0, name = "imagecolor") |
120 |
jschuengel |
2257 |
box_color = wxStaticBoxSizer(box_colorStatic, wxVERTICAL) |
121 |
|
|
|
122 |
|
|
# preview box |
123 |
jschuengel |
2274 |
self.previewcolor = wxPanel(self,99, name = 'backgroundPanel', |
124 |
|
|
style = wxSIMPLE_BORDER | wxCLIP_CHILDREN) |
125 |
jschuengel |
2257 |
imagecolor = self.tb_map_umn.get_imagecolor() |
126 |
|
|
self.previewcolor.SetBackgroundColour(wxColour(imagecolor.get_red(), |
127 |
|
|
imagecolor.get_green(), imagecolor.get_blue())) |
128 |
|
|
box_color.Add(self.previewcolor, 1, wxGROW | wxALL, 5) |
129 |
|
|
# color change button, opens a new color dialog |
130 |
|
|
button = wxButton(self, ID_COLOR_CHANGE, _("Change Color")) |
131 |
|
|
button.SetFocus() |
132 |
|
|
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor) |
133 |
|
|
box_color.Add(button, 1, wxEXPAND|wxALL, 5) |
134 |
|
|
|
135 |
jschuengel |
2271 |
# status |
136 |
|
|
umn_status = self.tb_map_umn.get_status() |
137 |
|
|
self.choice_status = wxRadioBox(self, -1, choices=["True","False"], |
138 |
|
|
label='status', majorDimension=1, |
139 |
|
|
name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS) |
140 |
|
|
self.choice_status.SetStringSelection(str(umn_status)) |
141 |
|
|
|
142 |
jschuengel |
2257 |
#buttons |
143 |
|
|
box_buttons = wxBoxSizer(wxHORIZONTAL) |
144 |
|
|
button = wxButton(self, wxID_OK, _("OK")) |
145 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
146 |
|
|
button = wxButton(self, wxID_CANCEL, _("Cancel")) |
147 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
148 |
jschuengel |
2274 |
#button functions |
149 |
jschuengel |
2257 |
EVT_BUTTON(self, wxID_OK, self.OnOK) |
150 |
|
|
EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) |
151 |
|
|
|
152 |
|
|
#add all boxes to the box top |
153 |
|
|
top = wxBoxSizer(wxVERTICAL) |
154 |
|
|
top.Add(box_name, 0, wxEXPAND |wxALL, 5) |
155 |
|
|
top.Add(box_size, 0, wxEXPAND |wxALL, 5) |
156 |
|
|
top.Add(box_units,0, wxEXPAND |wxALL, 5) |
157 |
jschuengel |
2271 |
top.Add(box_color,0, wxEXPAND |wxALL, 5) |
158 |
|
|
top.Add(self.choice_status,0, wxEXPAND |wxALL, 5) |
159 |
jschuengel |
2257 |
top.Add(box_buttons, 0, wxALIGN_RIGHT) |
160 |
|
|
|
161 |
|
|
# final layout settings |
162 |
|
|
self.SetSizer(top) |
163 |
|
|
top.Fit(self) |
164 |
|
|
|
165 |
|
|
def OnChangeColor(self, event): |
166 |
|
|
cur = self.tb_map_umn.get_imagecolor().get_thubancolor() |
167 |
|
|
dialog = ColorDialog(self) |
168 |
|
|
dialog.SetColor(cur) |
169 |
|
|
self.retcolor = None |
170 |
|
|
if dialog.ShowModal() == wxID_OK: |
171 |
|
|
self.retcolor = dialog.GetColor() |
172 |
|
|
dialog.Destroy() |
173 |
|
|
if self.retcolor: |
174 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
175 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
176 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
177 |
|
|
self.previewcolor.SetBackgroundColour(wxColour((self.redcolor), |
178 |
|
|
int(self.greencolor), int(self.bluecolor))) |
179 |
|
|
|
180 |
|
|
def RunDialog(self): |
181 |
|
|
self.ShowModal() |
182 |
|
|
self.Destroy() |
183 |
|
|
|
184 |
|
|
def end_dialog(self, result): |
185 |
|
|
self.result = result |
186 |
|
|
if self.result is not None: |
187 |
|
|
self.EndModal(wxID_OK) |
188 |
|
|
else: |
189 |
|
|
self.EndModal(wxID_CANCEL) |
190 |
|
|
self.Show(False) |
191 |
|
|
|
192 |
|
|
def OnOK(self, event): |
193 |
jschuengel |
2271 |
self.tb_map_umn.set_size(int(self.text_width.GetValue()), |
194 |
|
|
int(self.text_height.GetValue())) |
195 |
jschuengel |
2257 |
self.tb_map_umn.set_units(self.choice_units.GetStringSelection()) |
196 |
jschuengel |
2271 |
if self.choice_status.GetStringSelection() == "True": |
197 |
|
|
self.tb_map_umn.set_status(True) |
198 |
|
|
else: |
199 |
|
|
self.tb_map_umn.set_status(False) |
200 |
jschuengel |
2267 |
previewcolor = self.previewcolor.GetBackgroundColour() |
201 |
|
|
self.tb_map_umn.get_imagecolor().set_rgbcolor(previewcolor.Red(), |
202 |
|
|
previewcolor.Green(), previewcolor.Blue()) |
203 |
jschuengel |
2257 |
self.result ="OK" |
204 |
|
|
self.end_dialog(self.result) |
205 |
|
|
|
206 |
|
|
def OnCancel(self, event): |
207 |
|
|
self.end_dialog(None) |
208 |
|
|
|
209 |
|
|
|
210 |
jschuengel |
2271 |
class OutputFormat_Dialog(wxDialog): |
211 |
|
|
|
212 |
|
|
def __init__(self, parent, ID, title, |
213 |
|
|
pos=wxDefaultPosition, size=wxDefaultSize, |
214 |
|
|
style=wxDEFAULT_DIALOG_STYLE): |
215 |
|
|
|
216 |
|
|
# initialize the Dialog |
217 |
|
|
wxDialog.__init__(self, parent, ID, title, pos, size, style) |
218 |
|
|
|
219 |
|
|
# get the web object |
220 |
|
|
self.tb_map = parent.canvas.Map() |
221 |
|
|
self.tb_map_umn = self.tb_map.extension_umn_mapobj |
222 |
|
|
|
223 |
jschuengel |
2274 |
#get the imagetype |
224 |
jschuengel |
2271 |
umn_imagetype = self.tb_map_umn.get_imagetype() |
225 |
jschuengel |
2274 |
# create a list with the outputformat names |
226 |
|
|
umn_outputformats = [] |
227 |
|
|
for format in self.tb_map_umn.get_alloutputformats(): |
228 |
|
|
umn_outputformats.append(format.get_name()) |
229 |
jschuengel |
2271 |
#Imagetype selector |
230 |
jschuengel |
2274 |
box_imagetypeStatic = wxStaticBox(self, -1, _("Image Type"), |
231 |
|
|
style = 0, name = "imagetype") |
232 |
jschuengel |
2271 |
box_imagetype = wxStaticBoxSizer(box_imagetypeStatic, wxVERTICAL) |
233 |
jschuengel |
2274 |
self.choice_imgtype = wxChoice(self, 8060, (80, 50), |
234 |
|
|
choices = umn_outputformats) |
235 |
jschuengel |
2271 |
EVT_CHOICE(self, 8060, self.EvtChoiceBox) |
236 |
|
|
self.choice_imgtype.SetStringSelection(umn_imagetype) |
237 |
|
|
box_imagetype.Add(self.choice_imgtype,0, wxEXPAND, wxALL, 5) |
238 |
|
|
|
239 |
|
|
#buttons |
240 |
|
|
box_buttons = wxBoxSizer(wxHORIZONTAL) |
241 |
|
|
button = wxButton(self, wxID_OK, _("OK")) |
242 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
243 |
|
|
button = wxButton(self, wxID_CANCEL, _("Cancel")) |
244 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
245 |
|
|
#set the button funcitons |
246 |
|
|
EVT_BUTTON(self, wxID_OK, self.OnOK) |
247 |
|
|
EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) |
248 |
|
|
|
249 |
|
|
#add all boxes to the box top |
250 |
|
|
top = wxBoxSizer(wxVERTICAL) |
251 |
|
|
top.Add(box_imagetype,0, wxEXPAND |wxALL, 5) |
252 |
|
|
top.Add(box_buttons, 0, wxALIGN_RIGHT) |
253 |
|
|
# final layout settings |
254 |
|
|
self.SetSizer(top) |
255 |
|
|
top.Fit(self) |
256 |
|
|
|
257 |
|
|
def EvtChoiceBox(self, event): |
258 |
|
|
outformat = self.tb_map_umn.get_outputformat().get_name() |
259 |
|
|
|
260 |
|
|
def RunDialog(self): |
261 |
|
|
self.ShowModal() |
262 |
|
|
self.Destroy() |
263 |
|
|
|
264 |
|
|
def end_dialog(self, result): |
265 |
|
|
self.result = result |
266 |
|
|
if self.result is not None: |
267 |
|
|
self.EndModal(wxID_OK) |
268 |
|
|
else: |
269 |
|
|
self.EndModal(wxID_CANCEL) |
270 |
|
|
self.Show(False) |
271 |
|
|
|
272 |
|
|
def OnOK(self, event): |
273 |
|
|
self.tb_map_umn.set_imagetype(self.choice_imgtype.GetStringSelection()) |
274 |
|
|
self.result ="OK" |
275 |
|
|
self.end_dialog(self.result) |
276 |
|
|
|
277 |
|
|
def OnCancel(self, event): |
278 |
|
|
self.end_dialog(None) |
279 |
|
|
|
280 |
|
|
|
281 |
jschuengel |
2257 |
class Web_Dialog(wxDialog): |
282 |
|
|
|
283 |
|
|
def __init__(self, parent, ID, title, |
284 |
|
|
pos=wxDefaultPosition, size=wxDefaultSize, |
285 |
|
|
style=wxDEFAULT_DIALOG_STYLE): |
286 |
|
|
|
287 |
|
|
# initialize the Dialog |
288 |
|
|
wxDialog.__init__(self, parent, ID, title, pos, size, style) |
289 |
|
|
|
290 |
|
|
# get the web object |
291 |
|
|
self.tb_map = parent.canvas.Map() |
292 |
|
|
self.umn_web = self.tb_map.extension_umn_mapobj.get_web() |
293 |
|
|
|
294 |
|
|
# create name |
295 |
|
|
box_name = wxBoxSizer(wxHORIZONTAL) |
296 |
|
|
box_name.Add(wxStaticText(self, -1, _("Map-Name:")), 0, |
297 |
|
|
wxALL|wxALIGN_CENTER_VERTICAL, 4) |
298 |
|
|
box_name.Add(wxStaticText(self, -1, self.tb_map.Title()), 0, |
299 |
|
|
wxALL|wxALIGN_CENTER_VERTICAL, 4) |
300 |
|
|
|
301 |
|
|
# Imagepath |
302 |
|
|
box_imagepath = wxBoxSizer(wxHORIZONTAL) |
303 |
|
|
box_imagepath.Add(wxStaticText(self, -1, _("Imagepath:")), 0, |
304 |
|
|
wxALL|wxALIGN_LEFT, 4) |
305 |
jschuengel |
2274 |
self.text_imagepath = wxTextCtrl(self, -1, |
306 |
|
|
str(self.umn_web.get_imagepath())) |
307 |
jschuengel |
2257 |
box_imagepath.Add(self.text_imagepath, 0, |
308 |
|
|
wxALL|wxALIGN_CENTER_VERTICAL, 4) |
309 |
|
|
|
310 |
|
|
# Imageurl |
311 |
|
|
box_imageurl = wxBoxSizer(wxHORIZONTAL) |
312 |
|
|
box_imageurl.Add(wxStaticText(self, -1, _("Imageurl:")), 0, |
313 |
|
|
wxALL|wxALIGN_LEFT, 4) |
314 |
jschuengel |
2274 |
self.text_imageurl = wxTextCtrl(self, -1, |
315 |
|
|
str(self.umn_web.get_imageurl())) |
316 |
jschuengel |
2257 |
box_imageurl.Add(self.text_imageurl, 0, |
317 |
|
|
wxALL|wxALIGN_CENTER_VERTICAL, 4) |
318 |
|
|
|
319 |
|
|
#buttons |
320 |
|
|
box_buttons = wxBoxSizer(wxHORIZONTAL) |
321 |
|
|
button = wxButton(self, wxID_OK, _("OK")) |
322 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
323 |
|
|
button = wxButton(self, wxID_CANCEL, _("Cancel")) |
324 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
325 |
|
|
#set the button funcitons |
326 |
|
|
EVT_BUTTON(self, wxID_OK, self.OnOK) |
327 |
jschuengel |
2271 |
EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) |
328 |
|
|
|
329 |
|
|
# compose the final dialog |
330 |
|
|
top = wxBoxSizer(wxVERTICAL) |
331 |
|
|
top.Add(box_name, 0, wxEXPAND |wxALL, 5) |
332 |
|
|
top.Add(box_imagepath, 0, wxEXPAND |wxALL, 5) |
333 |
|
|
top.Add(box_imageurl, 0, wxEXPAND |wxALL, 5) |
334 |
jschuengel |
2257 |
top.Add(box_buttons, 0, wxALIGN_RIGHT) |
335 |
|
|
|
336 |
|
|
# final layout settings |
337 |
|
|
self.SetSizer(top) |
338 |
|
|
top.Fit(self) |
339 |
|
|
|
340 |
|
|
def RunDialog(self): |
341 |
|
|
self.ShowModal() |
342 |
|
|
self.Destroy() |
343 |
|
|
|
344 |
|
|
def end_dialog(self, result): |
345 |
|
|
self.result = result |
346 |
|
|
if self.result is not None: |
347 |
|
|
self.EndModal(wxID_OK) |
348 |
|
|
else: |
349 |
|
|
self.EndModal(wxID_CANCEL) |
350 |
|
|
self.Show(False) |
351 |
|
|
|
352 |
|
|
def OnOK(self, event): |
353 |
|
|
self.umn_web.set_imagepath(self.text_imagepath.GetValue()) |
354 |
|
|
self.umn_web.set_imageurl(self.text_imageurl.GetValue()) |
355 |
|
|
self.result ="OK" |
356 |
|
|
self.end_dialog(self.result) |
357 |
|
|
|
358 |
|
|
def OnCancel(self, event): |
359 |
|
|
self.end_dialog(None) |
360 |
|
|
|
361 |
|
|
|
362 |
|
|
ID_LABEL_CHANGE = 8011 |
363 |
|
|
|
364 |
|
|
class Legend_Dialog(wxDialog): |
365 |
|
|
|
366 |
|
|
def __init__(self, parent, ID, title, |
367 |
|
|
pos=wxDefaultPosition, size=wxDefaultSize, |
368 |
|
|
style=wxDEFAULT_DIALOG_STYLE): |
369 |
|
|
|
370 |
|
|
# initialize the Dialog |
371 |
|
|
wxDialog.__init__(self, parent, ID, title, pos, size, style) |
372 |
|
|
|
373 |
|
|
# get the web object |
374 |
|
|
self.tb_map = parent.canvas.Map() |
375 |
|
|
self.umn_legend = self.tb_map.extension_umn_mapobj.get_legend() |
376 |
|
|
|
377 |
|
|
# create the Keysize |
378 |
jschuengel |
2274 |
keySize = wxStaticBox(self, 1010, _("KeySize"), style = 0, |
379 |
|
|
name = "KeySize Box", ) |
380 |
jschuengel |
2257 |
box_keysize = wxStaticBoxSizer(keySize, wxVERTICAL) |
381 |
|
|
umn_legend_keysize = self.umn_legend.get_keysize() |
382 |
|
|
box_sizepartWidth = wxBoxSizer(wxHORIZONTAL) |
383 |
|
|
box_sizepartWidth.Add(wxStaticText(self, -1, _("Width: ")), 0, wxALL, 2) |
384 |
|
|
self.text_keysize_width = wxSpinCtrl(self, -1, |
385 |
|
|
value=str(umn_legend_keysize[0]), max=100, min=0, |
386 |
|
|
name='keywidth', style=wxSP_ARROW_KEYS) |
387 |
|
|
box_sizepartWidth.Add(self.text_keysize_width, 2, wxALL, 2) |
388 |
|
|
box_keysize.Add(box_sizepartWidth, 0, wxALIGN_RIGHT | wxALL, 2) |
389 |
|
|
box_sizepartHeight = wxBoxSizer(wxHORIZONTAL) |
390 |
|
|
box_sizepartHeight.Add(wxStaticText(self, -1, _("Height: ")), 0, wxALL, 2), |
391 |
|
|
self.text_keysize_height = wxSpinCtrl(self, -1, |
392 |
|
|
value=str(umn_legend_keysize[1]), max=100, min=0, |
393 |
|
|
name='keyheight', style=wxSP_ARROW_KEYS) |
394 |
|
|
box_sizepartHeight.Add(self.text_keysize_height, 2, wxALL, 2) |
395 |
|
|
box_keysize.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 2) |
396 |
|
|
|
397 |
|
|
# create the Keyspacing |
398 |
jschuengel |
2274 |
keySpacing= wxStaticBox(self, 1010, _("KeySpacing"), style = 0, |
399 |
|
|
name = "KeySpacing Box", ) |
400 |
jschuengel |
2257 |
box_keyspacing = wxStaticBoxSizer(keySpacing, wxVERTICAL) |
401 |
|
|
umn_legend_keyspacing = self.umn_legend.get_keyspacing() |
402 |
|
|
box_sizepartWidth = wxBoxSizer(wxHORIZONTAL) |
403 |
|
|
box_sizepartWidth.Add(wxStaticText(self, -1, _("Width: ")), 0, wxALL, 2) |
404 |
|
|
self.text_keyspacing_width = wxSpinCtrl(self, -1, |
405 |
jschuengel |
2274 |
value=str(umn_legend_keyspacing[0]), max=100, |
406 |
|
|
min=0, name='spacingwidth', style=wxSP_ARROW_KEYS) |
407 |
jschuengel |
2257 |
box_sizepartWidth.Add(self.text_keyspacing_width, 2, wxALL, 2) |
408 |
|
|
box_keyspacing.Add(box_sizepartWidth, 0, wxALIGN_RIGHT | wxALL, 2) |
409 |
|
|
box_sizepartHeight = wxBoxSizer(wxHORIZONTAL) |
410 |
|
|
box_sizepartHeight.Add(wxStaticText(self, -1, _("Height: ")), 0, wxALL, 2), |
411 |
|
|
self.text_keyspacing_height = wxSpinCtrl(self, -1, |
412 |
jschuengel |
2274 |
value=str(umn_legend_keyspacing[1]), max=100, |
413 |
|
|
min=0,name='spacingheight', style=wxSP_ARROW_KEYS) |
414 |
jschuengel |
2257 |
box_sizepartHeight.Add(self.text_keyspacing_height, 2, wxALL, 2) |
415 |
|
|
box_keyspacing.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 2) |
416 |
|
|
|
417 |
|
|
# color chooser |
418 |
jschuengel |
2274 |
box_colorStatic = wxStaticBox(self, 1011, _("ImageColor"), style = 0, |
419 |
|
|
name = "imagecolor") |
420 |
jschuengel |
2257 |
box_color = wxStaticBoxSizer(box_colorStatic, wxVERTICAL) |
421 |
|
|
# preview box |
422 |
jschuengel |
2274 |
self.previewcolor = wxPanel(self, 99, name = 'imagecolorPanel', |
423 |
|
|
style = wxSIMPLE_BORDER | wxCLIP_CHILDREN) |
424 |
jschuengel |
2257 |
imagecolor = self.umn_legend.get_imagecolor() |
425 |
|
|
self.previewcolor.SetBackgroundColour(wxColour(imagecolor.get_red(), |
426 |
|
|
imagecolor.get_green(), imagecolor.get_blue())) |
427 |
|
|
box_color.Add(self.previewcolor, 1, wxGROW | wxALL, 5) |
428 |
|
|
# color change button, opens a new color dialog |
429 |
|
|
button = wxButton(self, ID_COLOR_CHANGE, _("Change Color")) |
430 |
|
|
button.SetFocus() |
431 |
|
|
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor) |
432 |
|
|
box_color.Add(button, 1, wxEXPAND|wxALL, 5) |
433 |
|
|
|
434 |
jschuengel |
2267 |
# status |
435 |
jschuengel |
2274 |
umn_legend_status= self.umn_legend.get_status(mode="string") |
436 |
jschuengel |
2257 |
possible_choices = [] |
437 |
|
|
for key in legend_status_type: |
438 |
|
|
possible_choices.append(legend_status_type[key]) |
439 |
|
|
self.choice_status = wxRadioBox(self, -1, choices=possible_choices, |
440 |
|
|
label='Status', majorDimension=1, |
441 |
|
|
name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS) |
442 |
|
|
self.choice_status.SetStringSelection(umn_legend_status) |
443 |
|
|
|
444 |
|
|
# create the positionbox |
445 |
jschuengel |
2274 |
umn_legend_position= self.umn_legend.get_position(mode="string") |
446 |
jschuengel |
2257 |
possible_choices = [] |
447 |
|
|
for key in legend_position_type: |
448 |
|
|
possible_choices.append(legend_position_type[key]) |
449 |
|
|
self.choice_position = wxRadioBox(self, -1, choices=possible_choices, |
450 |
jschuengel |
2274 |
label='Position', majorDimension=1, |
451 |
|
|
name='position check', |
452 |
|
|
size=wxDefaultSize, |
453 |
|
|
style=wxRA_SPECIFY_ROWS) |
454 |
jschuengel |
2257 |
self.choice_position.SetStringSelection(umn_legend_position) |
455 |
|
|
|
456 |
jschuengel |
2271 |
# button for label |
457 |
|
|
labelbutton = wxButton(self, ID_LABEL_CHANGE, _("Change Label")) |
458 |
jschuengel |
2257 |
EVT_BUTTON(self, ID_LABEL_CHANGE, self.OnChangeLabel) |
459 |
|
|
|
460 |
|
|
#buttons |
461 |
|
|
box_buttons = wxBoxSizer(wxHORIZONTAL) |
462 |
|
|
button = wxButton(self, wxID_OK, _("OK")) |
463 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
464 |
|
|
button = wxButton(self, wxID_CANCEL, _("Cancel")) |
465 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
466 |
|
|
#set the button funcitons |
467 |
|
|
EVT_BUTTON(self, wxID_OK, self.OnOK) |
468 |
|
|
EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) |
469 |
jschuengel |
2271 |
|
470 |
|
|
# compose the final layout |
471 |
|
|
top = wxBoxSizer(wxVERTICAL) |
472 |
|
|
top.Add(box_keysize,0, wxEXPAND |wxALL, 5) |
473 |
|
|
top.Add(box_keyspacing,0, wxEXPAND |wxALL, 5) |
474 |
|
|
top.Add(box_color,0, wxEXPAND |wxALL, 5) |
475 |
|
|
top.Add(self.choice_status,0, wxEXPAND |wxALL, 5) |
476 |
|
|
top.Add(self.choice_position,0, wxEXPAND |wxALL, 5) |
477 |
|
|
top.Add(labelbutton, 1, wxEXPAND|wxALL, 5) |
478 |
jschuengel |
2257 |
top.Add(box_buttons, 0, wxALIGN_RIGHT) |
479 |
|
|
|
480 |
|
|
# final layout settings |
481 |
|
|
self.SetSizer(top) |
482 |
|
|
top.Fit(self) |
483 |
|
|
|
484 |
|
|
def OnChangeLabel(self, event): |
485 |
jschuengel |
2267 |
self.umn_label = self.umn_legend.get_label() |
486 |
jschuengel |
2274 |
dialog = Label_Dialog(self, -1, "Legend Label Settings", |
487 |
|
|
size=wxSize(350, 200), |
488 |
jschuengel |
2257 |
style = wxDEFAULT_DIALOG_STYLE |
489 |
|
|
) |
490 |
|
|
dialog.CenterOnScreen() |
491 |
|
|
if dialog.ShowModal() == wxID_OK: |
492 |
|
|
return |
493 |
|
|
dialog.Destroy() |
494 |
|
|
|
495 |
|
|
def OnChangeColor(self, event): |
496 |
|
|
cur = self.umn_legend.get_imagecolor().get_thubancolor() |
497 |
|
|
dialog = ColorDialog(self) |
498 |
|
|
dialog.SetColor(cur) |
499 |
|
|
self.retcolor = None |
500 |
|
|
if dialog.ShowModal() == wxID_OK: |
501 |
|
|
self.retcolor = dialog.GetColor() |
502 |
|
|
dialog.Destroy() |
503 |
|
|
if self.retcolor: |
504 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
505 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
506 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
507 |
jschuengel |
2274 |
self.previewcolor.SetBackgroundColour(wxColour(int(self.redcolor), |
508 |
|
|
int(self.greencolor), |
509 |
|
|
int(self.bluecolor))) |
510 |
jschuengel |
2257 |
|
511 |
|
|
def RunDialog(self): |
512 |
|
|
self.ShowModal() |
513 |
|
|
self.Destroy() |
514 |
|
|
|
515 |
|
|
def end_dialog(self, result): |
516 |
|
|
self.result = result |
517 |
|
|
if self.result is not None: |
518 |
|
|
self.EndModal(wxID_OK) |
519 |
|
|
else: |
520 |
|
|
self.EndModal(wxID_CANCEL) |
521 |
|
|
self.Show(False) |
522 |
|
|
|
523 |
|
|
def OnOK(self, event): |
524 |
jschuengel |
2271 |
self.umn_legend.set_keysize(self.text_keysize_width.GetValue(), |
525 |
|
|
self.text_keysize_height.GetValue()) |
526 |
|
|
self.umn_legend.set_keyspacing(self.text_keyspacing_width.GetValue(), |
527 |
|
|
self.text_keyspacing_height.GetValue()) |
528 |
jschuengel |
2257 |
self.umn_legend.set_status(self.choice_status.GetStringSelection()) |
529 |
|
|
self.umn_legend.set_position(self.choice_position.GetStringSelection()) |
530 |
jschuengel |
2267 |
previewcolor = self.previewcolor.GetBackgroundColour() |
531 |
|
|
self.umn_legend.get_imagecolor().set_rgbcolor(previewcolor.Red(), |
532 |
|
|
previewcolor.Green(), previewcolor.Blue()) |
533 |
jschuengel |
2257 |
self.result ="OK" |
534 |
|
|
self.end_dialog(self.result) |
535 |
|
|
|
536 |
|
|
def OnCancel(self, event): |
537 |
|
|
self.end_dialog(None) |
538 |
|
|
|
539 |
|
|
class Label_Dialog(wxDialog): |
540 |
|
|
|
541 |
|
|
def __init__(self, parent, ID, title, |
542 |
|
|
pos=wxDefaultPosition, size=wxDefaultSize, |
543 |
|
|
style=wxDEFAULT_DIALOG_STYLE): |
544 |
|
|
|
545 |
|
|
# initialize the Dialog |
546 |
|
|
wxDialog.__init__(self, parent, ID, title, pos, size, style) |
547 |
|
|
|
548 |
|
|
# get the web object |
549 |
jschuengel |
2267 |
self.umn_label = parent.umn_label |
550 |
jschuengel |
2257 |
|
551 |
|
|
# size |
552 |
jschuengel |
2274 |
labelsize= wxStaticBox(self, 1010, _("Size"), style = 0, |
553 |
|
|
name = "Size Box", ) |
554 |
jschuengel |
2257 |
box_labelsize = wxStaticBoxSizer(labelsize, wxVERTICAL) |
555 |
|
|
umn_label_size= self.umn_label.get_size() |
556 |
|
|
box_size = wxBoxSizer(wxHORIZONTAL) |
557 |
|
|
self.text_labelsize = wxSpinCtrl(self, -1, |
558 |
|
|
value=str(umn_label_size), max=10, min=0, |
559 |
|
|
name='size', style=wxSP_ARROW_KEYS) |
560 |
|
|
box_size.Add(self.text_labelsize, 2, wxALL, 2) |
561 |
|
|
box_labelsize.Add(box_size, 0, wxALIGN_RIGHT | wxALL, 2) |
562 |
|
|
|
563 |
|
|
# color chooser |
564 |
jschuengel |
2274 |
box_colorStatic = wxStaticBox(self, 1011, _("Color"), style = 0, |
565 |
|
|
name = "color") |
566 |
jschuengel |
2257 |
box_color = wxStaticBoxSizer(box_colorStatic, wxVERTICAL) |
567 |
|
|
# preview box |
568 |
jschuengel |
2274 |
self.previewcolor = wxPanel(self, 99, name = 'colorPanel', |
569 |
|
|
style = wxSIMPLE_BORDER | wxCLIP_CHILDREN) |
570 |
jschuengel |
2257 |
color = self.umn_label.get_color() |
571 |
|
|
self.previewcolor.SetBackgroundColour(wxColour(color.get_red(), |
572 |
|
|
color.get_green(), color.get_blue())) |
573 |
|
|
box_color.Add(self.previewcolor, 1, wxGROW | wxALL, 5) |
574 |
|
|
# color change button, opens a new color dialog |
575 |
|
|
button = wxButton(self, ID_COLOR_CHANGE, _("Change Color")) |
576 |
|
|
button.SetFocus() |
577 |
|
|
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor) |
578 |
|
|
box_color.Add(button, 1, wxEXPAND|wxALL, 5) |
579 |
|
|
|
580 |
|
|
#get the set type |
581 |
|
|
insidetype = self.umn_label.get_type() |
582 |
|
|
#create the type selector for fonttype (Bitmap, TrueType) |
583 |
|
|
# TODO: Truetype is not supported yet |
584 |
jschuengel |
2274 |
box_typeStatic = wxStaticBox(self, 1011, _("Type"), style = 0, |
585 |
|
|
name = "type") |
586 |
jschuengel |
2257 |
box_type = wxStaticBoxSizer(box_typeStatic, wxVERTICAL) |
587 |
|
|
sam = [] |
588 |
|
|
for key in label_font_type: |
589 |
|
|
# dont add truetype |
590 |
|
|
#if key != 0: |
591 |
|
|
sam.append(label_font_type[key]) |
592 |
|
|
self.choice_type = wxChoice(self, 40, (80, 50), choices = sam) |
593 |
|
|
self.choice_type.SetStringSelection(insidetype) |
594 |
|
|
box_type.Add(self.choice_type,0, wxEXPAND, wxALL, 5) |
595 |
jschuengel |
2271 |
|
596 |
jschuengel |
2257 |
# Offset |
597 |
jschuengel |
2274 |
offset= wxStaticBox(self, 1010, _("Offset"), style = 0, |
598 |
|
|
name = "Offset Box", ) |
599 |
jschuengel |
2257 |
box_offset = wxStaticBoxSizer(offset, wxVERTICAL) |
600 |
|
|
umn_label_offset = self.umn_label.get_offset() |
601 |
|
|
box_offsetX = wxBoxSizer(wxHORIZONTAL) |
602 |
|
|
box_offsetX.Add(wxStaticText(self, -1, _("X: ")), 0, wxALL, 2) |
603 |
|
|
self.text_offsetx = wxSpinCtrl(self, -1, |
604 |
|
|
value=str(umn_label_offset[0]), max=20, min=0, |
605 |
|
|
name='offsetX', style=wxSP_ARROW_KEYS) |
606 |
|
|
box_offsetX.Add(self.text_offsetx, 2, wxALL, 2) |
607 |
|
|
box_offset.Add(box_offsetX, 0, wxALIGN_RIGHT | wxALL, 2) |
608 |
|
|
box_offsetY = wxBoxSizer(wxHORIZONTAL) |
609 |
|
|
box_offsetY.Add(wxStaticText(self, -1, _("Y: ")), 0, wxALL, 2), |
610 |
|
|
self.text_offsety = wxSpinCtrl(self, -1, |
611 |
|
|
value=str(umn_label_offset[1]), max=100, min=0, |
612 |
|
|
name='offsetY', style=wxSP_ARROW_KEYS) |
613 |
|
|
box_offsetY.Add(self.text_offsety, 2, wxALL, 2) |
614 |
|
|
box_offset.Add(box_offsetY, 0, wxALIGN_RIGHT | wxALL, 2) |
615 |
|
|
|
616 |
jschuengel |
2271 |
# partials |
617 |
jschuengel |
2267 |
umn_partials = self.umn_label.get_partials() |
618 |
|
|
self.choice_partials = wxRadioBox(self, -1, choices=["True","False"], |
619 |
jschuengel |
2274 |
label='partials', majorDimension=1, |
620 |
|
|
name='partials check', |
621 |
|
|
size=wxDefaultSize, |
622 |
|
|
style=wxRA_SPECIFY_ROWS) |
623 |
jschuengel |
2267 |
self.choice_partials.SetStringSelection(str(umn_partials)) |
624 |
jschuengel |
2271 |
|
625 |
|
|
# force |
626 |
|
|
umn_force = self.umn_label.get_force() |
627 |
|
|
self.choice_force = wxRadioBox(self, -1, choices=["True","False"], |
628 |
|
|
label='force', majorDimension=1, |
629 |
|
|
name='force check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS) |
630 |
|
|
self.choice_force.SetStringSelection(str(umn_force)) |
631 |
|
|
|
632 |
|
|
# buffer |
633 |
jschuengel |
2274 |
buffer = wxStaticBox(self, 1010, _("Buffer"), style = 0, |
634 |
|
|
name = "Buffer Box", ) |
635 |
jschuengel |
2271 |
box_buffer = wxStaticBoxSizer(buffer, wxVERTICAL) |
636 |
|
|
umn_buffer= self.umn_label.get_buffer() |
637 |
|
|
box_buffertext = wxBoxSizer(wxHORIZONTAL) |
638 |
|
|
self.text_buffer = wxSpinCtrl(self, -1, |
639 |
|
|
value=str(umn_buffer), max=10, min=0, |
640 |
|
|
name='size', style=wxSP_ARROW_KEYS) |
641 |
|
|
box_buffertext.Add(self.text_buffer, 2, wxALL, 2) |
642 |
|
|
box_buffer.Add(box_buffertext, 0, wxALIGN_RIGHT | wxALL, 2) |
643 |
|
|
|
644 |
|
|
# minfeaturesize |
645 |
jschuengel |
2274 |
minfeaturesize = wxStaticBox(self, 1010, _("Minfeaturesize"), |
646 |
|
|
style = 0, name = "Minfeaturesize Box") |
647 |
jschuengel |
2271 |
box_minfeaturesize = wxStaticBoxSizer(minfeaturesize, wxVERTICAL) |
648 |
|
|
umn_minfeaturesize= self.umn_label.get_minfeaturesize() |
649 |
|
|
box_minfeaturesizetext = wxBoxSizer(wxHORIZONTAL) |
650 |
|
|
self.text_minfeaturesize = wxSpinCtrl(self, -1, |
651 |
|
|
value=str(umn_minfeaturesize), max=10, min=-1, |
652 |
|
|
name='minfeaturesize', style=wxSP_ARROW_KEYS) |
653 |
|
|
box_minfeaturesizetext.Add(self.text_minfeaturesize, 2, wxALL, 2) |
654 |
|
|
box_minfeaturesize.Add(box_minfeaturesizetext, 0, |
655 |
|
|
wxALIGN_RIGHT | wxALL, 2) |
656 |
|
|
|
657 |
|
|
# mindistance |
658 |
|
|
mindistance = wxStaticBox(self, 1010, _("Mindistance"), style = 0, |
659 |
|
|
name = "Mindistance Box", ) |
660 |
|
|
box_mindistance = wxStaticBoxSizer(mindistance, wxVERTICAL) |
661 |
|
|
umn_mindistance= self.umn_label.get_mindistance() |
662 |
|
|
box_mindistancetext = wxBoxSizer(wxHORIZONTAL) |
663 |
|
|
self.text_mindistance = wxSpinCtrl(self, -1, |
664 |
|
|
value=str(umn_mindistance), max=10, min=-1, |
665 |
|
|
name='mindistance', style=wxSP_ARROW_KEYS) |
666 |
|
|
box_mindistancetext.Add(self.text_mindistance, 2, wxALL, 2) |
667 |
|
|
box_mindistance.Add(box_mindistancetext, 0, |
668 |
|
|
wxALIGN_RIGHT | wxALL, 2) |
669 |
jschuengel |
2257 |
|
670 |
jschuengel |
2271 |
# position |
671 |
jschuengel |
2274 |
umn_label_position= self.umn_label.get_position(mode="string") |
672 |
jschuengel |
2271 |
possible_choices = [] |
673 |
|
|
for key in label_position_type: |
674 |
|
|
possible_choices.append(label_position_type[key]) |
675 |
|
|
self.choice_position = wxRadioBox(self, -1, choices=possible_choices, |
676 |
jschuengel |
2274 |
label='Position', majorDimension=1, |
677 |
|
|
name='position check', |
678 |
|
|
size=wxDefaultSize, |
679 |
|
|
style=wxRA_SPECIFY_ROWS) |
680 |
jschuengel |
2271 |
self.choice_position.SetStringSelection(umn_label_position) |
681 |
|
|
|
682 |
jschuengel |
2257 |
#buttons |
683 |
|
|
box_buttons = wxBoxSizer(wxHORIZONTAL) |
684 |
|
|
button = wxButton(self, wxID_OK, _("OK")) |
685 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
686 |
|
|
button = wxButton(self, wxID_CANCEL, _("Cancel")) |
687 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
688 |
|
|
#set the button funcitons |
689 |
|
|
EVT_BUTTON(self, wxID_OK, self.OnOK) |
690 |
|
|
EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) |
691 |
jschuengel |
2271 |
|
692 |
|
|
# compose the Dialog |
693 |
|
|
top = wxBoxSizer(wxVERTICAL) |
694 |
|
|
|
695 |
|
|
top1 = wxBoxSizer(wxHORIZONTAL) |
696 |
|
|
top1.Add(box_labelsize,0, wxEXPAND |wxALL, 5) |
697 |
|
|
top1.Add(box_color,0, wxEXPAND |wxALL, 5) |
698 |
|
|
top1.Add(box_minfeaturesize,0, wxEXPAND |wxALL, 5) |
699 |
|
|
|
700 |
|
|
top2 = wxBoxSizer(wxHORIZONTAL) |
701 |
|
|
top2.Add(box_type,0,wxEXPAND |wxALL, 5) |
702 |
|
|
top2.Add(box_offset,0, wxEXPAND |wxALL, 5) |
703 |
|
|
top2.Add(box_mindistance,0, wxEXPAND |wxALL, 5) |
704 |
|
|
|
705 |
|
|
top3 = wxBoxSizer(wxHORIZONTAL) |
706 |
|
|
top3.Add(self.choice_partials,0, wxEXPAND |wxALL, 5) |
707 |
|
|
top3.Add(box_buffer,0, wxEXPAND |wxALL, 5) |
708 |
|
|
top3.Add(self.choice_force,0, wxEXPAND |wxALL, 5) |
709 |
|
|
|
710 |
|
|
top.Add(top1, 0, wxEXPAND) |
711 |
|
|
top.Add(top2, 0, wxEXPAND) |
712 |
|
|
top.Add(top3, 0, wxEXPAND) |
713 |
|
|
top.Add(self.choice_position,0, wxEXPAND |wxALL, 5) |
714 |
jschuengel |
2257 |
top.Add(box_buttons, 0, wxALIGN_RIGHT) |
715 |
jschuengel |
2271 |
|
716 |
jschuengel |
2257 |
# final layout settings |
717 |
|
|
self.SetSizer(top) |
718 |
|
|
top.Fit(self) |
719 |
|
|
|
720 |
|
|
def OnChangeColor(self, event): |
721 |
|
|
cur = self.umn_label.get_color().get_thubancolor() |
722 |
|
|
dialog = ColorDialog(self) |
723 |
|
|
dialog.SetColor(cur) |
724 |
|
|
self.retcolor = None |
725 |
|
|
if dialog.ShowModal() == wxID_OK: |
726 |
|
|
self.retcolor = dialog.GetColor() |
727 |
|
|
dialog.Destroy() |
728 |
|
|
if self.retcolor: |
729 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
730 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
731 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
732 |
jschuengel |
2274 |
self.previewcolor.SetBackgroundColour(wxColour(int(self.redcolor), |
733 |
|
|
int(self.greencolor), |
734 |
|
|
int(self.bluecolor))) |
735 |
jschuengel |
2257 |
|
736 |
|
|
def RunDialog(self): |
737 |
|
|
self.ShowModal() |
738 |
|
|
self.Destroy() |
739 |
|
|
|
740 |
|
|
def end_dialog(self, result): |
741 |
|
|
self.result = result |
742 |
|
|
if self.result is not None: |
743 |
|
|
self.EndModal(wxID_OK) |
744 |
|
|
else: |
745 |
|
|
self.EndModal(wxID_CANCEL) |
746 |
|
|
self.Show(False) |
747 |
|
|
|
748 |
|
|
def OnOK(self, event): |
749 |
|
|
self.umn_label.set_size(self.text_labelsize.GetValue()) |
750 |
jschuengel |
2274 |
self.umn_label.set_offset(self.text_offsetx.GetValue(), |
751 |
|
|
self.text_offsety.GetValue()) |
752 |
jschuengel |
2257 |
self.umn_label.set_type(self.choice_type.GetStringSelection()) |
753 |
jschuengel |
2267 |
if self.choice_partials.GetStringSelection() == "True": |
754 |
|
|
self.umn_label.set_partials(True) |
755 |
|
|
else: |
756 |
|
|
self.umn_label.set_partials(False) |
757 |
|
|
previewcolor = self.previewcolor.GetBackgroundColour() |
758 |
|
|
self.umn_label.get_color().set_rgbcolor(previewcolor.Red(), |
759 |
|
|
previewcolor.Green(), previewcolor.Blue()) |
760 |
jschuengel |
2271 |
self.umn_label.set_mindistance(self.text_mindistance.GetValue()) |
761 |
|
|
self.umn_label.set_minfeaturesize(self.text_minfeaturesize.GetValue()) |
762 |
|
|
self.umn_label.set_position(self.choice_position.GetStringSelection()) |
763 |
|
|
self.umn_label.set_buffer(self.text_buffer.GetValue()) |
764 |
|
|
if self.choice_force.GetStringSelection() == "True": |
765 |
|
|
self.umn_label.set_force(True) |
766 |
|
|
else: |
767 |
|
|
self.umn_label.set_force(False) |
768 |
jschuengel |
2257 |
self.result ="OK" |
769 |
|
|
self.end_dialog(self.result) |
770 |
|
|
|
771 |
|
|
def OnCancel(self, event): |
772 |
|
|
self.end_dialog(None) |
773 |
|
|
|
774 |
jschuengel |
2267 |
class Scalebar_Dialog(wxDialog): |
775 |
|
|
|
776 |
|
|
def __init__(self, parent, ID, title, |
777 |
|
|
pos=wxDefaultPosition, size=wxDefaultSize, |
778 |
|
|
style=wxDEFAULT_DIALOG_STYLE): |
779 |
|
|
|
780 |
|
|
# initialize the Dialog |
781 |
|
|
wxDialog.__init__(self, parent, ID, title, pos, size, style) |
782 |
jschuengel |
2257 |
|
783 |
jschuengel |
2267 |
# get the web object |
784 |
|
|
self.tb_map = parent.canvas.Map() |
785 |
|
|
self.umn_scalebar = self.tb_map.extension_umn_mapobj.get_scalebar() |
786 |
|
|
|
787 |
|
|
# color chooser |
788 |
jschuengel |
2274 |
box_colorStatic = wxStaticBox(self, 1011, _("Color"), style = 0, |
789 |
|
|
name = "color") |
790 |
jschuengel |
2267 |
box_color = wxStaticBoxSizer(box_colorStatic, wxVERTICAL) |
791 |
|
|
# preview box |
792 |
jschuengel |
2274 |
self.previewcolor = wxPanel(self, 99, name = 'colorPanel', |
793 |
|
|
style = wxSIMPLE_BORDER | wxCLIP_CHILDREN) |
794 |
jschuengel |
2267 |
color = self.umn_scalebar.get_color() |
795 |
|
|
self.previewcolor.SetBackgroundColour(wxColour(color.get_red(), |
796 |
|
|
color.get_green(), color.get_blue())) |
797 |
|
|
box_color.Add(self.previewcolor, 1, wxGROW | wxALL, 5) |
798 |
|
|
# color change button, opens a new color dialog |
799 |
|
|
button = wxButton(self, ID_COLOR_CHANGE, _("Change Color")) |
800 |
|
|
button.SetFocus() |
801 |
|
|
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor) |
802 |
|
|
box_color.Add(button, 1, wxEXPAND|wxALL, 5) |
803 |
|
|
# show the two color chooser horizontal |
804 |
|
|
colorHor = wxBoxSizer(wxHORIZONTAL) |
805 |
|
|
colorHor.Add(box_color,0, wxEXPAND |wxALL, 5) |
806 |
|
|
|
807 |
|
|
# imagecolor chooser |
808 |
jschuengel |
2274 |
box_imgcolorStatic = wxStaticBox(self, 1011, _("Image Color"), |
809 |
|
|
style = 0, name = "imgcolor") |
810 |
jschuengel |
2267 |
box_imgcolor = wxStaticBoxSizer(box_imgcolorStatic, wxVERTICAL) |
811 |
|
|
# preview box |
812 |
jschuengel |
2274 |
self.previewimgcolor = wxPanel(self, 99, name = 'colorPanel', |
813 |
|
|
style = wxSIMPLE_BORDER|wxCLIP_CHILDREN) |
814 |
jschuengel |
2267 |
color = self.umn_scalebar.get_imagecolor() |
815 |
|
|
self.previewimgcolor.SetBackgroundColour(wxColour(color.get_red(), |
816 |
|
|
color.get_green(), color.get_blue())) |
817 |
|
|
box_imgcolor.Add(self.previewimgcolor, 1, wxGROW | wxALL, 5) |
818 |
|
|
# color change button, opens a new color dialog |
819 |
|
|
button = wxButton(self, ID_IMGCOLOR_CHANGE, _("Change ImageColor")) |
820 |
|
|
button.SetFocus() |
821 |
|
|
EVT_BUTTON(self, ID_IMGCOLOR_CHANGE, self.OnChangeImageColor) |
822 |
|
|
box_imgcolor.Add(button, 1, wxEXPAND|wxALL, 5) |
823 |
|
|
colorHor.Add(box_imgcolor,0, wxEXPAND |wxALL, 5) |
824 |
|
|
|
825 |
|
|
# create the intervals |
826 |
jschuengel |
2274 |
intervalsStatic = wxStaticBox(self, 1010, _("Intervals"), style = 0, |
827 |
|
|
name = "Intervals Box", ) |
828 |
jschuengel |
2267 |
box_intervals = wxStaticBoxSizer(intervalsStatic, wxVERTICAL) |
829 |
|
|
umn_scalebar_intervals = self.umn_scalebar.get_intervals() |
830 |
|
|
self.text_intervals = wxSpinCtrl(self, -1, |
831 |
|
|
value=str(umn_scalebar_intervals), max=100, min=0, |
832 |
|
|
name='intervals', style=wxSP_ARROW_KEYS) |
833 |
|
|
box_intervals.Add(self.text_intervals, 0, wxALIGN_RIGHT | wxALL, 2) |
834 |
|
|
hori2 = wxBoxSizer(wxHORIZONTAL) |
835 |
|
|
hori2.Add(box_intervals,0, wxEXPAND |wxALL, 5) |
836 |
|
|
|
837 |
|
|
#style |
838 |
|
|
umn_scalebar_style= self.umn_scalebar.get_style() |
839 |
|
|
possible_choices = [] |
840 |
|
|
for key in scalebar_style_type: |
841 |
|
|
possible_choices.append(scalebar_style_type[key]) |
842 |
|
|
self.choice_style = wxRadioBox(self, -1, choices=possible_choices, |
843 |
|
|
label='Style', majorDimension=1, |
844 |
|
|
name='style check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS) |
845 |
|
|
self.choice_style.SetSelection(umn_scalebar_style) |
846 |
|
|
hori2.Add(self.choice_style, 1, wxEXPAND|wxALL, 5) |
847 |
|
|
|
848 |
|
|
#create size settings |
849 |
|
|
try: |
850 |
|
|
insidetxt = self.umn_scalebar.get_size() |
851 |
|
|
except: |
852 |
|
|
insidetxt = (0,0) |
853 |
|
|
# create the Size Box |
854 |
jschuengel |
2274 |
staticSize = wxStaticBox(self, -1, _("Size"), style = 0, |
855 |
|
|
name="sizeBox") |
856 |
jschuengel |
2267 |
box_size = wxStaticBoxSizer(staticSize, wxHORIZONTAL) |
857 |
|
|
|
858 |
|
|
box_sizepartWidth = wxBoxSizer(wxHORIZONTAL) |
859 |
|
|
box_sizepartWidth.Add(wxStaticText(self, -1, _("Width: ")), 0, wxALL, 4) |
860 |
|
|
self.text_width = wxTextCtrl(self, -1, str(insidetxt[0])) |
861 |
|
|
box_sizepartWidth.Add(self.text_width, 2, wxALL, 4) |
862 |
|
|
box_size.Add(box_sizepartWidth, 0, wxALIGN_RIGHT | wxALL, 5) |
863 |
|
|
box_sizepartHeight = wxBoxSizer(wxHORIZONTAL) |
864 |
jschuengel |
2274 |
box_sizepartHeight.Add(wxStaticText(self, -1, _("Height: ")), 0, |
865 |
|
|
wxALL, 4) |
866 |
jschuengel |
2267 |
self.text_height = wxTextCtrl(self, -1, str(insidetxt[1])) |
867 |
|
|
box_sizepartHeight.Add(self.text_height, 2, wxALL, 4) |
868 |
|
|
box_size.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 5) |
869 |
|
|
|
870 |
|
|
# status |
871 |
jschuengel |
2274 |
umn_scalebar_status= self.umn_scalebar.get_status(mode="string") |
872 |
jschuengel |
2267 |
possible_choices = [] |
873 |
|
|
for key in legend_status_type: |
874 |
|
|
possible_choices.append(scalebar_status_type[key]) |
875 |
|
|
self.choice_status = wxRadioBox(self, -1, choices=possible_choices, |
876 |
|
|
label='Status', majorDimension=1, |
877 |
|
|
name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS) |
878 |
|
|
self.choice_status.SetStringSelection(umn_scalebar_status) |
879 |
|
|
|
880 |
|
|
# position |
881 |
jschuengel |
2274 |
umn_scalebar_position= self.umn_scalebar.get_position(mode="string") |
882 |
jschuengel |
2267 |
possible_choices = [] |
883 |
|
|
for key in scalebar_position_type: |
884 |
|
|
possible_choices.append(scalebar_position_type[key]) |
885 |
|
|
self.choice_position = wxRadioBox(self, -1, choices=possible_choices, |
886 |
jschuengel |
2274 |
label='Position', majorDimension=1, |
887 |
|
|
name='position check', size=wxDefaultSize, |
888 |
|
|
style=wxRA_SPECIFY_ROWS) |
889 |
jschuengel |
2267 |
self.choice_position.SetStringSelection(umn_scalebar_position) |
890 |
|
|
|
891 |
|
|
#get the set unittype |
892 |
|
|
insideunit = self.umn_scalebar .get_units() |
893 |
|
|
#create the Unittype selector |
894 |
jschuengel |
2274 |
box_unitsStatic = wxStaticBox(self, -1, _("Unit Type"), style = 0, |
895 |
|
|
name = "unittype") |
896 |
jschuengel |
2267 |
box_units = wxStaticBoxSizer(box_unitsStatic, wxVERTICAL) |
897 |
|
|
sam = [] |
898 |
|
|
for key in unit_type: |
899 |
|
|
sam.append(unit_type[key]) |
900 |
|
|
self.choice_units = wxChoice(self, 40, (80, 50), choices = sam) |
901 |
|
|
self.choice_units.SetStringSelection(insideunit) |
902 |
jschuengel |
2271 |
box_units.Add(self.choice_units,0, wxEXPAND, wxALL, 5) |
903 |
jschuengel |
2267 |
|
904 |
jschuengel |
2271 |
# button for label |
905 |
|
|
labelbutton = wxButton(self, ID_LABEL_CHANGE, _("Change Label")) |
906 |
jschuengel |
2267 |
EVT_BUTTON(self, ID_LABEL_CHANGE, self.OnChangeLabel) |
907 |
|
|
|
908 |
|
|
#buttons |
909 |
|
|
box_buttons = wxBoxSizer(wxHORIZONTAL) |
910 |
|
|
button = wxButton(self, wxID_OK, _("OK")) |
911 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
912 |
|
|
button = wxButton(self, wxID_CANCEL, _("Cancel")) |
913 |
|
|
button.SetFocus() |
914 |
|
|
box_buttons.Add(button, 0, wxALL, 5) |
915 |
|
|
#set the button funcitons |
916 |
|
|
EVT_BUTTON(self, wxID_OK, self.OnOK) |
917 |
jschuengel |
2271 |
EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) |
918 |
|
|
|
919 |
|
|
# compose the dialog |
920 |
|
|
top = wxBoxSizer(wxVERTICAL) |
921 |
|
|
top.Add(colorHor,0, wxEXPAND |wxALL, 5) |
922 |
|
|
top.Add(hori2, 1, wxEXPAND|wxALL, 5) |
923 |
|
|
top.Add(box_size, 1, wxEXPAND|wxALL, 5) |
924 |
|
|
top.Add(self.choice_status,0, wxEXPAND |wxALL, 5) |
925 |
|
|
top.Add(self.choice_position,0, wxEXPAND |wxALL, 5) |
926 |
|
|
top.Add(box_units, 1, wxEXPAND|wxALL, 5) |
927 |
|
|
top.Add(labelbutton, 0, wxEXPAND|wxALL, 5) |
928 |
jschuengel |
2267 |
top.Add(box_buttons, 0, wxALIGN_RIGHT) |
929 |
|
|
|
930 |
|
|
# final layout settings |
931 |
|
|
self.SetSizer(top) |
932 |
|
|
top.Fit(self) |
933 |
|
|
|
934 |
|
|
def OnChangeLabel(self, event): |
935 |
|
|
# set the umn_label for scalebar so the Label_Dialog can be used |
936 |
|
|
self.umn_label = self.umn_scalebar.get_label() |
937 |
jschuengel |
2274 |
dialog = Label_Dialog(self, -1, "Scalbar Label Settings", |
938 |
|
|
size=wxSize(350, 200), |
939 |
jschuengel |
2267 |
style = wxDEFAULT_DIALOG_STYLE |
940 |
|
|
) |
941 |
|
|
dialog.CenterOnScreen() |
942 |
|
|
if dialog.ShowModal() == wxID_OK: |
943 |
|
|
return |
944 |
|
|
dialog.Destroy() |
945 |
|
|
|
946 |
|
|
def OnChangeImageColor(self, event): |
947 |
|
|
cur = self.umn_scalebar.get_imagecolor().get_thubancolor() |
948 |
|
|
dialog = ColorDialog(self) |
949 |
|
|
dialog.SetColor(cur) |
950 |
|
|
self.retcolor = None |
951 |
|
|
if dialog.ShowModal() == wxID_OK: |
952 |
|
|
self.retcolor = dialog.GetColor() |
953 |
|
|
dialog.Destroy() |
954 |
|
|
if self.retcolor: |
955 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
956 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
957 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
958 |
jschuengel |
2274 |
self.previewimgcolor.SetBackgroundColour(wxColour(int(self.redcolor), |
959 |
|
|
int(self.greencolor), |
960 |
|
|
int(self.bluecolor))) |
961 |
jschuengel |
2267 |
|
962 |
|
|
def OnChangeColor(self, event): |
963 |
|
|
cur = self.umn_scalebar.get_color().get_thubancolor() |
964 |
|
|
dialog = ColorDialog(self) |
965 |
|
|
dialog.SetColor(cur) |
966 |
|
|
self.retcolor = None |
967 |
|
|
if dialog.ShowModal() == wxID_OK: |
968 |
|
|
self.retcolor = dialog.GetColor() |
969 |
|
|
dialog.Destroy() |
970 |
|
|
if self.retcolor: |
971 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
972 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
973 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
974 |
jschuengel |
2274 |
self.previewcolor.SetBackgroundColour(wxColour(int(self.redcolor), |
975 |
|
|
int(self.greencolor), |
976 |
|
|
int(self.bluecolor))) |
977 |
jschuengel |
2267 |
|
978 |
|
|
def RunDialog(self): |
979 |
|
|
self.ShowModal() |
980 |
|
|
self.Destroy() |
981 |
|
|
|
982 |
|
|
def end_dialog(self, result): |
983 |
|
|
self.result = result |
984 |
|
|
if self.result is not None: |
985 |
|
|
self.EndModal(wxID_OK) |
986 |
|
|
else: |
987 |
|
|
self.EndModal(wxID_CANCEL) |
988 |
|
|
self.Show(False) |
989 |
|
|
|
990 |
|
|
def OnOK(self, event): |
991 |
|
|
self.umn_scalebar.set_status(self.choice_status.GetStringSelection()) |
992 |
|
|
self.umn_scalebar.set_units(self.choice_units.GetStringSelection()) |
993 |
|
|
self.umn_scalebar.set_intervals(self.text_intervals.GetValue()) |
994 |
|
|
self.umn_scalebar.set_style(self.choice_style.GetSelection()) |
995 |
|
|
self.umn_scalebar.set_position(self.choice_position.GetStringSelection()) |
996 |
jschuengel |
2274 |
self.umn_scalebar.set_size(int(self.text_width.GetValue()), |
997 |
|
|
int(self.text_height.GetValue())) |
998 |
jschuengel |
2267 |
|
999 |
|
|
previewcolor = self.previewcolor.GetBackgroundColour() |
1000 |
|
|
self.umn_scalebar.get_color().set_rgbcolor(previewcolor.Red(), |
1001 |
|
|
previewcolor.Green(), previewcolor.Blue()) |
1002 |
|
|
previewimgcolor = self.previewimgcolor.GetBackgroundColour() |
1003 |
|
|
self.umn_scalebar.get_imagecolor().set_rgbcolor(previewimgcolor.Red(), |
1004 |
|
|
previewimgcolor.Green(), previewimgcolor.Blue()) |
1005 |
|
|
self.result ="OK" |
1006 |
|
|
self.end_dialog(self.result) |
1007 |
|
|
|
1008 |
|
|
def OnCancel(self, event): |
1009 |
|
|
self.end_dialog(None) |
1010 |
|
|
|
1011 |
|
|
|
1012 |
|
|
def scalebarsettings(context): |
1013 |
jschuengel |
2274 |
win = Scalebar_Dialog(context.mainwindow, -1, "Scalebar Settings", |
1014 |
|
|
size=wxSize(350, 200), |
1015 |
|
|
style = wxDEFAULT_DIALOG_STYLE) |
1016 |
jschuengel |
2267 |
win.CenterOnScreen() |
1017 |
|
|
val = win.ShowModal() |
1018 |
|
|
|
1019 |
jschuengel |
2257 |
def mapsettings(context): |
1020 |
jschuengel |
2274 |
win = Map_Dialog(context.mainwindow, -1, "Map Settings", |
1021 |
|
|
size=wxSize(350, 200), |
1022 |
|
|
style = wxDEFAULT_DIALOG_STYLE) |
1023 |
jschuengel |
2257 |
win.CenterOnScreen() |
1024 |
|
|
val = win.ShowModal() |
1025 |
|
|
|
1026 |
jschuengel |
2271 |
def outputformatsettings(context): |
1027 |
|
|
win = OutputFormat_Dialog(context.mainwindow, -1, "OutputFormat Settings", |
1028 |
jschuengel |
2274 |
size=wxSize(350, 200), |
1029 |
|
|
style = wxDEFAULT_DIALOG_STYLE) |
1030 |
jschuengel |
2271 |
win.CenterOnScreen() |
1031 |
|
|
val = win.ShowModal() |
1032 |
|
|
|
1033 |
jschuengel |
2257 |
def websettings(context): |
1034 |
jschuengel |
2274 |
win = Web_Dialog(context.mainwindow, -1, "Web Settings", |
1035 |
|
|
size=wxSize(350, 200), |
1036 |
|
|
style = wxDEFAULT_DIALOG_STYLE) |
1037 |
jschuengel |
2257 |
win.CenterOnScreen() |
1038 |
|
|
val = win.ShowModal() |
1039 |
|
|
|
1040 |
|
|
def legendsettings(context): |
1041 |
jschuengel |
2274 |
win = Legend_Dialog(context.mainwindow, -1, "Legend Settings", |
1042 |
|
|
size=wxSize(350, 200), |
1043 |
|
|
style = wxDEFAULT_DIALOG_STYLE) |
1044 |
jschuengel |
2257 |
win.CenterOnScreen() |
1045 |
|
|
val = win.ShowModal() |
1046 |
|
|
|
1047 |
|
|
#create a new mapfile |
1048 |
|
|
def create_new_mapfile(context): |
1049 |
|
|
theMap = MF_Map(mapObj("")) |
1050 |
|
|
context.mainwindow.canvas.Map().extension_umn_mapobj = theMap |
1051 |
|
|
|
1052 |
|
|
# ################################### |
1053 |
|
|
# |
1054 |
|
|
# Hook in MapServer Extension into Thuban |
1055 |
|
|
# |
1056 |
|
|
# ################################### |
1057 |
|
|
|
1058 |
|
|
# find the extensions menu (create it anew if not found) |
1059 |
jschuengel |
2274 |
experimental_menu = main_menu.FindOrInsertMenu("experimental", |
1060 |
|
|
_("Experimenta&l")) |
1061 |
jschuengel |
2257 |
# find the extension menu and add a new submenu if found |
1062 |
jschuengel |
2274 |
mapserver_menu = experimental_menu.FindOrInsertMenu("mapserver", |
1063 |
|
|
_("&MapServer")) |
1064 |
jschuengel |
2257 |
|
1065 |
|
|
|
1066 |
|
|
# register the new command |
1067 |
|
|
registry.Add(Command("create_new_mapfile", _("Create an empty MapObj"), \ |
1068 |
jschuengel |
2274 |
create_new_mapfile, |
1069 |
|
|
helptext = _("Create a new empty mapscript MapObj"))) |
1070 |
jschuengel |
2257 |
# finally add the new entry to the extensions menu |
1071 |
|
|
mapserver_menu.InsertItem("create_new_mapfile") |
1072 |
|
|
|
1073 |
|
|
|
1074 |
|
|
# register the new command (Map Settings Dialog) |
1075 |
|
|
registry.Add(Command("Map Settings", _("Map Settings"), mapsettings, |
1076 |
|
|
helptext = _("Edit the Map Setting"))) |
1077 |
|
|
# finally add the new entry to the extensions menu |
1078 |
|
|
mapserver_menu.InsertItem("Map Settings") |
1079 |
|
|
|
1080 |
jschuengel |
2271 |
# register the new command (OutputFormat Settings Dialog) |
1081 |
|
|
registry.Add(Command("OutputFormat Settings", _("OutputFormat Settings"), |
1082 |
|
|
outputformatsettings, |
1083 |
|
|
helptext = _("Edit the OutputFormat Setting"))) |
1084 |
|
|
# finally add the new entry to the extensions menu |
1085 |
|
|
mapserver_menu.InsertItem("OutputFormat Settings") |
1086 |
|
|
|
1087 |
jschuengel |
2257 |
# register the new command (Map Settings Dialog) |
1088 |
jschuengel |
2274 |
registry.Add(Command("Web Settings", _("Web Settings"), |
1089 |
|
|
websettings, |
1090 |
jschuengel |
2257 |
helptext = _("Edit the Web Setting"))) |
1091 |
|
|
# finally add the new entry to the extensions menu |
1092 |
|
|
mapserver_menu.InsertItem("Web Settings") |
1093 |
|
|
|
1094 |
|
|
# register the new command (Legend Settings Dialog) |
1095 |
jschuengel |
2274 |
registry.Add(Command("Legend Settings", _("Legend Settings"), |
1096 |
|
|
legendsettings, |
1097 |
jschuengel |
2257 |
helptext = _("Edit the Legend Setting"))) |
1098 |
|
|
# finally add the new entry to the extensions menu |
1099 |
|
|
mapserver_menu.InsertItem("Legend Settings") |
1100 |
|
|
|
1101 |
jschuengel |
2267 |
# register the new command (Scalebar Settings Dialog) |
1102 |
jschuengel |
2274 |
registry.Add(Command("Scalebar Settings", _("Scalebar Settings"), |
1103 |
|
|
scalebarsettings, |
1104 |
jschuengel |
2267 |
helptext = _("Edit the Scalebar Setting"))) |
1105 |
|
|
# finally add the new entry to the extensions menu |
1106 |
|
|
mapserver_menu.InsertItem("Scalebar Settings") |
1107 |
jschuengel |
2257 |
|
1108 |
jschuengel |
2267 |
|