13 |
|
|
14 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
15 |
|
|
16 |
__ThubanVersion__ = "0.2" #"$THUBAN_0_2$" |
__ThubanVersion__ = "0.8" #"$THUBAN_0_2$" |
17 |
#__BuildDate__ = "$Date$" |
#__BuildDate__ = "$Date$" |
18 |
|
|
19 |
import os |
import os |
22 |
from wxPython.wx import * |
from wxPython.wx import * |
23 |
from wxPython.wx import __version__ as wxPython_version |
from wxPython.wx import __version__ as wxPython_version |
24 |
|
|
|
from wxPython.lib.dialogs import wxMultipleChoiceDialog |
|
|
|
|
25 |
import Thuban |
import Thuban |
26 |
import Thuban.version |
import Thuban.version |
27 |
|
|
29 |
from Thuban.Model.session import create_empty_session |
from Thuban.Model.session import create_empty_session |
30 |
from Thuban.Model.layer import Layer, RasterLayer |
from Thuban.Model.layer import Layer, RasterLayer |
31 |
|
|
32 |
|
# XXX: replace this by |
33 |
|
# from wxPython.lib.dialogs import wxMultipleChoiceDialog |
34 |
|
# when Thuban does not support wxPython 2.4.0 any more. |
35 |
|
from Thuban.UI.multiplechoicedialog import wxMultipleChoiceDialog |
36 |
|
|
37 |
import view |
import view |
38 |
import tree |
import tree |
39 |
import tableview, identifyview |
import tableview, identifyview |
44 |
from context import Context |
from context import Context |
45 |
from command import registry, Command, ToolCommand |
from command import registry, Command, ToolCommand |
46 |
from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION |
from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION |
47 |
|
from about import About |
48 |
|
|
49 |
from Thuban.UI.dock import DockFrame |
from Thuban.UI.dock import DockFrame |
50 |
from Thuban.UI.join import JoinDialog |
from Thuban.UI.join import JoinDialog |
51 |
|
|
52 |
import resource |
import resource |
53 |
|
import Thuban.Model.resource |
54 |
|
|
55 |
import projdialog |
import projdialog |
56 |
|
|
57 |
|
|
|
|
|
58 |
class MainWindow(DockFrame): |
class MainWindow(DockFrame): |
59 |
|
|
60 |
# Some messages that can be subscribed/unsubscribed directly through |
# Some messages that can be subscribed/unsubscribed directly through |
109 |
|
|
110 |
self.init_dialogs() |
self.init_dialogs() |
111 |
|
|
112 |
|
self.ShowLegend() |
113 |
|
|
114 |
EVT_CLOSE(self, self.OnClose) |
EVT_CLOSE(self, self.OnClose) |
115 |
|
|
116 |
def Subscribe(self, channel, *args): |
def Subscribe(self, channel, *args): |
446 |
return self.get_open_dialog("session_tree") is not None |
return self.get_open_dialog("session_tree") is not None |
447 |
|
|
448 |
def About(self): |
def About(self): |
449 |
self.RunMessageBox(_("About"), |
dlg = About(self) |
450 |
_("Thuban %s\n" |
dlg.ShowModal() |
451 |
#"Build Date: %s\n" |
dlg.Destroy() |
|
"using:\n" |
|
|
" %s\n" |
|
|
" %s\n\n" |
|
|
"Thuban is a program for\n" |
|
|
"exploring geographic data.\n" |
|
|
"Copyright (C) 2001-2003 Intevation GmbH.\n" |
|
|
"Thuban is licensed under the GNU GPL" |
|
|
% (Thuban.version.longversion, |
|
|
"wxPython %s" % wxPython_version, |
|
|
"Python %d.%d.%d" % sys.version_info[:3] |
|
|
)), |
|
|
# % __ThubanVersion__), #__BuildDate__)), |
|
|
wxOK | wxICON_INFORMATION) |
|
452 |
|
|
453 |
def AddLayer(self): |
def AddLayer(self): |
454 |
dlg = wxFileDialog(self, _("Select a data file"), ".", "", "*.*", |
dlg = wxFileDialog(self, _("Select a data file"), ".", "", "*.*", |
568 |
def LayerShowTable(self): |
def LayerShowTable(self): |
569 |
layer = self.current_layer() |
layer = self.current_layer() |
570 |
if layer is not None: |
if layer is not None: |
571 |
table = layer.table |
table = layer.ShapeStore().Table() |
572 |
name = "table_view" + str(id(table)) |
name = "table_view" + str(id(table)) |
573 |
dialog = self.get_open_dialog(name) |
dialog = self.get_open_dialog(name) |
574 |
if dialog is None: |
if dialog is None: |
929 |
"""Return true if the legend window is shown""" |
"""Return true if the legend window is shown""" |
930 |
return context.mainwindow.LegendShown() |
return context.mainwindow.LegendShown() |
931 |
|
|
932 |
|
def _has_gdal_support(context): |
933 |
|
"""Return True if the GDAL is available""" |
934 |
|
return Thuban.Model.resource.has_gdal_support() |
935 |
|
|
936 |
# File menu |
# File menu |
937 |
_method_command("new_session", _("&New Session"), "NewSession", |
_method_command("new_session", _("&New Session"), "NewSession", |
995 |
_method_command("layer_add", _("&Add Layer..."), "AddLayer", |
_method_command("layer_add", _("&Add Layer..."), "AddLayer", |
996 |
helptext = _("Add a new layer to the map")) |
helptext = _("Add a new layer to the map")) |
997 |
_method_command("rasterlayer_add", _("&Add Image Layer..."), "AddRasterLayer", |
_method_command("rasterlayer_add", _("&Add Image Layer..."), "AddRasterLayer", |
998 |
helptext = _("Add a new image layer to the map")) |
helptext = _("Add a new image layer to the map"), |
999 |
|
sensitive = _has_gdal_support) |
1000 |
_method_command("layer_remove", _("&Remove Layer"), "RemoveLayer", |
_method_command("layer_remove", _("&Remove Layer"), "RemoveLayer", |
1001 |
helptext = _("Remove selected layer"), |
helptext = _("Remove selected layer"), |
1002 |
sensitive = _can_remove_layer) |
sensitive = _can_remove_layer) |
1072 |
helptext = _("Join two tables creating a new one")) |
helptext = _("Join two tables creating a new one")) |
1073 |
|
|
1074 |
# Export only under Windows ... |
# Export only under Windows ... |
1075 |
map_menu = ["layer_add", "rasterlayer_add", "layer_remove", "map_rename", |
map_menu = ["layer_add", "rasterlayer_add", "layer_remove", |
1076 |
None, |
None, |
1077 |
|
"map_rename", |
1078 |
"map_projection", |
"map_projection", |
1079 |
None, |
None, |
1080 |
"map_zoom_in_tool", "map_zoom_out_tool", |
"map_zoom_in_tool", "map_zoom_out_tool", |
1131 |
"selected_full_extent", |
"selected_full_extent", |
1132 |
None, |
None, |
1133 |
"map_identify_tool", "map_label_tool"]) |
"map_identify_tool", "map_label_tool"]) |
1134 |
|
|