Prechádzať zdrojové kódy

wxGUI/animation: fix speed dialog caused by granularirty problem (day vs days), do not restrict the animation speed

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64980 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 rokov pred
rodič
commit
465e3dea85
1 zmenil súbory, kde vykonal 7 pridanie a 5 odobranie
  1. 7 5
      gui/wxpython/animation/dialogs.py

+ 7 - 5
gui/wxpython/animation/dialogs.py

@@ -49,7 +49,7 @@ import grass.script.core as gcore
 
 class SpeedDialog(wx.Dialog):
     def __init__(self, parent, title=_("Adjust speed of animation"),
-                 temporalMode=None, minimumDuration=20, timeGranularity=None,
+                 temporalMode=None, minimumDuration=0, timeGranularity=None,
                  initialSpeed=200):
         wx.Dialog.__init__(self, parent=parent, id=wx.ID_ANY, title=title,
                            style=wx.DEFAULT_DIALOG_STYLE)
@@ -179,10 +179,11 @@ class SpeedDialog(wx.Dialog):
 
         if self.temporalMode == TemporalMode.TEMPORAL:
             unit = self.timeGranularity[1]
-            try:
-                index = timeUnits.index(unit)
-            except ValueError:
-                index = 0
+            index = 0
+            for i, timeUnit in enumerate(timeUnits):
+                if timeUnit.startswith(unit):
+                    index = i
+                    break
             choiceWidget.SetSelection(index)
         else:
             choiceWidget.SetSelection(0)
@@ -233,6 +234,7 @@ class SpeedDialog(wx.Dialog):
 
             value = self.spinDurationTemp.GetValue()
             ms = value * seconds2 / float(seconds1)
+            # minimumDuration set to 0, too restrictive
             if ms < self.minimumDuration:
                 GMessage(parent=self, message=_("Animation speed is too high."))
                 return