Re: [Gimp-developer] PDB Procedures for External Progress Bars



Apperently my original response got malformed in the ether, so I am
trying again.  Copy paste of my original response below:

Joao,

Are you refering to known bug, or something new.

The exact code I am sending is this:
Where Progress.ME is a reference to a specific class instance (I was
trying to avoid sending a self reference in case that was the issue.
The original code replaced all Progress.ME references with a reference
to self.  (The class Progress contains a static member ME which is
simply equal to self.  This was done to create the callback in such a
way that it could be used without a 'self' reference required as a
paramerter.  I've tested it both ways and gotten the same results.)

            pth = "<Image>/Filters/Temp/" + Progress.ME._pdb_name
            gimp.install_temp_proc(
                "my_test_name_sghdf",
                "Temporary External Progress Bar Handler.",
                "Temporary External Progress Bar Handler.",
                "other_test_class_instance-jdsfg",  # Author
                "other_test_class_instance-jdsfg",  # Copy
                "Somewhen in the far future.",  # Date
                pth,  # Path
                "*",  # image types
                gimpfu.TEMPORARY,
                #3, provided by gimpfu
                #1, provided by gimpfu
                [
                    (gimpfu.PF_INT32, "num", "Value received"),
                    (gimpfu.PF_STRING, "word", "Value In."),
                    (gimpfu.PF_FLOAT, "f_num", "Value In.")
                ],
                [
                    (gimpfu.PF_BOOL, "ret_val", "True/False")
                ],
                Progress.ME.callback
            )
            gimp.pdb.gimp_progress_install(Progress.ME._pdb_name)

and the response I am getting back is :

Traceback (most recent call last):
  File "/usr/lib/gimp/2.0/python/gimpfu.py", line 850, in _run
    res = apply(func, params[1:])
  File "/home/<snip>/.gimp-2.8/plug-ins/sample.py", line 336, in
do_plug this = Plug()
  File "/home/<snip>/.gimp-2.8/plug-ins/sample.py", line 305, in
__init__ self._gui = GUI()
  File "/home/<snip>/.gimp-2.8/plug-ins/sample.py", line 174, in
__init__ self._progress = Progress()
  File "/home/<snip>/.gimp-2.8/plug-ins/sample.py", line 101, in
__init__ Progress.ME.callback(register=True)
  File "/home/<snip>/.gimp-2.8/plug-ins/sample.py", line 79, in
callback Progress.ME.callback
TypeError: install_temp_proc() takes exactly 11 arguments (12 given)

assuming that helps, or hoping rather.
C. Jason B.

On Thu, 27 Aug 2015 11:02:09 -0300
"Joao S. O. Bueno" <gwidion gmail com> wrote:

It should allow for the callback - and the behavior you describe is a
bug in the gimp=python.

As for any calls that require "-1" as a parameter for "nothing" or
"cancel" , they should take in
a Python's "None"  when used from Python.

On 27 August 2015 at 09:59, C. Jason. B. <c jason b gmail com>
wrote:  
List,

I am tasked with creating (python using GTK) a plugin which will
utilize a great many other scripts and plugins within GIMP.  The
file which is being written runs in full screen mode most of the
time so the progress bars in The GIMP are obscured, which leads to
the use of an external progress bar.  But a snag has been
encountered.  While trying to register a temporary function from
within python, it balks at the number of parameters, and the
parameter it is refusing is the callback function.  A perusal of
the source code lead me to gimpmodule.c in the pygimp directory
(line 642).

I am not a c programmer, so I am attempting to translate this via my
knowledge of Python.

It looks, at first glance, as if this function does not allow for a
callback function to be passed in.  If so, how would one register a
temporary function from python?

On an additional note, the PDB function gimp_progress_init indicates
that a '-1' is passed to instruct it to use an external window for a
progress bar, but it chokes on that value with an error (either as
a string or an int).

I have found the functions which (in Python) are accessed via
gimp.progress_install, so I know that these can be used instead.
What I am trying to find out is if the PDB variants of this are
implemented, or am I using them in the wrong way?  If I am using
them wrong, would someone be kind enough to explain how they should
be used?

Sincerely,
C. Jason B.
_______________________________________________
gimp-developer-list mailing list
List address:    gimp-developer-list gnome org
List membership:
https://mail.gnome.org/mailman/listinfo/gimp-developer-list List
archives:   https://mail.gnome.org/archives/gimp-developer-list  


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