[gimp] plug-ins: fix the ORA thumbnail load procedure.



commit d25b7301d6dd961a60a4f5b6a69b09c02e4ec46f
Author: Jehan <jehan girinstud io>
Date:   Wed Feb 9 22:50:28 2022 +0100

    plug-ins: fix the ORA thumbnail load procedure.
    
    - Fix return value in error case: s/GObject.Error/GLib.Error/ and anyway
      in this form, the error should be a string. Using the easier form
      procedure.new_return_values() instead.
    - "file-png-load" uses a GFile now (like all load procedures).

 plug-ins/python/file-openraster.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/python/file-openraster.py b/plug-ins/python/file-openraster.py
index 73239c5182..c78d776612 100755
--- a/plug-ins/python/file-openraster.py
+++ b/plug-ins/python/file-openraster.py
@@ -164,9 +164,10 @@ def thumbnail_ora(procedure, file, thumb_size, args, data):
     with open(tmp, 'wb') as fid:
         fid.write(orafile.read('Thumbnails/thumbnail.png'))
 
+    thumb_file = Gio.file_new_for_path(tmp)
     result = Gimp.get_pdb().run_procedure('file-png-load', [
         GObject.Value(Gimp.RunMode, Gimp.RunMode.NONINTERACTIVE),
-        GObject.Value(GObject.TYPE_STRING, tmp),
+        GObject.Value(Gio.File, thumb_file),
     ])
     os.remove(tmp)
     os.rmdir(tempdir)
@@ -184,10 +185,7 @@ def thumbnail_ora(procedure, file, thumb_size, args, data):
             GObject.Value(GObject.TYPE_INT, 1)
         ])
     else:
-        return Gimp.ValueArray.new_from_values([
-            GObject.Value(Gimp.PDBStatusType, result.index(0)),
-            GObject.Value(GObject.Error, result.index(1))
-        ])
+        return procedure.new_return_values(result.index(0), GLib.Error(result.index(1)))
 
 # We would expect the n_drawables parameter to not be there with introspection but
 # currently that isn't working, see issue #5312. Until that is resolved we keep
@@ -492,7 +490,6 @@ class FileOpenRaster (Gimp.PlugIn):
             procedure.set_documentation ('loads a thumbnail from an OpenRaster (.ora) file',
                                          'loads a thumbnail from an OpenRaster (.ora) file',
                                          name)
-            pass
         procedure.set_attribution('Jon Nordby', #author
                                   'Jon Nordby', #copyright
                                   '2009') #year


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