[Gimp-user] Create PDB Inputs?
In Python scripting you can use PF_XXX parameters in the register() function to generate a settings window, but these are pretty limited. I've made my own UI constructor to meet my needs. So, because of this I only use PF_IMAGE and PF_DRAWABLE. However, this means the only parameters that can be input into the plugin's PDB function is the image/layer. I've set up a value-check system so the plugin can run in 'non-interactive', but because of the lack of PDB support I'd have to import the plugin's class from the actual file and call it's main(). How would I add inputs to my plugin as it's seen in the PDB without creating a GUI? The gimpenums module clearly has things such as PDB_INT32, but they don't seem to help. I know you can use a gimpplugin.plugin class instead of the gimpfu register() function for more complex operations, but I've found absolutely no documentation on how to do that. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Autocrop Buggy
That's really weird. You'd think they'd just make it take a 3rd argument if that was the functionality they wanted - (Image, source layer, target layer) -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Autocrop Buggy
Straight to the point. The Autocrop layer function is weird. Take something simple >for X in image.layers: > pdb.plug_in_autocrop_layer(image, X) and it still doesn't work, giving a variety of strange bugs. Why? -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] GIMP 2.9 Nightly - Plugin Errors
Actually, I don't think it has Python in it. That's probably the issue. Probably no helping that. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] GIMP 2.9 Nightly - Plugin Errors
I normally use Partha's GIMP 2.9 builds, but I decided to try the Nightly builds of 2.9 for a change. Long story short, no 3rd party scripts load. All of my older scripts & the Resynthesizer scripts return "Failed to execute child process (No such file or directory)" to the console when GIMP tries to load them. My newer scripts oddly return "(Exec format error)" instead, as if they're not proper plugins. Finally, the Resynthesizer .exe plugin loads fine. I understand the Partha builds are a bit modified, but surely loading some simply Python plugins shouldn't be a problem, right? -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] 'Precision' Meaning
When creating a script for GIMP, using something like stroke.get_point_at_dist(...) it requires 2 floats: distance and 'precision for estimation'. What does 'precision for estimation' mean? -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Undo a Step in Python-Fu
Alright, I added the 'duplicate final layers' code I described earlier to my plugin and it worked. In fact, it worked even better than I expected. With 2 final layers @2400*1755 in this case, the copying of the layers from frozen 'working' undo memory to a thawed, undo-able group happened instantaneously. To top it off, the size of the group was smaller than the master layer off which the script worked. So with that and some finishing touches/features, I made a completely perfect Python plugin. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Undo a Step in Python-Fu
>From your message, it seems like you've tried a lot the existing >possibilities, and probably this trick won't help you at all - but, >that is only what exists on GIMP. Yes. While I haven't *tried* the possibilities, I've already thought about various half-solutions including: -The program exits, only allowing a single execution while the settings are saved to the gimp shelf for the next time it launches (what GIMP plugins normally do). -The program exits, only allowing a single execution but having a 'Preview Effect' button that runs the main function without saving to the undo group. This would mean you'd always have to run the effect an extra time to finalize it, even if the preview is perfect. Your solution would work, but that'd involve re-constructing the entire image upon plugin launch. The whole point of not putting everything into a single large undo group is to avoid huge operations and hammering the RAM usage. It'd be fine for touching up an image, but bad for a large project consisting of like 20 layers. However, your solution really inspired me... What *doesn't* take a lot of resources is copying a single layer or two. I could freeze the undo memory for the entire duration the program's up, then at the very end I should be able to cut and re-add the layer into an undo group. In fact, this could allow for potentially faster performance when frequently undoing and redoing steps, as it'd just be a paste or two in the undo group instead of the long process to get there. It should be easy to do since I already have to save all the important layers as a class field so I can check for their existence and manipulate them in other parts of the program. I'll try modifying the code to be as follows and report back if it works: Class __init__: freeze undo before anything else. Main window's on_destroy: copy and remove (cut if the layer object has it) the final layer(s). Thaw undo. Paste final layer(s). -Even when I scale things to crazy resolutions in Waifu2x and use a developmental GIMP build, duplicating layers is still typically fast enough to be considered negligible. So, this *should* work absolutely perfectly. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Undo a Step in Python-Fu
Hi there, I've just started the task of re-writing all of my scripts in a more professional manner. Hand-made UI, ability to be imported as a module, etc. However, I've come across a problem with managing the plugins' undo groups. Initially, I put the whole plugin inside of a single undo group, but this would mean you could have a massive multiple-gigabyte undo group if the user ran the functions a lot. I've now frozen the undo group for actions such as temporary Previewing, but the main function has to be in an undo group. My the current plugin I'm working on operates as such: -The 'Preview' function shows the black&white threshold that the bloom plugin will count as a 'light area'. The preview layer is removed whenever the next action (running main function, previewing again, closing window) is done. This operation will thus never be a part of the final result, and I can freeze it out of the undo-groups. -The 'Execute' function runs the main script (bloom in this case) *without* closing the window. This allows the user to re-adjust the settings and re-execute very easily. Obviously, this is in an undo-group since it'll be the final result. However, due to the possibility of executing multiple times, it can either A: Creates a lot of undo groups or B: One undo group with a bunch of redundant information depending on where I place the groupings. I've attached the .py file to this post in case you want to see the problem in GIMP first-hand. TL;DR: I need a way to either go back an undo step (Ctrl-Z) or to clear an undo step from the list in my Python script. Attachments: * http://www.gimpusers.com/system/attachments/303/original/fsw-bloom.py -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Custom Script UI
Kevin, in you're code you have no image or drawable picked using the PF_XXX parameters, but they still show up in your code when the starting function is run. How? In this code: # def start(*args): pdb.gimp_message(args) register( "FSW-SCRIPT", "desc.", "desc2.", "FierySwordswoman", "FierySwordswoman", "1989", "FSW Script", "*", [], [], start, menu="/" ) main() # it prints the message '()', meaning I'm not receiving the image and drawable arguments for the function...why? The closest thing I could find in the python-fu documentation was "gimp.images_list()", which isn't a good solution. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Custom Script UI
EDIT: Adding the PF_IMAGE and PF_LAYER parameters fixes that without impeding the GUI creation. Alright, I'm set. I even managed to import GIMP's menu themes to use on my custom UI. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Custom Script UI
>Something like this: > >register( > 'new-image', > 'Creates a new image','Creates a new image', > 'Myself','Myself', > '2012', > 'Create new image', > '',[],[], > newImage, > menu='/File/Create/' >) >This script will run without showing up a dialog, and will even run if >no images are open in Gimp. Yeah. >Pip could work... No it won't. It's not included in Python 2.7.5, and I can't install it into GIMP's python because it's missing too much of the standard library. >Don' t speak to fast, and check the >/lib/gimp/2.0/interpreters/pygimp.interp file in the Gimp install >tree. >You can very likely switch to your own 2.7.x. Of course, you'll end up >writing scripts that only you can use :) How can words on a screen be spoken too fast? Did you read them too fast? -Anyway, no, I can't switch over to my own 2.7.X as the file can't be modified. The proper way to do that would be to replace GIMP's python.exe and pythonw.exe with links to the desired ones. Even if it's possible, I'm pretty sure it'd lose the all-important gimpfu module. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Custom Script UI
><https://mail.gnome.org/archives/gimp-user-list> >As you say TkInter isn't in the GIMP supplied Python (which is a pity >as it uses native file browsers instead of the GTK abomination), but >you can use PyGTK, which you should be able to understand quite >readily as you have TkInter experience. > >Here's a relatively simple PyGTK GIMP plug-in I wrote some time ago: >https://bitbucket.org/paynekj/paynekj-gimp-scripts/src/2e8e87faf5eaaf6036e0d8b68ff9f6f37a3f0421/plug-ins/pygtk_add_multiple_guides.py?at=default > >Kevin Ah, thanks. It does indeed remind me of TkInter. I should be able to reverse-engineer your example code to do some useful stuff. -Ideally, I use the os module for most of my file-browser-esque operations. Once I learn how to make more complex Kivy widgets, my current and future programs that use file explorers will likely use a hand-made solution instead of Kivy's default widget. When I made my first program (Used TkInter), making my own file explorer turned out pretty nicely. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Custom Script UI
>You have to use register(), but you can have an empty parameter list. >Then your plugin is called directly without the Gimp-built dialog. What, you mean with no "PF-XXX" parameters? Yeah, I got that much as I've made scripts with both no UI and the built-in UI before. I'm rather certain it still wants you to use their UI, though. Even if that's all it took, there's still the issue of gimp using a watered down Python 2.7.5, which I'm not sure how to add normal modules to. I assume Kivy's pretty much out of the question, but TkInter's normally built in to python, except with gimp a number of base modules, including TkInter, aren't present anymore. I already have python 3.4 and 2.7 installations on my pc, but it's unlikely they can be made relevant here. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list
[Gimp-user] Custom Script UI
I've been learning Python as a hobby for a while and can now write my own user interfaces in TkInter or the 3rd party Kivy. I'm trying to launch my own UI that can run Procedural Database plugins and whatnot, but I can't figure out how to create a GIMP python plugin without using the "Register(...)" command and it's built-in widgets. Any help on how to get started with this is appreciated. -- FierySwordswoman (via www.gimpusers.com/forums) ___ gimp-user-list mailing list List address:gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list