ソースを参照

wxGUI: color rules dialog: warning when there are too many records

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47762 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 13 年 前
コミット
ecf1414b24
1 ファイル変更18 行追加0 行削除
  1. 18 0
      gui/wxpython/gui_modules/colorrules.py

+ 18 - 0
gui/wxpython/gui_modules/colorrules.py

@@ -1365,6 +1365,7 @@ class VectorColorTable(ColorTable):
         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 @@ class VectorColorTable(ColorTable):
                     
             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()