gimp r26543 - in trunk: . plug-ins/pygimp/plug-ins plug-ins/script-fu



Author: neo
Date: Wed Aug 13 21:54:27 2008
New Revision: 26543
URL: http://svn.gnome.org/viewvc/gimp?rev=26543&view=rev

Log:
2008-08-13  Sven Neumann  <sven gimp org>

	* plug-ins/pygimp/plug-ins/python-console.py: instead of calling
	gimp-displays-flush twice a second, call it after each command
	that is committed. This is similar to what the Script-Fu console
	does.

	* plug-ins/script-fu/script-fu-console.c: formatting.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/pygimp/plug-ins/python-console.py
   trunk/plug-ins/script-fu/script-fu-console.c

Modified: trunk/plug-ins/pygimp/plug-ins/python-console.py
==============================================================================
--- trunk/plug-ins/pygimp/plug-ins/python-console.py	(original)
+++ trunk/plug-ins/pygimp/plug-ins/python-console.py	Wed Aug 13 21:54:27 2008
@@ -41,6 +41,17 @@
         if s[0] != '_':
             namespace[s] = getattr(gimpenums, s)
 
+    class GimpConsole(pyconsole.Console):
+        def __init__(self, quit_func=None):
+            banner = ('GIMP %s Python Console\nPython %s\n' %
+                      (gimp.pdb.gimp_version(), sys.version))
+            pyconsole.Console.__init__(self,
+                                       locals=namespace, banner=banner,
+                                       quit_func=quit_func)
+        def _commit(self):
+            pyconsole.Console._commit(self)
+            gimp.displays_flush()
+
     class Console(gimpui.Dialog):
         def __init__(self):
             gimpui.Dialog.__init__(self, title=_("Python Console"),
@@ -55,11 +66,7 @@
                                                RESPONSE_CLEAR,
                                                RESPONSE_SAVE))
 
-            banner = ('GIMP %s Python Console\nPython %s\n' %
-                      (gimp.pdb.gimp_version(), sys.version))
-
-            self.cons = pyconsole.Console(locals=namespace, banner=banner,
-                                          quit_func=lambda: gtk.main_quit())
+            self.cons = GimpConsole(quit_func=lambda: gtk.main_quit())
 
             self.connect('response', self.response)
 
@@ -201,17 +208,9 @@
 
         def run(self):
             self.show_all()
-
-            # flush the displays every half second
-            def timeout():
-                gimp.displays_flush()
-                return True
-
-            gobject.timeout_add(500, timeout)
             gtk.main()
 
-    console = Console()
-    console.run()
+    Console().run()
 
 register(
     PROC_NAME,

Modified: trunk/plug-ins/script-fu/script-fu-console.c
==============================================================================
--- trunk/plug-ins/script-fu/script-fu-console.c	(original)
+++ trunk/plug-ins/script-fu/script-fu-console.c	Wed Aug 13 21:54:27 2008
@@ -609,6 +609,7 @@
                                        output->len,
                                        console);
         }
+
       g_string_free (output, TRUE);
 
       gimp_displays_flush ();



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