12 |
|
|
13 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
14 |
|
|
15 |
|
__ThubanVersion__ = "0.2" #"$THUBAN_0_2$" |
16 |
|
#__BuildDate__ = "$Date$" |
17 |
|
|
18 |
import os |
import os |
19 |
|
|
20 |
from wxPython.wx import * |
from wxPython.wx import * |
299 |
result = wxID_NO |
result = wxID_NO |
300 |
return result |
return result |
301 |
|
|
302 |
|
def prepare_new_session(self): |
303 |
|
for d in self.dialogs.values(): |
304 |
|
if not isinstance(d, tree.SessionTreeView): |
305 |
|
d.Close() |
306 |
|
|
307 |
def NewSession(self): |
def NewSession(self): |
308 |
self.save_modified_session() |
self.save_modified_session() |
309 |
|
self.prepare_new_session() |
310 |
self.application.SetSession(create_empty_session()) |
self.application.SetSession(create_empty_session()) |
311 |
|
|
312 |
def OpenSession(self): |
def OpenSession(self): |
313 |
self.save_modified_session() |
self.save_modified_session() |
314 |
dlg = wxFileDialog(self, _("Select a session file"), ".", "", |
dlg = wxFileDialog(self, _("Open Session"), ".", "", "*.thuban", wxOPEN) |
|
"*.thuban", wxOPEN) |
|
315 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
316 |
|
self.prepare_new_session() |
317 |
self.application.OpenSession(dlg.GetPath()) |
self.application.OpenSession(dlg.GetPath()) |
318 |
dlg.Destroy() |
dlg.Destroy() |
319 |
|
|
320 |
def SaveSession(self): |
def SaveSession(self): |
321 |
if self.application.session.filename == None: |
if self.application.session.filename == None: |
322 |
self.SaveSessionAs() |
self.SaveSessionAs() |
323 |
self.application.SaveSession() |
else: |
324 |
|
self.application.SaveSession() |
325 |
|
|
326 |
def SaveSessionAs(self): |
def SaveSessionAs(self): |
327 |
dlg = wxFileDialog(self, _("Enter a filename for session"), ".", "", |
dlg = wxFileDialog(self, _("Save Session As"), ".", "", |
328 |
"*.thuban", wxOPEN) |
"*.thuban", wxOPEN) |
329 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
330 |
self.application.session.SetFilename(dlg.GetPath()) |
self.application.session.SetFilename(dlg.GetPath()) |
358 |
if dialog is None: |
if dialog is None: |
359 |
dialog = tree.SessionTreeView(self, self.application, name) |
dialog = tree.SessionTreeView(self, self.application, name) |
360 |
self.add_dialog(name, dialog) |
self.add_dialog(name, dialog) |
361 |
dialog.Show(true) |
dialog.Show(True) |
362 |
else: |
else: |
363 |
# FIXME: bring dialog to front here |
# FIXME: bring dialog to front here |
364 |
pass |
pass |
365 |
|
|
366 |
|
|
367 |
def About(self): |
def About(self): |
368 |
self.RunMessageBox(_("About"), |
self.RunMessageBox(_("About"), |
369 |
_("Thuban is a program for\n" |
_("Thuban v%s\n" |
370 |
|
#"Build Date: %s\n" |
371 |
|
"\n" |
372 |
|
"Thuban is a program for\n" |
373 |
"exploring geographic data.\n" |
"exploring geographic data.\n" |
374 |
"Copyright (C) 2001-2003 Intevation GmbH.\n" |
"Copyright (C) 2001-2003 Intevation GmbH.\n" |
375 |
"Thuban is licensed under the GPL"), |
"Thuban is licensed under the GNU GPL" |
376 |
|
% __ThubanVersion__), #__BuildDate__)), |
377 |
wxOK | wxICON_INFORMATION) |
wxOK | wxICON_INFORMATION) |
378 |
|
|
379 |
def AddLayer(self): |
def AddLayer(self): |
458 |
if layer is not None: |
if layer is not None: |
459 |
color = self.choose_color() |
color = self.choose_color() |
460 |
if color is not None: |
if color is not None: |
461 |
layer.SetFill(color) |
layer.GetClassification().SetDefaultFill(color) |
462 |
|
|
463 |
def LayerTransparentFill(self): |
def LayerTransparentFill(self): |
464 |
layer = self.current_layer() |
layer = self.current_layer() |
465 |
if layer is not None: |
if layer is not None: |
466 |
layer.SetFill(None) |
layer.GetClassification().SetDefaultFill(Color.None) |
467 |
|
|
468 |
def LayerOutlineColor(self): |
def LayerOutlineColor(self): |
469 |
layer = self.current_layer() |
layer = self.current_layer() |
470 |
if layer is not None: |
if layer is not None: |
471 |
color = self.choose_color() |
color = self.choose_color() |
472 |
if color is not None: |
if color is not None: |
473 |
layer.SetStroke(color) |
layer.GetClassification().SetDefaultLineColor(color) |
474 |
|
|
475 |
def LayerNoOutline(self): |
def LayerNoOutline(self): |
476 |
layer = self.current_layer() |
layer = self.current_layer() |
477 |
if layer is not None: |
if layer is not None: |
478 |
layer.SetStroke(None) |
layer.GetClassification().SetDefaultLineColor(Color.None) |
479 |
|
|
480 |
def HideLayer(self): |
def HideLayer(self): |
481 |
layer = self.current_layer() |
layer = self.current_layer() |
521 |
proj4Dlg.Destroy() |
proj4Dlg.Destroy() |
522 |
|
|
523 |
def Classify(self): |
def Classify(self): |
524 |
classifyDlg = classifier.Classifier(NULL, self.current_layer()) |
|
525 |
|
# |
526 |
classifyDlg.ShowModal() |
# the menu option for this should only be available if there |
527 |
classifyDlg.Destroy() |
# is a current layer, so we don't need to check if the |
528 |
|
# current layer is None |
529 |
|
# |
530 |
|
|
531 |
|
layer = self.current_layer() |
532 |
|
name = "classifier" + str(id(layer)) |
533 |
|
dialog = self.get_open_dialog(name) |
534 |
|
|
535 |
|
if dialog is None: |
536 |
|
dialog = classifier.Classifier(self, self.interactor, |
537 |
|
name, self.current_layer()) |
538 |
|
self.add_dialog(name, dialog) |
539 |
|
dialog.Show() |
540 |
|
|
541 |
def ZoomInTool(self): |
def ZoomInTool(self): |
542 |
self.canvas.ZoomInTool() |
self.canvas.ZoomInTool() |