[GRASS-SVN] r47762 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 18 17:28:20 EDT 2011


Author: annakrat
Date: 2011-08-18 14:28:20 -0700 (Thu, 18 Aug 2011)
New Revision: 47762

Modified:
   grass/trunk/gui/wxpython/gui_modules/colorrules.py
Log:
wxGUI: color rules dialog: warning when there are too many records

Modified: grass/trunk/gui/wxpython/gui_modules/colorrules.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/colorrules.py	2011-08-18 20:39:06 UTC (rev 47761)
+++ grass/trunk/gui/wxpython/gui_modules/colorrules.py	2011-08-18 21:28:20 UTC (rev 47762)
@@ -1365,6 +1365,7 @@
         outFile.seek(0)
         i = 0
         minim = maxim = 0.0
+        limit = 1000
         while True:
             # os.linesep doesn't work here (MSYS)
             record = outFile.readline().replace('\n', '')
@@ -1385,7 +1386,24 @@
                     
             self.rulesPanel.ruleslines[i]['value'] = col1
             self.rulesPanel.ruleslines[i][self.attributeType] = col2
+            
             i += 1
+            
+        if i > limit:
+            dlg = wx.MessageDialog (parent = self, message = _(
+                                    "Number of loaded records reached %d, "
+                                    "displaying all the records will be time-consuming "
+                                    "and may lead to computer freezing, "
+                                    "do you still want to continue?") % i,
+                                    caption = _("Too many records"),
+                                    style  =  wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
+            if dlg.ShowModal() == wx.ID_YES:
+                dlg.Destroy()
+            else:
+                busy.Destroy()
+                dlg.Destroy()
+                return
+            
         
         self.rulesPanel.AddRules(i, start = True)
         ret = self.rulesPanel.LoadRules()



More information about the grass-commit mailing list