[gcompris] tuxpaint, added support for the new --fullscreen option



commit f7ac78bb9bf733a2c3fa1555ea01b2c56a4f3022
Author: Pere Pujal i Carabantes <perepujal gmail com>
Date:   Mon Nov 24 23:11:04 2014 +0100

    tuxpaint, added support for the new --fullscreen option
    
    Now tuxpaint (1.10.22) requires a parameter for --fullscreen. This patch
    detect the tuxpaint version and pass the proper parameter based on it.

 src/tuxpaint-activity/tuxpaint.py |   54 +++++++++++++++++++++++++++++++++++-
 1 files changed, 52 insertions(+), 2 deletions(-)
---
diff --git a/src/tuxpaint-activity/tuxpaint.py b/src/tuxpaint-activity/tuxpaint.py
index f06d8e7..8d4996d 100644
--- a/src/tuxpaint-activity/tuxpaint.py
+++ b/src/tuxpaint-activity/tuxpaint.py
@@ -86,10 +86,61 @@ class Gcompris_tuxpaint:
 
     self.rootitem = goocanvas.Group(parent = self.gcomprisBoard.canvas.get_root_item())
 
+
+
+    # first run: find version
+    options = [progname]
+    options.append('--version')
+    global pid
+    try:
+       # bug in working_directory=None ?
+       if (tuxpaint_dir):
+          pid, stdin, stdout, stderr = gobject.spawn_async(
+            argv=options,
+            flags=flags,
+            working_directory=tuxpaint_dir,
+            standard_output=True
+            )
+
+       else:
+          pid, stdin, stdout, stderr = gobject.spawn_async(
+            argv=options,
+            flags=flags,
+            standard_output=True
+            )
+
+    except:
+       gcompris.utils.dialog(_("Cannot find Tuxpaint.\nInstall it to use this activity !"),stop_board)
+       return
+
+    gobject.child_watch_add(pid, child_callback, data=self, priority=gobject.PRIORITY_HIGH)
+
+    output=os.read(stdout, 255)
+
+    parsenext = False
+    oldfullscreensyntax = False
+    for i in output.split():
+      if ( parsenext):
+        tpversion = i.split(".")
+        major, minor, sub = tpversion
+        if (int(major) < 1 and int(minor) < 10 and int(sub) < 22):
+          oldfullscreensyntax=True
+        break
+
+      if (i == "Version"):
+        # next is the version number
+        parsenext = True
+
+
+    # second run: adapt the parms to the version and run
     options = [progname]
 
     if (Prop.fullscreen and eval(self.config_dict['fullscreen'])):
-      options.append('--fullscreen')
+      if (oldfullscreensyntax):
+        options.append('--fullscreen')
+        options.append('--native')
+      else:
+        options.append('--fullscreen=native')
 
     if eval(self.config_dict['disable_shape_rotation']):
       options.append('--simpleshapes')
@@ -105,7 +156,6 @@ class Gcompris_tuxpaint:
 
     gcompris.sound.close()
 
-    global pid
     try:
        # bug in working_directory=None ?
        if (tuxpaint_dir):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]