404 |
# wx's destroy event, but that isn't implemented for wxGTK |
# wx's destroy event, but that isn't implemented for wxGTK |
405 |
# yet. |
# yet. |
406 |
self.canvas.Unsubscribe(VIEW_POSITION, self.view_position_changed) |
self.canvas.Unsubscribe(VIEW_POSITION, self.view_position_changed) |
407 |
DockFrame._OnClose(self, event) |
DockFrame.OnClose(self, event) |
408 |
self.Destroy() |
self.Destroy() |
409 |
|
|
410 |
def SetMap(self, map): |
def SetMap(self, map): |
459 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
460 |
filename = dlg.GetPath() |
filename = dlg.GetPath() |
461 |
title = os.path.splitext(os.path.basename(filename))[0] |
title = os.path.splitext(os.path.basename(filename))[0] |
|
store = self.application.Session().OpenShapefile(filename) |
|
|
layer = Layer(title, store) |
|
462 |
map = self.canvas.Map() |
map = self.canvas.Map() |
463 |
has_layers = map.HasLayers() |
has_layers = map.HasLayers() |
464 |
try: |
try: |
465 |
map.AddLayer(layer) |
store = self.application.Session().OpenShapefile(filename) |
466 |
except IOError: |
except IOError: |
467 |
# the layer couldn't be opened |
# the layer couldn't be opened |
468 |
self.RunMessageBox(_("Add Layer"), |
self.RunMessageBox(_("Add Layer"), |
469 |
_("Can't open the file '%s'.") % filename) |
_("Can't open the file '%s'.") % filename) |
470 |
else: |
else: |
471 |
|
layer = Layer(title, store) |
472 |
|
map.AddLayer(layer) |
473 |
if not has_layers: |
if not has_layers: |
474 |
# if we're adding a layer to an empty map, fit the |
# if we're adding a layer to an empty map, fit the |
475 |
# new map to the window |
# new map to the window |
482 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
483 |
filename = dlg.GetPath() |
filename = dlg.GetPath() |
484 |
title = os.path.splitext(os.path.basename(filename))[0] |
title = os.path.splitext(os.path.basename(filename))[0] |
|
layer = RasterLayer(title, filename) |
|
485 |
map = self.canvas.Map() |
map = self.canvas.Map() |
486 |
has_layers = map.HasLayers() |
has_layers = map.HasLayers() |
487 |
try: |
try: |
488 |
map.AddLayer(layer) |
layer = RasterLayer(title, filename) |
489 |
except IOError: |
except IOError: |
490 |
# the layer couldn't be opened |
# the layer couldn't be opened |
491 |
self.RunMessageBox(_("Add Image Layer"), |
self.RunMessageBox(_("Add Image Layer"), |
492 |
_("Can't open the file '%s'.") % filename) |
_("Can't open the file '%s'.") % filename) |
493 |
else: |
else: |
494 |
|
map.AddLayer(layer) |
495 |
if not has_layers: |
if not has_layers: |
496 |
# if we're adding a layer to an empty map, fit the |
# if we're adding a layer to an empty map, fit the |
497 |
# new map to the window |
# new map to the window |
668 |
print "TableHide" |
print "TableHide" |
669 |
|
|
670 |
def TableJoin(self): |
def TableJoin(self): |
|
print "TableJoin" |
|
671 |
dlg = JoinDialog(self, _("Join Tables"), self.application.session) |
dlg = JoinDialog(self, _("Join Tables"), self.application.session) |
672 |
if dlg.ShowModal() == wxID_OK: |
dlg.ShowModal() |
|
print "OK" |
|
673 |
|
|
674 |
def ZoomInTool(self): |
def ZoomInTool(self): |
675 |
self.canvas.ZoomInTool() |
self.canvas.ZoomInTool() |