Przeglądaj źródła

wxGUI/animation: show error and proceed with temporal database mismatch (#950)

Anna Petrasova 4 lat temu
rodzic
commit
6f86e05693

+ 6 - 4
gui/wxpython/animation/frame.py

@@ -18,18 +18,17 @@ This program is free software under the GNU General Public License
 @author Anna Petrasova <kratochanna gmail.com>
 """
 import os
-import sys
 import wx
 import wx.aui
-import tempfile
 import six
 
 import grass.script as gcore
 import grass.temporal as tgis
+from grass.exceptions import FatalError
 from core import globalvar
 from gui_core.widgets import IntegerValidator
 from gui_core.wrap import StaticText, TextCtrl
-from core.gcmd import RunCommand
+from core.gcmd import RunCommand, GWarning
 
 from animation.mapwindow import AnimationWindow
 from animation.provider import BitmapProvider, BitmapPool, \
@@ -65,7 +64,10 @@ class AnimationFrame(wx.Frame):
                 wx.BITMAP_TYPE_ICO))
 
         # Make sure the temporal database exists
-        tgis.init()
+        try:
+            tgis.init()
+        except FatalError as e:
+            GWarning(parent=self, message=str(e))
 
         # create temporal directory and ensure it's deleted after programs ends
         # (stored in MAPSET/.tmp/)

+ 5 - 1
gui/wxpython/animation/g.gui.animation.py

@@ -52,6 +52,7 @@
 #%end
 
 import grass.script as gscript
+from grass.exceptions import FatalError
 
 
 def main():
@@ -94,7 +95,10 @@ def main():
         # We need to initialize the temporal framework in case
         # a space time dataset was set on the command line so that
         # the AnimLayer() class works correctly
-        tgis.init()
+        try:
+            tgis.init()
+        except FatalError as e:
+            print(e)
 
     layerList = LayerList()
     if rast: