[GRASS-SVN] r58210 - grass/trunk/gui/wxpython/animation

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 13 08:58:39 PST 2013


Author: annakrat
Date: 2013-11-13 08:58:39 -0800 (Wed, 13 Nov 2013)
New Revision: 58210

Modified:
   grass/trunk/gui/wxpython/animation/controller.py
   grass/trunk/gui/wxpython/animation/dialogs.py
Log:
wxGUI/animation: let the user enter options for creating AVI (different ffmpeg versions require different options)

Modified: grass/trunk/gui/wxpython/animation/controller.py
===================================================================
--- grass/trunk/gui/wxpython/animation/controller.py	2013-11-13 16:20:48 UTC (rev 58209)
+++ grass/trunk/gui/wxpython/animation/controller.py	2013-11-13 16:58:39 UTC (rev 58210)
@@ -557,7 +557,7 @@
                 writeAvi(filename=exportInfo['file'], images=pilImages,
                             duration=self.timeTick / float(1000),
                             encoding=exportInfo['encoding'],
-                            inputOptions='-sameq')
+                            inputOptions=exportInfo['options'])
         except Exception, e:
             del busy
             GError(parent=self.frame, message=str(e))

Modified: grass/trunk/gui/wxpython/animation/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/animation/dialogs.py	2013-11-13 16:20:48 UTC (rev 58209)
+++ grass/trunk/gui/wxpython/animation/dialogs.py	2013-11-13 16:58:39 UTC (rev 58210)
@@ -40,7 +40,9 @@
 from nviztask import NvizTask
 
 from grass.pydispatch.signal import Signal
+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,
@@ -1019,7 +1021,7 @@
         helpSizer = wx.BoxSizer(wx.HORIZONTAL)
         helpSizer.AddStretchSpacer(1)
         self.formatPanelSizer = wx.BoxSizer(wx.VERTICAL)
-        helpSizer.Add(self.formatPanelSizer, proportion = 5)
+        helpSizer.Add(self.formatPanelSizer, proportion=5, flag=wx.EXPAND)
         borderSizer.Add(helpSizer, proportion = 1, flag = wx.EXPAND)
         self.formatPanels = []
 
@@ -1087,6 +1089,12 @@
 
         # panel for avi
         aviPanel = wx.Panel(parent = panel, id = wx.ID_ANY)
+        ffmpeg = gcore.find_program('ffmpeg', '--help')
+        if not ffmpeg:
+            warning = _("Program 'ffmpeg' was not found.\nPlease install it first "
+                        "and make sure\nit's in the PATH variable.")
+            warningLabel = wx.StaticText(parent=aviPanel, label=warning)
+            warningLabel.SetForegroundColour(wx.RED)
         self.aviBrowse = filebrowse.FileBrowseButton(parent = aviPanel, id = wx.ID_ANY,
                                                      fileMask = "AVI file (*.avi)|*.avi",
                                                      labelText = _("AVI file:"),
@@ -1095,11 +1103,22 @@
                                                      startDirectory = os.getcwd(), fileMode = wx.SAVE)
         encodingLabel = wx.StaticText(parent = aviPanel, id = wx.ID_ANY, label = _("Video codec:"))
         self.encodingText = wx.TextCtrl(parent = aviPanel, id = wx.ID_ANY, value = 'mpeg4')
+        optionsLabel = wx.StaticText(parent=aviPanel, label=_("Additional options:"))
+        self.optionsText = wx.TextCtrl(parent=aviPanel)
+        self.optionsText.SetToolTipString(_("Consider adding '-sameq' or '-qscale 1' "
+                                            "if not satisfied with video quality. "
+                                            "Options depend on ffmpeg version."))
         aviGridSizer = wx.GridBagSizer(hgap = 5, vgap = 5)
         aviGridSizer.AddGrowableCol(1)
         aviGridSizer.Add(self.aviBrowse, pos = (0, 0), span = (1, 2), flag = wx.EXPAND)
         aviGridSizer.Add(encodingLabel, pos = (1, 0), flag = wx.ALIGN_CENTER_VERTICAL)
         aviGridSizer.Add(self.encodingText, pos = (1, 1), flag = wx.EXPAND)
+        aviGridSizer.Add(optionsLabel, pos=(2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
+        aviGridSizer.Add(self.optionsText, pos=(2, 1), flag=wx.EXPAND)
+        if not ffmpeg:
+            aviGridSizer.Add(warningLabel, pos=(3, 0), span=(1, 2),
+                             flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
+
         aviPanel.SetSizer(aviGridSizer)
         aviGridSizer.Fit(aviPanel)
 
@@ -1277,6 +1296,7 @@
             info['method'] = 'avi'
             info['file'] = self.aviBrowse.GetValue()
             info['encoding'] = self.encodingText.GetValue()
+            info['options'] = self.optionsText.GetValue()
 
         return info
 



More information about the grass-commit mailing list