1 |
# Copyright (C) 2001 by Intevation GmbH |
# Copyright (C) 2001, 2002 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Jan-Oliver Wagner <[email protected]> |
# Jan-Oliver Wagner <[email protected]> |
4 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> |
12 |
|
|
13 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
14 |
|
|
15 |
import sys, os |
import os |
16 |
|
|
17 |
from wxPython.wx import * |
from wxPython.wx import * |
18 |
|
|
19 |
import Thuban |
import Thuban |
20 |
from Thuban.Model.session import Session |
from Thuban.Model.session import create_empty_session |
|
from Thuban.Model.map import Map |
|
21 |
from Thuban.Model.layer import Layer |
from Thuban.Model.layer import Layer |
22 |
from Thuban.Model.color import Color |
from Thuban.Model.color import Color |
23 |
from Thuban.Model.proj import Projection |
from Thuban.Model.proj import Projection |
26 |
import tree |
import tree |
27 |
import proj4dialog |
import proj4dialog |
28 |
import tableview, identifyview |
import tableview, identifyview |
29 |
|
from menu import Menu |
30 |
|
|
31 |
import main |
import main |
32 |
from command import registry, Command |
from command import registry, Command |
33 |
|
from messages import SELECTED_SHAPE, VIEW_POSITION |
34 |
|
|
35 |
|
|
36 |
# the directory where the toolbar icons are stored |
# the directory where the toolbar icons are stored |
40 |
|
|
41 |
class MainWindow(wxFrame): |
class MainWindow(wxFrame): |
42 |
|
|
43 |
def __init__(self, parent, ID): |
def __init__(self, parent, ID, interactor): |
44 |
wxFrame.__init__(self, parent, ID, 'Thuban', |
wxFrame.__init__(self, parent, ID, 'Thuban', |
45 |
wxDefaultPosition, wxSize(400, 300)) |
wxDefaultPosition, wxSize(400, 300)) |
46 |
|
|
47 |
|
self.interactor = interactor |
48 |
|
|
49 |
self.CreateStatusBar() |
self.CreateStatusBar() |
50 |
self.SetStatusText("This is the wxPython-based " |
self.SetStatusText("This is the wxPython-based " |
51 |
"Graphical User Interface for exploring geographic data") |
"Graphical User Interface for exploring geographic data") |
54 |
|
|
55 |
self.init_ids() |
self.init_ids() |
56 |
|
|
57 |
menuBar = wxMenuBar() |
# creat the menubar from the main_menu description |
58 |
|
self.SetMenuBar(self.build_menu_bar(main_menu)) |
|
menu = wxMenu() |
|
|
menuBar.Append(menu, "&File"); |
|
|
for name in ["new_session", "open_session", None, |
|
|
"save_session", "save_session_as", None, |
|
|
"exit"]: |
|
|
self.add_menu_command(menu, name) |
|
|
|
|
|
menu = wxMenu() |
|
|
menuBar.Append(menu, "&Map"); |
|
|
for name in ["map_projection", |
|
|
None, |
|
|
"map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool", |
|
|
"map_identify_tool", "map_label_tool", |
|
|
None, |
|
|
"map_full_extent", |
|
|
None, |
|
|
"map_print"]: |
|
|
self.add_menu_command(menu, name) |
|
|
|
|
|
menu = wxMenu() |
|
|
menuBar.Append(menu, "&Layer"); |
|
|
for name in ["layer_add", "layer_remove", |
|
|
None, |
|
|
"layer_fill_color", "layer_transparent_fill", |
|
|
"layer_ourline_color", "layer_no_outline", |
|
|
None, |
|
|
"layer_raise", "layer_lower", |
|
|
None, |
|
|
"layer_show", "layer_hide", |
|
|
None, |
|
|
"layer_show_table"]: |
|
|
self.add_menu_command(menu, name) |
|
|
|
|
|
menu = wxMenu() |
|
|
menuBar.Append(menu, "&Help"); |
|
|
self.add_menu_command(menu, "help_about") |
|
|
|
|
|
self.SetMenuBar(menuBar) |
|
59 |
|
|
60 |
# toolbar |
# Similarly, create the toolbar from main_toolbar |
61 |
toolbar = self.CreateToolBar(wxTB_3DBUTTONS) |
toolbar = self.build_toolbar(main_toolbar) |
|
for name in ["map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool", |
|
|
"map_identify_tool", "map_label_tool"]: |
|
|
self.add_toolbar_command(toolbar, name) |
|
62 |
# call Realize to make sure that the tools appear. |
# call Realize to make sure that the tools appear. |
63 |
toolbar.Realize() |
toolbar.Realize() |
64 |
|
|
65 |
# Create the map canvas |
# Create the map canvas |
66 |
canvas = view.MapCanvas(self, -1) |
canvas = view.MapCanvas(self, -1, interactor) |
67 |
|
canvas.Subscribe(VIEW_POSITION, self.view_position_changed) |
68 |
self.canvas = canvas |
self.canvas = canvas |
69 |
|
|
70 |
|
self.init_dialogs() |
71 |
|
|
72 |
|
interactor.Subscribe(SELECTED_SHAPE, self.identify_view_on_demand) |
73 |
|
|
74 |
EVT_CLOSE(self, self.OnClose) |
EVT_CLOSE(self, self.OnClose) |
75 |
|
|
76 |
def init_ids(self): |
def init_ids(self): |
90 |
self.name_to_id[name] = ID |
self.name_to_id[name] = ID |
91 |
self.id_to_name[ID] = name |
self.id_to_name[ID] = name |
92 |
return ID |
return ID |
93 |
|
|
94 |
|
def build_menu_bar(self, menudesc): |
95 |
|
"""Build and return the menu bar from the menu description""" |
96 |
|
menu_bar = wxMenuBar() |
97 |
|
|
98 |
|
for item in menudesc.items: |
99 |
|
# here the items must all be Menu instances themselves |
100 |
|
menu_bar.Append(self.build_menu(item), item.title) |
101 |
|
|
102 |
|
return menu_bar |
103 |
|
|
104 |
|
def build_menu(self, menudesc): |
105 |
|
"""Build and return a wxMenu from a menudescription""" |
106 |
|
wxmenu = wxMenu() |
107 |
|
last = None |
108 |
|
for item in menudesc.items: |
109 |
|
# here the items must all be Menu instances themselves |
110 |
|
if item is None: |
111 |
|
# a separator. Only add one if the last item was not a |
112 |
|
# separator |
113 |
|
if last is not None: |
114 |
|
wxmenu.AppendSeparator() |
115 |
|
elif isinstance(item, Menu): |
116 |
|
# a submenu |
117 |
|
wxmenu.AppendMenu(wxNewId(), item.title, self.build_menu(item)) |
118 |
|
else: |
119 |
|
# must the name the name of a command |
120 |
|
self.add_menu_command(wxmenu, item) |
121 |
|
last = item |
122 |
|
return wxmenu |
123 |
|
|
124 |
|
def build_toolbar(self, toolbardesc): |
125 |
|
"""Build and return the main toolbar window from a toolbar description |
126 |
|
|
127 |
|
The parameter should be an instance of the Menu class but it |
128 |
|
should not contain submenus. |
129 |
|
""" |
130 |
|
toolbar = self.CreateToolBar(wxTB_3DBUTTONS) |
131 |
|
|
132 |
|
# set the size of the tools' bitmaps. Not needed on wxGTK, but |
133 |
|
# on Windows, although it doesn't work very well there. It seems |
134 |
|
# that only 16x16 icons are really supported on windows. |
135 |
|
# We probably shouldn't hardwire the bitmap size here. |
136 |
|
toolbar.SetToolBitmapSize(wxSize(24, 24)) |
137 |
|
|
138 |
|
for item in toolbardesc.items: |
139 |
|
if item is None: |
140 |
|
toolbar.AddSeparator() |
141 |
|
else: |
142 |
|
# assume it's a string. |
143 |
|
self.add_toolbar_command(toolbar, item) |
144 |
|
|
145 |
|
return toolbar |
146 |
|
|
147 |
def add_menu_command(self, menu, name): |
def add_menu_command(self, menu, name): |
148 |
"""Add the command with name name to the menu menu. |
"""Add the command with name name to the menu menu. |
149 |
|
|
201 |
if command.IsCheckCommand(): |
if command.IsCheckCommand(): |
202 |
event.Check(command.Checked(self)) |
event.Check(command.Checked(self)) |
203 |
|
|
204 |
|
def RunMessageBox(self, title, text, flags = wxOK | wxICON_INFORMATION): |
205 |
|
"""Run a modal message box with the given text, title and flags |
206 |
|
and return the result""" |
207 |
|
dlg = wxMessageDialog(self, text, title, flags) |
208 |
|
result = dlg.ShowModal() |
209 |
|
dlg.Destroy() |
210 |
|
return result |
211 |
|
|
212 |
|
def init_dialogs(self): |
213 |
|
"""Initialize the dialog handling""" |
214 |
|
# The mainwindow maintains a dict mapping names to open |
215 |
|
# non-modal dialogs. The dialogs are put into this dict when |
216 |
|
# they're created and removed when they're closed |
217 |
|
self.dialogs = {} |
218 |
|
|
219 |
|
def add_dialog(self, name, dialog): |
220 |
|
if self.dialogs.has_key(name): |
221 |
|
raise RuntimeError("The Dialog named %s is already open" % name) |
222 |
|
self.dialogs[name] = dialog |
223 |
|
|
224 |
|
def dialog_open(self, name): |
225 |
|
return self.dialogs.has_key(name) |
226 |
|
|
227 |
|
def remove_dialog(self, name): |
228 |
|
del self.dialogs[name] |
229 |
|
|
230 |
|
def get_open_dialog(self, name): |
231 |
|
return self.dialogs.get(name) |
232 |
|
|
233 |
|
def view_position_changed(self): |
234 |
|
pos = self.canvas.CurrentPosition() |
235 |
|
if pos is not None: |
236 |
|
text = "(%10.10g, %10.10g)" % pos |
237 |
|
else: |
238 |
|
text = "" |
239 |
|
self.SetStatusText(text) |
240 |
|
|
241 |
|
def save_modified_session(self, can_veto = 1): |
242 |
|
"""If the current session has been modified, ask the user |
243 |
|
whether to save it and do so if requested. Return the outcome of |
244 |
|
the dialog (either wxID_OK, wxID_CANCEL or wxID_NO). If the |
245 |
|
dialog wasn't run return wxID_NO. |
246 |
|
|
247 |
|
If the can_veto parameter is true (default) the dialog includes |
248 |
|
a cancel button, otherwise not. |
249 |
|
""" |
250 |
|
if main.app.session.WasModified(): |
251 |
|
flags = wxYES_NO | wxICON_QUESTION |
252 |
|
if can_veto: |
253 |
|
flags = flags | wxCANCEL |
254 |
|
result = self.RunMessageBox("Exit", |
255 |
|
("The session has been modified." |
256 |
|
" Do you want to save it?"), |
257 |
|
flags) |
258 |
|
if result == wxID_YES: |
259 |
|
self.SaveSession() |
260 |
|
else: |
261 |
|
result = wxID_NO |
262 |
|
return result |
263 |
|
|
264 |
def NewSession(self): |
def NewSession(self): |
265 |
session = Session("") |
self.save_modified_session() |
266 |
session.AddMap(Map("")) |
main.app.SetSession(create_empty_session()) |
|
main.app.SetSession(session) |
|
267 |
|
|
268 |
def OpenSession(self): |
def OpenSession(self): |
269 |
|
self.save_modified_session() |
270 |
dlg = wxFileDialog(self, "Select a session file", ".", "", |
dlg = wxFileDialog(self, "Select a session file", ".", "", |
271 |
"*.session", wxOPEN) |
"*.thuban", wxOPEN) |
272 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
273 |
main.app.OpenSession(dlg.GetPath()) |
main.app.OpenSession(dlg.GetPath()) |
274 |
dlg.Destroy() |
dlg.Destroy() |
275 |
|
|
276 |
def SaveSession(self): |
def SaveSession(self): |
277 |
|
if main.app.session.filename == None: |
278 |
|
self.SaveSessionAs() |
279 |
main.app.SaveSession() |
main.app.SaveSession() |
280 |
|
|
281 |
def SaveSessionAs(self): |
def SaveSessionAs(self): |
282 |
dlg = wxFileDialog(self, "Enter a filename for session", ".", "", |
dlg = wxFileDialog(self, "Enter a filename for session", ".", "", |
283 |
"*.session", wxOPEN) |
"*.thuban", wxOPEN) |
284 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
285 |
main.app.session.SetFilename(dlg.GetPath()) |
main.app.session.SetFilename(dlg.GetPath()) |
286 |
main.app.SaveSession() |
main.app.SaveSession() |
290 |
self.Close(false) |
self.Close(false) |
291 |
|
|
292 |
def OnClose(self, event): |
def OnClose(self, event): |
293 |
veto = 0 |
result = self.save_modified_session(can_veto = event.CanVeto()) |
294 |
if main.app.session.WasModified(): |
if result == wxID_CANCEL: |
|
flags = wxYES_NO | wxICON_QUESTION |
|
|
if event.CanVeto(): |
|
|
flags = flags | wxCANCEL |
|
|
dlg = wxMessageDialog(self, |
|
|
("The session has been modified." |
|
|
" Do you want to save it?"), |
|
|
"Exit", flags) |
|
|
result = dlg.ShowModal() |
|
|
dlg.Destroy() |
|
|
if result == wxID_YES: |
|
|
self.SaveSession() |
|
|
elif result == wxID_CANCEL: |
|
|
veto = 1 |
|
|
|
|
|
if veto: |
|
295 |
event.Veto() |
event.Veto() |
296 |
else: |
else: |
297 |
self.Destroy() |
self.Destroy() |
299 |
def SetMap(self, map): |
def SetMap(self, map): |
300 |
self.canvas.SetMap(map) |
self.canvas.SetMap(map) |
301 |
|
|
302 |
|
def ShowSessionTree(self): |
303 |
|
name = "session_tree" |
304 |
|
dialog = self.get_open_dialog(name) |
305 |
|
if dialog is None: |
306 |
|
dialog = tree.SessionTreeView(self, main.app, name) |
307 |
|
self.add_dialog(name, dialog) |
308 |
|
dialog.Show(true) |
309 |
|
else: |
310 |
|
# FIXME: bring dialog to front here |
311 |
|
pass |
312 |
|
|
313 |
def About(self): |
def About(self): |
314 |
dlg = wxMessageDialog(self, |
self.RunMessageBox("About", |
315 |
("Thuban is a program for\n" |
("Thuban is a program for\n" |
316 |
"exploring geographic data.\n" |
"exploring geographic data.\n" |
317 |
"Copyright (C) 2001 Intevation GmbH.\n" |
"Copyright (C) 2001 Intevation GmbH.\n" |
318 |
"Thuban is licensed under the GPL"), |
"Thuban is licensed under the GPL"), |
319 |
"About", wxOK | wxICON_INFORMATION) |
wxOK | wxICON_INFORMATION) |
|
dlg.ShowModal() |
|
|
dlg.Destroy() |
|
320 |
|
|
321 |
def AddLayer(self): |
def AddLayer(self): |
322 |
dlg = wxFileDialog(self, "Select a session file", ".", "", "*.*", |
dlg = wxFileDialog(self, "Select a data file", ".", "", "*.*", |
323 |
wxOPEN) |
wxOPEN) |
324 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
325 |
filename = dlg.GetPath() |
filename = dlg.GetPath() |
327 |
layer = Layer(title, filename) |
layer = Layer(title, filename) |
328 |
map = self.canvas.Map() |
map = self.canvas.Map() |
329 |
has_layers = map.HasLayers() |
has_layers = map.HasLayers() |
330 |
map.AddLayer(layer) |
try: |
331 |
if not has_layers: |
map.AddLayer(layer) |
332 |
# if we're adding a layer to an empty map, for the new |
except IOError: |
333 |
# map to the window |
# the layer couldn't be opened |
334 |
self.canvas.FitMapToWindow() |
self.RunMessageBox("Add Layer", |
335 |
|
"Can't open the file '%s'." % filename) |
336 |
|
else: |
337 |
|
if not has_layers: |
338 |
|
# if we're adding a layer to an empty map, for the |
339 |
|
# new map to the window |
340 |
|
self.canvas.FitMapToWindow() |
341 |
dlg.Destroy() |
dlg.Destroy() |
342 |
|
|
343 |
def RemoveLayer(self): |
def RemoveLayer(self): |
344 |
layer = self.current_layer() |
layer = self.current_layer() |
345 |
if layer is not None: |
if layer is not None: |
346 |
self.canvas.Map().RemoveLayer(layer) |
self.canvas.Map().RemoveLayer(layer) |
|
else: |
|
|
dlg = wxMessageDialog(self, "No layer is selected.\n", |
|
|
"Remove layer", wxOK | wxICON_INFORMATION) |
|
|
dlg.ShowModal() |
|
|
dlg.Destroy() |
|
347 |
|
|
348 |
def RaiseLayer(self): |
def RaiseLayer(self): |
349 |
layer = self.current_layer() |
layer = self.current_layer() |
360 |
|
|
361 |
If no layer is selected, return None |
If no layer is selected, return None |
362 |
""" |
""" |
363 |
tree = main.app.tree.tree |
return self.interactor.SelectedLayer() |
|
layer = tree.GetPyData(tree.GetSelection()) |
|
|
if isinstance(layer, Layer): |
|
|
return layer |
|
|
return None |
|
364 |
|
|
365 |
def has_selected_layer(self): |
def has_selected_layer(self): |
366 |
"""Return true if a layer is currently selected""" |
"""Return true if a layer is currently selected""" |
367 |
tree = main.app.tree.tree |
return self.interactor.HasSelectedLayer() |
|
layer = tree.GetPyData(tree.GetSelection()) |
|
|
return isinstance(layer, Layer) |
|
368 |
|
|
369 |
def choose_color(self): |
def choose_color(self): |
370 |
"""Run the color selection dialog and return the selected color. |
"""Run the color selection dialog and return the selected color. |
419 |
def LayerShowTable(self): |
def LayerShowTable(self): |
420 |
layer = self.current_layer() |
layer = self.current_layer() |
421 |
if layer is not None: |
if layer is not None: |
422 |
tv = tableview.TableFrame(self, layer.table) |
table = layer.table |
423 |
tv.Show(true) |
name = "table_view" + str(id(table)) |
424 |
|
dialog = self.get_open_dialog(name) |
425 |
|
if dialog is None: |
426 |
|
dialog = tableview.TableFrame(self, self.interactor, name, |
427 |
|
"Table: %s" % layer.Title(), |
428 |
|
layer, table) |
429 |
|
self.add_dialog(name, dialog) |
430 |
|
dialog.Show(true) |
431 |
|
else: |
432 |
|
# FIXME: bring dialog to front here |
433 |
|
pass |
434 |
|
|
435 |
def Projection(self): |
def Projection(self): |
436 |
map = self.canvas.Map() |
map = self.canvas.Map() |
437 |
proj = map.projection |
proj = map.projection |
438 |
if proj is None: |
if proj is None: |
439 |
proj4Dlg = proj4dialog.Proj4Dialog(NULL, None) |
proj4Dlg = proj4dialog.Proj4Dialog(NULL, None, map.BoundingBox()) |
440 |
else: |
else: |
441 |
proj4Dlg = proj4dialog.Proj4Dialog(NULL, map.projection.params) |
proj4Dlg = proj4dialog.Proj4Dialog(NULL, map.projection.params, |
442 |
|
map.BoundingBox()) |
443 |
if proj4Dlg.ShowModal() == wxID_OK: |
if proj4Dlg.ShowModal() == wxID_OK: |
444 |
params = proj4Dlg.GetParams() |
params = proj4Dlg.GetParams() |
445 |
if params is not None: |
if params is not None: |
459 |
self.canvas.PanTool() |
self.canvas.PanTool() |
460 |
|
|
461 |
def IdentifyTool(self): |
def IdentifyTool(self): |
|
if self.identify_view is None: |
|
|
self.identify_view = identifyview.IdentifyView(self, main.app) |
|
|
self.identify_view.Show(true) |
|
462 |
self.canvas.IdentifyTool() |
self.canvas.IdentifyTool() |
463 |
|
self.identify_view_on_demand(None, None) |
464 |
|
|
465 |
def LabelTool(self): |
def LabelTool(self): |
466 |
self.canvas.LabelTool() |
self.canvas.LabelTool() |
471 |
def PrintMap(self): |
def PrintMap(self): |
472 |
self.canvas.Print() |
self.canvas.Print() |
473 |
|
|
474 |
|
def identify_view_on_demand(self, layer, shape): |
475 |
|
name = "identify_view" |
476 |
|
if self.canvas.CurrentTool() == "IdentifyTool": |
477 |
|
if not self.dialog_open(name): |
478 |
|
dialog = identifyview.IdentifyView(self, self.interactor, name) |
479 |
|
self.add_dialog(name, dialog) |
480 |
|
dialog.Show(true) |
481 |
|
else: |
482 |
|
# FIXME: bring dialog to front? |
483 |
|
pass |
484 |
|
|
485 |
# |
# |
486 |
# Define all the commands available in the main window |
# Define all the commands available in the main window |
492 |
"""Call the context's method methodname with args *args""" |
"""Call the context's method methodname with args *args""" |
493 |
apply(getattr(context, methodname), args) |
apply(getattr(context, methodname), args) |
494 |
|
|
495 |
def _method_command(name, title, method, helptext = "", sensitive = None): |
def _method_command(name, title, method, helptext = "", |
496 |
|
icon = "", sensitive = None): |
497 |
"""Add a command implemented by a method of the context object""" |
"""Add a command implemented by a method of the context object""" |
498 |
registry.Add(Command(name, title, call_method, args=(method,), |
registry.Add(Command(name, title, call_method, args=(method,), |
499 |
helptext = helptext, sensitive = sensitive)) |
helptext = helptext, icon = icon, |
500 |
|
sensitive = sensitive)) |
501 |
|
|
502 |
def _tool_command(name, title, method, toolname, helptext = "", |
def _tool_command(name, title, method, toolname, helptext = "", |
503 |
icon = ""): |
icon = ""): |
504 |
"""Add a tool command""" |
"""Add a tool command""" |
517 |
_method_command("open_session", "&Open Session", "OpenSession") |
_method_command("open_session", "&Open Session", "OpenSession") |
518 |
_method_command("save_session", "&Save Session", "SaveSession") |
_method_command("save_session", "&Save Session", "SaveSession") |
519 |
_method_command("save_session_as", "Save Session &As", "SaveSessionAs") |
_method_command("save_session_as", "Save Session &As", "SaveSessionAs") |
520 |
|
_method_command("show_session_tree", "Show Session &Tree", "ShowSessionTree") |
521 |
_method_command("exit", "&Exit", "Exit") |
_method_command("exit", "&Exit", "Exit") |
522 |
|
|
523 |
# Help menu |
# Help menu |
537 |
helptext = "Switch to map-mode 'identify'", icon = "identify") |
helptext = "Switch to map-mode 'identify'", icon = "identify") |
538 |
_tool_command("map_label_tool", "&Label", "LabelTool", "LabelTool", |
_tool_command("map_label_tool", "&Label", "LabelTool", "LabelTool", |
539 |
helptext = "Add/Remove labels", icon = "label") |
helptext = "Add/Remove labels", icon = "label") |
540 |
_method_command("map_full_extent", "&Full extent", "FullExtent") |
_method_command("map_full_extent", "&Full extent", "FullExtent", |
541 |
|
helptext = "Full Extent", icon = "fullextent") |
542 |
_method_command("map_print", "Prin&t", "PrintMap", helptext = "Print the map") |
_method_command("map_print", "Prin&t", "PrintMap", helptext = "Print the map") |
543 |
|
|
544 |
# Layer menu |
# Layer menu |
545 |
_method_command("layer_add", "&Add", "AddLayer", |
_method_command("layer_add", "&Add Layer", "AddLayer", |
546 |
helptext = "Add a new layer to active map") |
helptext = "Add a new layer to active map") |
547 |
_method_command("layer_remove", "&Remove", "RemoveLayer", |
_method_command("layer_remove", "&Remove Layer", "RemoveLayer", |
548 |
helptext = "Remove selected layer(s)", |
helptext = "Remove selected layer(s)", |
549 |
sensitive = _has_selected_layer) |
sensitive = _has_selected_layer) |
550 |
_method_command("layer_fill_color", "&Fill Color", "LayerFillColor", |
_method_command("layer_fill_color", "&Fill Color", "LayerFillColor", |
554 |
"LayerTransparentFill", |
"LayerTransparentFill", |
555 |
helptext = "Do not fill the selected layer(s)", |
helptext = "Do not fill the selected layer(s)", |
556 |
sensitive = _has_selected_layer) |
sensitive = _has_selected_layer) |
557 |
_method_command("layer_ourline_color", "&Outline Color", "LayerOutlineColor", |
_method_command("layer_outline_color", "&Outline Color", "LayerOutlineColor", |
558 |
helptext = "Set the outline color of selected layer(s)", |
helptext = "Set the outline color of selected layer(s)", |
559 |
sensitive = _has_selected_layer) |
sensitive = _has_selected_layer) |
560 |
_method_command("layer_no_outline", "&No Outline", "LayerNoOutline", |
_method_command("layer_no_outline", "&No Outline", "LayerNoOutline", |
575 |
_method_command("layer_show_table", "Show Ta&ble", "LayerShowTable", |
_method_command("layer_show_table", "Show Ta&ble", "LayerShowTable", |
576 |
helptext = "Show the selected layer's table", |
helptext = "Show the selected layer's table", |
577 |
sensitive = _has_selected_layer) |
sensitive = _has_selected_layer) |
578 |
|
|
579 |
|
|
580 |
|
# the menu structure |
581 |
|
main_menu = Menu("<main>", "<main>", |
582 |
|
[Menu("file", "&File", |
583 |
|
["new_session", "open_session", None, |
584 |
|
"save_session", "save_session_as", None, |
585 |
|
"show_session_tree", None, |
586 |
|
"exit"]), |
587 |
|
Menu("map", "&Map", |
588 |
|
["layer_add", "layer_remove", |
589 |
|
None, |
590 |
|
"map_projection", |
591 |
|
None, |
592 |
|
"map_zoom_in_tool", "map_zoom_out_tool", |
593 |
|
"map_pan_tool", "map_identify_tool", "map_label_tool", |
594 |
|
None, |
595 |
|
"map_full_extent", |
596 |
|
None, |
597 |
|
"map_print"]), |
598 |
|
Menu("layer", "&Layer", |
599 |
|
["layer_fill_color", "layer_transparent_fill", |
600 |
|
"layer_outline_color", "layer_no_outline", |
601 |
|
None, |
602 |
|
"layer_raise", "layer_lower", |
603 |
|
None, |
604 |
|
"layer_show", "layer_hide", |
605 |
|
None, |
606 |
|
"layer_show_table"]), |
607 |
|
Menu("help", "&Help", |
608 |
|
["help_about"])]) |
609 |
|
|
610 |
|
# the main toolbar |
611 |
|
|
612 |
|
main_toolbar = Menu("<toolbar>", "<toolbar>", |
613 |
|
["map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool", |
614 |
|
"map_identify_tool", "map_label_tool", "map_full_extent"]) |