瀏覽代碼

wxGUI/animation: only hide export dialog to keep values there

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57757 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 11 年之前
父節點
當前提交
825f6c6a03
共有 2 個文件被更改,包括 20 次插入13 次删除
  1. 12 11
      gui/wxpython/animation/controller.py
  2. 8 2
      gui/wxpython/animation/dialogs.py

+ 12 - 11
gui/wxpython/animation/controller.py

@@ -71,6 +71,8 @@ class AnimationController(wx.EvtHandler):
 
         self.timeTick = 200
 
+        self._dialogs = {}
+
     def SetAnimationToolbar(self, toolbar):
         self.animationToolbar = toolbar
 
@@ -458,18 +460,17 @@ class AnimationController(wx.EvtHandler):
         if not self.animationData:
             GMessage(parent = self.frame, message = _("No animation to export."))
             return
-        dlg = ExportDialog(self.frame, temporal = self.temporalMode,
-                           timeTick = self.timeTick, visvis = hasVisvis)
-        if dlg.ShowModal() == wx.ID_OK:
-            decorations = dlg.GetDecorations()
-            exportInfo = dlg.GetExportInformation()
-            dlg.Destroy()
-        else:
-            dlg.Destroy()
-            return
-
-        self._export(exportInfo, decorations)
 
+        if 'export' in self._dialogs:
+            self._dialogs['export'].Show()
+            self._dialogs['export'].Raise()
+        else:
+            dlg = ExportDialog(self.frame, temporal=self.temporalMode,
+                               timeTick=self.timeTick, visvis=hasVisvis)
+            dlg.doExport.connect(self._export)
+            self._dialogs['export'] = dlg
+            dlg.Show()
+        
     def _export(self, exportInfo, decorations):
         size = self.frame.animationPanel.GetSize()
         if self.temporalMode == TemporalMode.TEMPORAL:

+ 8 - 2
gui/wxpython/animation/dialogs.py

@@ -854,6 +854,9 @@ class ExportDialog(wx.Dialog):
         self.visvis = visvis
         self._layout()
 
+        # export animation
+        self.doExport = Signal('ExportDialog::doExport')
+
         wx.CallAfter(self._hideAll)
 
     def _layout(self):
@@ -1258,8 +1261,11 @@ class ExportDialog(wx.Dialog):
                 GError(parent = self, message = _("Export file is missing."))
                 return
 
-        self.EndModal(wx.ID_OK)
-           
+        # hide only to keep previous values
+        self.Hide()
+        self.doExport.emit(exportInfo=self.GetExportInformation(),
+                           decorations=self.GetDecorations())
+
     def GetDecorations(self):
         return self.decorations