189 |
""" |
""" |
190 |
self.SetSession(create_empty_session()) |
self.SetSession(create_empty_session()) |
191 |
|
|
192 |
def OpenSession(self, filename): |
def OpenSession(self, filename, db_connection_callback = None): |
193 |
"""Open the session in the file named filename""" |
"""Open the session in the file named filename""" |
194 |
# Make sure we deal with an absolute pathname. Otherwise we can |
# Make sure we deal with an absolute pathname. Otherwise we can |
195 |
# get problems when saving because the saving code expects an |
# get problems when saving because the saving code expects an |
196 |
# absolute directory name |
# absolute directory name |
197 |
filename = os.path.abspath(filename) |
filename = os.path.abspath(filename) |
198 |
session = load_session(filename) |
session = load_session(filename, |
199 |
|
db_connection_callback = db_connection_callback) |
200 |
session.SetFilename(filename) |
session.SetFilename(filename) |
201 |
session.UnsetModified() |
session.UnsetModified() |
202 |
self.SetSession(session) |
self.SetSession(session) |
205 |
for layer in map.Layers(): |
for layer in map.Layers(): |
206 |
if isinstance(layer, RasterLayer) \ |
if isinstance(layer, RasterLayer) \ |
207 |
and not Thuban.Model.resource.has_gdal_support(): |
and not Thuban.Model.resource.has_gdal_support(): |
208 |
msg = _("The current session contains Image layers,\n" + |
msg = _("The current session contains Image layers,\n" |
209 |
"but the GDAL library is not available to " + |
"but the GDAL library is not available to " |
210 |
"draw them.") |
"draw them.") |
211 |
dlg = wx.wxMessageDialog(None, |
dlg = wx.wxMessageDialog(None, |
212 |
msg, |
msg, |
213 |
_("Library not available"), |
_("Library not available"), |
214 |
wx.wxOK | wx.wxICON_INFORMATION) |
wx.wxOK | wx.wxICON_INFORMATION) |
215 |
print msg |
print msg |