|
@@ -18,6 +18,7 @@ import wx
|
|
|
|
|
|
from core.gcmd import GException, GError, GMessage
|
|
from core.gcmd import GException, GError, GMessage
|
|
from grass.imaging import writeAvi, writeGif, writeIms, writeSwf
|
|
from grass.imaging import writeAvi, writeGif, writeIms, writeSwf
|
|
|
|
+from core.gthread import gThread
|
|
from core.settings import UserSettings
|
|
from core.settings import UserSettings
|
|
from gui_core.wrap import EmptyImage, ImageFromBitmap
|
|
from gui_core.wrap import EmptyImage, ImageFromBitmap
|
|
|
|
|
|
@@ -619,10 +620,17 @@ class AnimationController(wx.EvtHandler):
|
|
|
|
|
|
# export
|
|
# export
|
|
pilImages = [WxImageToPil(image) for image in images]
|
|
pilImages = [WxImageToPil(image) for image in images]
|
|
- busy = wx.BusyInfo(_("Exporting animation, please wait..."),
|
|
|
|
- parent=self.frame)
|
|
|
|
|
|
+ self.busy = wx.BusyInfo(_("Exporting animation, please wait..."),
|
|
|
|
+ parent=self.frame)
|
|
wx.GetApp().Yield()
|
|
wx.GetApp().Yield()
|
|
try:
|
|
try:
|
|
|
|
+ def export_avi_callback(event):
|
|
|
|
+ error = event.ret
|
|
|
|
+ del self.busy
|
|
|
|
+ if error:
|
|
|
|
+ GError(parent=self.frame, message=error)
|
|
|
|
+ return
|
|
|
|
+
|
|
if exportInfo['method'] == 'sequence':
|
|
if exportInfo['method'] == 'sequence':
|
|
filename = os.path.join(
|
|
filename = os.path.join(
|
|
exportInfo['directory'],
|
|
exportInfo['directory'],
|
|
@@ -637,12 +645,19 @@ class AnimationController(wx.EvtHandler):
|
|
writeSwf(filename=exportInfo['file'], images=pilImages,
|
|
writeSwf(filename=exportInfo['file'], images=pilImages,
|
|
duration=self.timeTick / float(1000), repeat=True)
|
|
duration=self.timeTick / float(1000), repeat=True)
|
|
elif exportInfo['method'] == 'avi':
|
|
elif exportInfo['method'] == 'avi':
|
|
- writeAvi(filename=exportInfo['file'], images=pilImages,
|
|
|
|
- duration=self.timeTick / float(1000),
|
|
|
|
- encoding=exportInfo['encoding'],
|
|
|
|
- inputOptions=exportInfo['options'])
|
|
|
|
|
|
+ thread = gThread()
|
|
|
|
+ thread.Run(callable=writeAvi,
|
|
|
|
+ filename=exportInfo['file'],
|
|
|
|
+ images=pilImages,
|
|
|
|
+ duration=self.timeTick / float(1000),
|
|
|
|
+ encoding=exportInfo['encoding'],
|
|
|
|
+ inputOptions=exportInfo['options'],
|
|
|
|
+ bg_task=True,
|
|
|
|
+ ondone=export_avi_callback,
|
|
|
|
+ )
|
|
except Exception as e:
|
|
except Exception as e:
|
|
- del busy
|
|
|
|
|
|
+ del self.busy
|
|
GError(parent=self.frame, message=str(e))
|
|
GError(parent=self.frame, message=str(e))
|
|
return
|
|
return
|
|
- del busy
|
|
|
|
|
|
+ if exportInfo['method'] in ('sequence', 'gif', 'swf'):
|
|
|
|
+ del self.busy
|