Sfoglia il codice sorgente

wxGUI/animation: add warning when rendering fails

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57899 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 11 anni fa
parent
commit
d32ccdaa2b
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 5 3
      gui/wxpython/animation/mapwindow.py

+ 5 - 3
gui/wxpython/animation/mapwindow.py

@@ -285,7 +285,7 @@ class BitmapProvider(object):
         """!Sets size when size of related window changes."""
         """!Sets size when size of related window changes."""
         self.imageWidth, self.imageHeight = width, height
         self.imageWidth, self.imageHeight = width, height
 
 
-    def _createNoDataBitmap(self, width, height):
+    def _createNoDataBitmap(self, width, height, text="No data"):
         """!Creates 'no data' bitmap.
         """!Creates 'no data' bitmap.
 
 
         Used when requested bitmap is not available (loading data was not successful) or 
         Used when requested bitmap is not available (loading data was not successful) or 
@@ -295,7 +295,7 @@ class BitmapProvider(object):
         dc = wx.MemoryDC()
         dc = wx.MemoryDC()
         dc.SelectObject(bitmap)
         dc.SelectObject(bitmap)
         dc.Clear()
         dc.Clear()
-        text = _("No data")
+        text = _(text)
         dc.SetFont(wx.Font(pointSize = 40, family = wx.FONTFAMILY_SCRIPT,
         dc.SetFont(wx.Font(pointSize = 40, family = wx.FONTFAMILY_SCRIPT,
                            style = wx.FONTSTYLE_NORMAL, weight = wx.FONTWEIGHT_BOLD))
                            style = wx.FONTSTYLE_NORMAL, weight = wx.FONTWEIGHT_BOLD))
         tw, th = dc.GetTextExtent(text)
         tw, th = dc.GetTextExtent(text)
@@ -424,7 +424,8 @@ class BitmapProvider(object):
                     # Unfortunately the png files must be read here, 
                     # Unfortunately the png files must be read here, 
                     # since the swig wx objects can not be serialized by the Queue object :(
                     # since the swig wx objects can not be serialized by the Queue object :(
                     if filename == None:
                     if filename == None:
-                        self.bitmapPool[name_list[i]] = wx.EmptyBitmap(imageWidth, imageHeight)
+                        self.bitmapPool[name_list[i]] = self._createNoDataBitmap(imageWidth, imageHeight,
+                                                                                 text="Failed to render")
                     else:
                     else:
                         self.bitmapPool[name_list[i]] = wx.BitmapFromImage(wx.Image(filename))
                         self.bitmapPool[name_list[i]] = wx.BitmapFromImage(wx.Image(filename))
                         os.remove(filename)
                         os.remove(filename)
@@ -535,6 +536,7 @@ def mapRenderProcess(mapType, mapname, width, height, fileQueue):
         return
         return
 
 
     if returncode != 0:
     if returncode != 0:
+        grass.warning("Rendering failed:\n" + messages)
         fileQueue.put(None)
         fileQueue.put(None)
         os.remove(filename)
         os.remove(filename)
         return
         return