40 |
|
|
41 |
from Thuban.UI.dock import DockableWindow, DockFrame, DockPanel |
from Thuban.UI.dock import DockableWindow, DockFrame, DockPanel |
42 |
|
|
43 |
|
import resource |
44 |
|
|
45 |
|
|
46 |
# the directory where the toolbar icons are stored |
# the directory where the toolbar icons are stored |
47 |
bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps") |
bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps") |
245 |
command = registry.Command(name) |
command = registry.Command(name) |
246 |
if command is not None: |
if command is not None: |
247 |
ID = self.get_id(name) |
ID = self.get_id(name) |
248 |
filename = os.path.join(bitmapdir, command.Icon()) + bitmapext |
bitmap = resource.GetBitmapResource(command.Icon(), |
249 |
bitmap = wxBitmap(filename, wxBITMAP_TYPE_XPM) |
wxBITMAP_TYPE_XPM) |
250 |
toolbar.AddTool(ID, bitmap, |
toolbar.AddTool(ID, bitmap, |
251 |
shortHelpString = command.HelpText(), |
shortHelpString = command.HelpText(), |
252 |
isToggle = command.IsCheckCommand()) |
isToggle = command.IsCheckCommand()) |
405 |
|
|
406 |
def SetMap(self, map): |
def SetMap(self, map): |
407 |
self.canvas.SetMap(map) |
self.canvas.SetMap(map) |
408 |
self.SetTitle("Thuban - " + map.Title()) |
self.__SetTitle(map.Title()) |
409 |
#self.legendPanel.SetMap(map) |
#self.legendPanel.SetMap(map) |
410 |
|
|
411 |
def Map(self): |
def Map(self): |
630 |
def PrintMap(self): |
def PrintMap(self): |
631 |
self.canvas.Print() |
self.canvas.Print() |
632 |
|
|
633 |
|
def RenameMap(self): |
634 |
|
dlg = wxTextEntryDialog(self, "Map Title: ", "Rename Map", |
635 |
|
self.Map().Title()) |
636 |
|
if dlg.ShowModal() == wxID_OK: |
637 |
|
title = dlg.GetValue() |
638 |
|
if title != "": |
639 |
|
self.Map().SetTitle(title) |
640 |
|
self.__SetTitle(title) |
641 |
|
|
642 |
|
dlg.Destroy() |
643 |
|
|
644 |
def identify_view_on_demand(self, layer, shapes): |
def identify_view_on_demand(self, layer, shapes): |
645 |
name = "identify_view" |
name = "identify_view" |
646 |
if self.canvas.CurrentTool() == "IdentifyTool": |
if self.canvas.CurrentTool() == "IdentifyTool": |
652 |
# FIXME: bring dialog to front? |
# FIXME: bring dialog to front? |
653 |
pass |
pass |
654 |
|
|
655 |
|
def __SetTitle(self, title): |
656 |
|
self.SetTitle("Thuban - " + title) |
657 |
|
|
658 |
# |
# |
659 |
# Define all the commands available in the main window |
# Define all the commands available in the main window |
660 |
# |
# |
757 |
sensitive = _has_visible_map) |
sensitive = _has_visible_map) |
758 |
_method_command("map_print", _("Prin&t"), "PrintMap", |
_method_command("map_print", _("Prin&t"), "PrintMap", |
759 |
helptext = _("Print the map")) |
helptext = _("Print the map")) |
760 |
|
_method_command("map_rename", _("&Rename"), "RenameMap", |
761 |
|
helptext = _("Rename the map")) |
762 |
|
|
763 |
# Layer menu |
# Layer menu |
764 |
_method_command("layer_add", _("&Add Layer"), "AddLayer", |
_method_command("layer_add", _("&Add Layer"), "AddLayer", |
803 |
None, |
None, |
804 |
"toggle_legend", |
"toggle_legend", |
805 |
None, |
None, |
806 |
"map_print"]), |
"map_print", |
807 |
|
None, |
808 |
|
"map_rename"]), |
809 |
Menu("layer", _("&Layer"), |
Menu("layer", _("&Layer"), |
810 |
["layer_raise", "layer_lower", |
["layer_raise", "layer_lower", |
811 |
None, |
None, |