GIMP Chat http://gimpchat.com/ |
|
Script won't run the second time (solved) http://gimpchat.com/viewtopic.php?f=9&t=18697 |
Page 1 of 2 |
Author: | Pocholo [ Mon Aug 24, 2020 8:02 am ] |
Post subject: | Script won't run the second time (solved) |
Hi you all! I wrote this python script trying to create 500 x 500 px "Icon pressed effect", and I'm stuck. The script run perfect the first time but when i try to run the second time it won't appear. I'm made it that you can choose your own media icon brush. I think it has to be with the added param for the brushes. Can any of the experience coder tell me why it's not working the second time so I can fix it? Ps Attach is a set of icon brushes I create for the testing. Code: Select all #!/usr/bin/env python |
Author: | dinasset [ Mon Aug 24, 2020 10:06 am ] |
Post subject: | Re: Script won't run the second time |
Good question for Ofnuts. BTW, I do not understand why you pretend an input image which is not used, instead of creating one new yourself. |
Author: | Pocholo [ Mon Aug 24, 2020 2:21 pm ] |
Post subject: | Re: Script won't run the second time |
dinasset wrote: Good question for Ofnuts. BTW, I do not understand why you pretend an input image which is not used, instead of creating one new yourself. You're right. I was writing this script late last night and I was falling asleep from time to time. So I found out that you put your brain to rest and not over work it. I fixed it so it create a new image. Still, I run the script once and It work perfectly but when I try it to run again won't do anything. I hope someone help me on this. |
Author: | ofnuts [ Mon Aug 24, 2020 4:12 pm ] |
Post subject: | Re: Script won't run the second time |
I don't see anything in your code that can help you debug the problem. A python script normally issues messages when crashing. See https://www.gimp-forum.net/Thread-Debug ... in-Windows for some hints and techniques. This said, having one color and one brush as parameters when you can use those set in the context (that the user can set using the GUI...) while at the same time having the script rigidly creating 500px images tells me that you have got your priorities wrong. |
Author: | Pocholo [ Mon Aug 24, 2020 4:58 pm ] |
Post subject: | Re: Script won't run the second time |
ofnuts wrote: I don't see anything in your code that can help you debug the problem. A python script normally issues messages when crashing. See https://www.gimp-forum.net/Thread-Debug ... in-Windows for some hints and techniques. This said, having one color and one brush as parameters when you can use those set in the context (that the user can set using the GUI...) while at the same time having the script rigidly creating 500px images tells me that you have got your priorities wrong. Thank for the respond. Well, the script is not issuing any error. It worked perfectly when you run it the first time, but when you try to run it the second time the dialog won't even appear. Now, if I go to: Filters> Reset all filters, the script work. Video from : www.youtube.com |
Author: | MareroQ [ Mon Aug 24, 2020 10:18 pm ] |
Post subject: | Re: Script won't run the second time |
Hi Pocholo. Solution 1. Line 173 Code: Select all (PF_STRING, "nombre", "Name brush", "GIMP Brush #26"), #(PF_BRUSH, "brush", "Choose icon", 0), Solution 2. Line 30 Code: Select all def pm_icon_pressed_effect(bgColor): Line 77 Code: Select all pdb.gimp_context_set_brush (name) #pdb.gimp_context_set_brush (brush) Line 173 Code: Select all #(PF_BRUSH, "brush", "Choose icon", 0), ------------------------------------------------------------------------------ ps. Line 51 (typo ..rr..) Code: Select all pdb.gimp_context_set_foreground((200, 85, 255)) #pdb.gimp_context_set_forreground((200, 85, 255)) Line 2 add: Code: Select all # -*- coding: utf-8 -*- |
Author: | Pocholo [ Tue Aug 25, 2020 1:35 pm ] |
Post subject: | Re: Script won't run the second time |
Thank you for the tips, MareroQ. Still the question remained unanswered. If I write it like you mention it work but instead you have to right the name of the brush you want to use for the script. Code: Select all (PF_STRING, "brush", "Brush name", ""), Meanwhile I want to user be able to choose the brush from the pop up brush dialog using the param below Code: Select all (PF_BRUSH, "brush", "Choose brush", None), The filter shows up and I'm able to choose the brush I want, but it will run only once. Try to run the script again and it doesn't shows up. |
Author: | nelo [ Tue Aug 25, 2020 2:40 pm ] |
Post subject: | Re: Script won't run the second time |
when I start gimp -c to get output on the console this is what I get when it "runs" the second time: Code: Select all Traceback (most recent call last): |
Author: | ofnuts [ Wed Aug 26, 2020 2:14 am ] |
Post subject: | Re: Script won't run the second time |
nelo wrote: when I start gimp -c to get output on the console this is what I get when it "runs" the second time: Code: Select all Traceback (most recent call last): Looks like a Gimp bug... |
Author: | rich2005 [ Wed Aug 26, 2020 2:53 am ] |
Post subject: | Re: Script won't run the second time (Unsolved) |
Looks like this problem has a history. Ofnuts posted working / non-working examples: https://www.gimp-forum.net/Thread-GIMP- ... 71#pid7971 |
Author: | Pocholo [ Wed Aug 26, 2020 7:51 am ] |
Post subject: | Re: Script won't run the second time (Unsolved) |
Thank you guy, I guess the developers never fixed it. I'm going to have to settle with: Code: Select all (PF_STRING, "brush", "Brush name", ""), |
Author: | MareroQ [ Wed Aug 26, 2020 2:11 pm ] | ||
Post subject: | Re: Script won't run the second time (Unsolved) | ||
Hi Pocholo. Why didn't you try Solution 2. This is an example of using an active brush (selectable by clicking). This is your plugin, so I will remove the attachment when you let me know you looked at some minor changes. Edit:As announced, the attachment has been removed.
|
Author: | mackenzieh [ Wed Aug 26, 2020 2:58 pm ] |
Post subject: | Re: Script won't run the second time (Unsolved) |
MareroQ, Your addition to Pocholo's script works well. Here's my outcome from the addition that you made: |
Author: | Pocholo [ Wed Aug 26, 2020 3:14 pm ] |
Post subject: | Re: Script won't run the second time (Unsolved) |
MareroQ wrote: Hi Pocholo. Why didn't you try Solution 2. This is an example of using an active brush (selectable by clicking). This is your plugin, so I will remove the attachment when you let me know you looked at some minor changes. Sorry about that, Your script it's a little more complex, thank you for the inpunt. Since I'm still in the learning process I like to learn the "Scale factor". When I resize the Layer or image, I want the filters or plugin used in the code, to increase with the Layer. At this age 60 yrs old and I started to learn coding just before when the pandemic stated. So far all I done are simple scripts on what I have learn this past few months. |
Author: | MareroQ [ Wed Aug 26, 2020 5:17 pm ] |
Post subject: | Re: Script won't run the second time (solved) |
I would like to always make progress as fast as you do. |
Author: | Pocholo [ Wed Aug 26, 2020 6:03 pm ] |
Post subject: | Re: Script won't run the second time (solved) |
Thanks MareroQ! |
Author: | MareroQ [ Thu Aug 27, 2020 9:56 am ] | ||
Post subject: | Re: Script won't run the second time (solved) | ||
I'm sorry to interfere again - but the "named brush" option can be easily exploited by copying the image/text and using the "Clipboard Mask". Plugin Pocholo (with minor changes) with using text - example in attachment. Edit: attachment removed due to internationalization error.
|
Author: | Nidhogg [ Thu Aug 27, 2020 10:22 am ] |
Post subject: | Re: Script won't run the second time (solved) |
Edit, works okay. |
Author: | MareroQ [ Thu Aug 27, 2020 10:35 am ] | |||
Post subject: | Re: Script won't run the second time (solved) | |||
A certain advantage of this solution is the possibility of using UNICODE signs (with the use of BabelMap - indicated by Nidhogg - for which I would like to thank you again).
|
Author: | Nidhogg [ Thu Aug 27, 2020 10:48 am ] |
Post subject: | Re: Script won't run the second time (solved) |
MareroQ, the Unicode plug-in(s) you wrote are good for this Attachment: ZapfDingbats-Rho.png [ 42.58 KiB | Viewed 2123 times ] |
Page 1 of 2 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |