296 |
result = wxID_NO |
result = wxID_NO |
297 |
return result |
return result |
298 |
|
|
299 |
|
def prepare_new_session(self): |
300 |
|
for d in self.dialogs.values(): |
301 |
|
if not isinstance(d, tree.SessionTreeView): |
302 |
|
d.Close() |
303 |
|
|
304 |
def NewSession(self): |
def NewSession(self): |
305 |
self.save_modified_session() |
self.save_modified_session() |
306 |
|
self.prepare_new_session() |
307 |
self.application.SetSession(create_empty_session()) |
self.application.SetSession(create_empty_session()) |
308 |
|
|
309 |
def OpenSession(self): |
def OpenSession(self): |
310 |
self.save_modified_session() |
self.save_modified_session() |
311 |
dlg = wxFileDialog(self, _("Select a session file"), ".", "", |
dlg = wxFileDialog(self, _("Open Session"), ".", "", "*.thuban", wxOPEN) |
|
"*.thuban", wxOPEN) |
|
312 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
313 |
|
self.prepare_new_session() |
314 |
self.application.OpenSession(dlg.GetPath()) |
self.application.OpenSession(dlg.GetPath()) |
315 |
dlg.Destroy() |
dlg.Destroy() |
316 |
|
|
317 |
def SaveSession(self): |
def SaveSession(self): |
318 |
if self.application.session.filename == None: |
if self.application.session.filename == None: |
319 |
self.SaveSessionAs() |
self.SaveSessionAs() |
320 |
self.application.SaveSession() |
else: |
321 |
|
self.application.SaveSession() |
322 |
|
|
323 |
def SaveSessionAs(self): |
def SaveSessionAs(self): |
324 |
dlg = wxFileDialog(self, _("Enter a filename for session"), ".", "", |
dlg = wxFileDialog(self, _("Save Session As"), ".", "", |
325 |
"*.thuban", wxOPEN) |
"*.thuban", wxOPEN) |
326 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
327 |
self.application.session.SetFilename(dlg.GetPath()) |
self.application.session.SetFilename(dlg.GetPath()) |
355 |
if dialog is None: |
if dialog is None: |
356 |
dialog = tree.SessionTreeView(self, self.application, name) |
dialog = tree.SessionTreeView(self, self.application, name) |
357 |
self.add_dialog(name, dialog) |
self.add_dialog(name, dialog) |
358 |
dialog.Show(true) |
dialog.Show(True) |
359 |
else: |
else: |
360 |
# FIXME: bring dialog to front here |
# FIXME: bring dialog to front here |
361 |
pass |
pass |
450 |
if layer is not None: |
if layer is not None: |
451 |
color = self.choose_color() |
color = self.choose_color() |
452 |
if color is not None: |
if color is not None: |
453 |
layer.SetFill(color) |
layer.GetClassification().SetDefaultFill(color) |
454 |
|
|
455 |
def LayerTransparentFill(self): |
def LayerTransparentFill(self): |
456 |
layer = self.current_layer() |
layer = self.current_layer() |
457 |
if layer is not None: |
if layer is not None: |
458 |
layer.SetFill(None) |
layer.GetClassification().SetDefaultFill(Color.None) |
459 |
|
|
460 |
def LayerOutlineColor(self): |
def LayerOutlineColor(self): |
461 |
layer = self.current_layer() |
layer = self.current_layer() |
462 |
if layer is not None: |
if layer is not None: |
463 |
color = self.choose_color() |
color = self.choose_color() |
464 |
if color is not None: |
if color is not None: |
465 |
layer.SetStroke(color) |
layer.GetClassification().SetDefaultLineColor(color) |
466 |
|
|
467 |
def LayerNoOutline(self): |
def LayerNoOutline(self): |
468 |
layer = self.current_layer() |
layer = self.current_layer() |
469 |
if layer is not None: |
if layer is not None: |
470 |
layer.SetStroke(None) |
layer.GetClassification().SetDefaultLineColor(Color.None) |
471 |
|
|
472 |
def HideLayer(self): |
def HideLayer(self): |
473 |
layer = self.current_layer() |
layer = self.current_layer() |
513 |
proj4Dlg.Destroy() |
proj4Dlg.Destroy() |
514 |
|
|
515 |
def Classify(self): |
def Classify(self): |
516 |
classifyDlg = classifier.Classifier(NULL, self.current_layer()) |
|
517 |
|
# |
518 |
classifyDlg.ShowModal() |
# the menu option for this should only be available if there |
519 |
classifyDlg.Destroy() |
# is a current layer, so we don't need to check if the |
520 |
|
# current layer is None |
521 |
|
# |
522 |
|
|
523 |
|
layer = self.current_layer() |
524 |
|
name = "classifier" + str(id(layer)) |
525 |
|
dialog = self.get_open_dialog(name) |
526 |
|
|
527 |
|
if dialog is None: |
528 |
|
dialog = classifier.Classifier(self, self.interactor, |
529 |
|
name, self.current_layer()) |
530 |
|
self.add_dialog(name, dialog) |
531 |
|
dialog.Show() |
532 |
|
|
533 |
def ZoomInTool(self): |
def ZoomInTool(self): |
534 |
self.canvas.ZoomInTool() |
self.canvas.ZoomInTool() |