[GRASS-SVN] r61504 - grass/branches/releasebranch_7_0/gui/wxpython/animation

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 2 20:04:41 PDT 2014


Author: annakrat
Date: 2014-08-02 20:04:41 -0700 (Sat, 02 Aug 2014)
New Revision: 61504

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/animation/controller.py
   grass/branches/releasebranch_7_0/gui/wxpython/animation/dialogs.py
   grass/branches/releasebranch_7_0/gui/wxpython/animation/frame.py
Log:
wxGUI/animation: update format automatically after editing in preferences (merge from trunk, r61503)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/animation/controller.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/animation/controller.py	2014-08-03 03:01:16 UTC (rev 61503)
+++ grass/branches/releasebranch_7_0/gui/wxpython/animation/controller.py	2014-08-03 03:04:41 UTC (rev 61504)
@@ -189,6 +189,11 @@
 
         return None
 
+    def UpdateAnimations(self):
+        """Used sofar for updating slider time labels
+        after change of format"""'
+        self._setAnimations()
+
     def EditAnimations(self):
         # running = False
         # if self.timer.IsRunning():

Modified: grass/branches/releasebranch_7_0/gui/wxpython/animation/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/animation/dialogs.py	2014-08-03 03:01:16 UTC (rev 61503)
+++ grass/branches/releasebranch_7_0/gui/wxpython/animation/dialogs.py	2014-08-03 03:04:41 UTC (rev 61504)
@@ -1457,6 +1457,7 @@
                  settings=UserSettings):
         PreferencesBaseDialog.__init__(self, parent=parent, giface=giface, title=title,
                                        settings=settings, size=(-1, 270))
+        self.formatChanged = Signal('PreferencesDialog.formatChanged')
 
         self._timeFormats = ['%Y-%m-%d %H:%M:%S',  # 2013-12-29 11:16:26
                              '%Y-%m-%d',  # 2013-12-29
@@ -1470,6 +1471,8 @@
                              '%I %p',  # 11 AM
                              ]
         self._format = None
+        self._initFormat = self.settings.Get(group='animation', key='temporal',
+                                             subkey='format')
         # create notebook pages
         self._createGeneralPage(self.notebook)
         self._createTemporalPage(self.notebook)
@@ -1523,8 +1526,7 @@
                       flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         self.tempFormat = wx.ComboBox(parent=panel, name='GetValue')
         self.tempFormat.SetItems(self._timeFormats)
-        self.tempFormat.SetValue(self.settings.Get(group='animation', key='temporal',
-                                                   subkey='format'))
+        self.tempFormat.SetValue(self._initFormat)
         self.winId['animation:temporal:format'] = self.tempFormat.GetId()
         gridSizer.Add(item=self.tempFormat, pos=(row, 1), flag=wx.ALIGN_RIGHT)
         self.infoTimeLabel = wx.StaticText(parent=panel)
@@ -1577,7 +1579,10 @@
 
     def _updateSettings(self):
         self.tempFormat.SetValue(self._format)
-        return PreferencesBaseDialog._updateSettings(self)
+        PreferencesBaseDialog._updateSettings(self)
+        if self._format != self._initFormat:
+            self.formatChanged.emit()
+        return True
 
 
 def test():

Modified: grass/branches/releasebranch_7_0/gui/wxpython/animation/frame.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/animation/frame.py	2014-08-03 03:01:16 UTC (rev 61503)
+++ grass/branches/releasebranch_7_0/gui/wxpython/animation/frame.py	2014-08-03 03:04:41 UTC (rev 61504)
@@ -296,6 +296,7 @@
         if not self.dialogs['preferences']:
             dlg = PreferencesDialog(parent=self, giface=self._giface)
             self.dialogs['preferences'] = dlg
+            dlg.formatChanged.connect(lambda: self.controller.UpdateAnimations())
             dlg.CenterOnParent()
 
         self.dialogs['preferences'].ShowModal()



More information about the grass-commit mailing list