It is currently Thu Apr 18, 2024 11:51 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 16 posts ] 
Author Message
 Post subject: alt-drag and non-scrolling plugins
PostPosted: Thu Feb 25, 2016 5:07 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
One of My landlord's kids started using The GIMP the other day on a school provided netbook. Prior to trying to help Him with his project I never much thought about the fact that python plugins (unless written with a custom UI) do not scroll. Being a Linux user, Alt-Drag always worked just fine for me. But it did not for him. Thus I tackled gimpfu.

This is a drop in replacement for gimpfu, in fact it IS gimpfu with 6 new lines of code, and one line changed. (The curious can see the end of this post.)

Using this all python plugins begin with a size of 50% of your screen height, and a width equal to the data displayed + 44 pixels. The width won't be right on all machines however, as different operating systems and themes display scrollbars at different widths. None-the-less, almost all of the horizontal distance will be visible from the start, thus rendering any plugin usable from the get go without having to resize the window. (Although it can be fully resized if you choose to.) The "data entry" area of the plugin will scroll as needed using a traditional scroll bar. (If someone using the standard windows theme could give me a clue how much more width is needed, I can update this. Ditto for Macs)

Installing this plugin is a little different. It will work just fine installed into the standard user plugins folder (see next paragraph), but should be installed in place of the system version. On linux mint 17.1 this is at /usr/lib/gimp/2.0/python so probably the same for Ubuntu and other Debian derivatives as well. I'm not sure of this location on windows and macs. On linux the permissions need to be 644 (u+rw-x, g+r-wx, o+r-wx) with owner typically set to root:root.

A side note for those of you who run gimp from a command line. If it is installed to a user plugin folder, the following non-fatal errors will appear during gimp start up:
Querying plug-in: '/home/<user_name>/.gimp-2.8/plug-ins/gimpfu.py'

(gimp:26548): LibGimpBase-WARNING **: gimp: gimp_wire_read(): error
Terminating plug-in: '/home/<user_name>/.gimp-2.8/plug-ins/gimpfu.py'
This is completely ignorable, and is because GIMP is trying to import it as a plugin, and failing. Remember, this isn't an actual plugin, but a file to import into a plugin. Having it in this folder means it will override the one in the system folder, as it will be found first from within python during imports.

As for what changed, well changes were made in 2 spots, the first began as (line numbers added)
699 vbox = gtk.VBox(False, 12)
700 vbox.set_border_width(12)
701 dialog.vbox.pack_start(vbox)
702 vbox.show()
and then became:
699 vbox = gtk.VBox(False, 12)
700 vbox.set_border_width(12)
701 swin = gtk.ScrolledWindow()  # New line
702 swin.add_with_viewport(vbox)  # New Line
703 dialog.vbox.pack_start(swin)  # This is the only changed line.
704 vbox.show()
705 swin.show()  # New Line

The second spot for changes was:
802 #    progress_label.show()
803
804 dialog.show()
became:
806 #    progress_label.show()
807
808 min_height = gtk.gdk.screen_height() / 2  # New Line
809 min_width, __  = table.size_request()  # New Line
810 dialog.set_default_size(min_width + 44, min_height)  # New Line
811
812 dialog.show()

If anyone wants to make it be a wider starting size, simply change the "+ 44" on line 810 to a bigger number.


Attachments:
File comment: Right one this time!
corrected-gimpfu.py.zip [7.3 KiB]
Downloaded 653 times

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Last edited by jazzon on Thu Feb 25, 2016 10:50 am, edited 1 time in total.
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Thu Feb 25, 2016 6:02 am  (#2) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13006
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
This only affect the python plugins dialog, is this correct?

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Thu Feb 25, 2016 7:47 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2240
Location: Poland
I think a mistake in annex (not the new file) ?


Attachments:
New gimpfu .png
New gimpfu .png [ 13.99 KiB | Viewed 8721 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Thu Feb 25, 2016 8:04 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2240
Location: Poland
After making changes works well.
A great solution - it lacked me this.
Thanks Jazzon.


Attachments:
after changes.png
after changes.png [ 29.33 KiB | Viewed 8717 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Thu Feb 25, 2016 9:52 am  (#5) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4735
Python authors who make UIs that require scrolling should be taken out and shot(*). The script-fu authors have an excuse because they cannot do anything else to get parameters, but in Python you can use pyGTK to make more sensible UIs if needed.

(*) or sentenced to 6 months of Scheme coding, but given the choice...

_________________
Image


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Thu Feb 25, 2016 10:45 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
ofnuts: I'll take shot .... and if schemers are the shooters, I'd like a blindfold...

Wallace: correct. The only changes made create the scroll effect, and only for python coded plugins.

MareroQ: Glad You like it! (Even You had to hand code it....) :oops:

CRAP! I zipped the wrong one! :oops: File in post one corrected to the NEW version

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Thu Feb 25, 2016 12:29 pm  (#7) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13006
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
jazzon wrote:
Wallace: correct. The only changes made create the scroll effect, and only for python coded plugins.


:coolthup

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Sat Jul 28, 2018 3:34 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Aug 08, 2016
Posts: 1980
Location: East Midlands of England
I thought that I would add an updated version of gimpfu for Gimp 2.10 users in case anyone else needs a scrolling dialog for any over-large python plug-in interfaces. The Gimp 2.8 version will display the filter dialog but it will not work when used in 2.10. This version has worked with all (Windows tested only I am afraid) versions so far.

Attachment:
gimpfu_original_2pt10_ammended.zip [7.66 KiB]
Downloaded 308 times


If you have a portable version of Gimp 2.10 the location of the gimpfu file will depend on where you saved the portable. If you open the folder you should be able to click on the folders within to reach find the gimpfu and replace it using the instructions given below.

For Partha portables (substitute the 2.10.2 with whatever version number you have) it will probably be in something like:

Partha 2.10.2\Gimp-2.10\gimp\lib\gimp\2.0\python

For SamJ's versions there may be two optional locations to try (depending on 32 or 64 bit systems I assume). Once again find where your portable has been put and open the folders to drill down to the correct one. Either;

Gimp-2.10_Portable\lib\gimp\2.0\python

or

Gimp-2.10_Portable\32\lib\gimp\2.0\python

In my full version of Gimp 2.10.4, from gimp.org, the location I use is:

C:\Program Files\GIMP 2\32\lib\gimp\2.0\python

To copy and rename folders in this location you will need to provide/confirm Administrator priviledges when queried.

Instructions for replacing Gimpfu

Download and unzip the python file.

Copy my version (gimpfu_original_2pt10_ammended) into the same folder.
Rename the original gimpfu to something else (just in case) e.g. gimpfu_old.
Now rename my version as gimpfu.

You should now be good to go.

_________________
Image

"Let no one steal your dreams."
Paul Cookson


Latest plug-in update: Paragrapher v.1.4
Custom Font Links
Tools
Character Paths
White Bases


Last edited by Skinnyhouse on Sat Jul 28, 2018 6:57 am, edited 2 times in total.

Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Sat Jul 28, 2018 6:19 am  (#9) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4735
I'm sorry, but this sucks. Gimp is open source, but open source has rules. Gimp is licensed under the GPL, and by redistributing the code you agree to abide to the GPL requirements, and a key one is that if you make a derivative version, you must clearly identify it as your version:

To cite the GPL3 licence:

Quote:
5. Conveying Modified Source Versions.

You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:

a) The work must carry prominent notices stating that you modified it, and giving a relevant date.


and I don't see anything like this in the code your provide.

_________________
Image


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Sat Jul 28, 2018 6:46 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Aug 08, 2016
Posts: 1980
Location: East Midlands of England
Thank you Ofnuts for pointing this out. And I am more than very happy to comply with this - I shall add the required information at once and edit the post.

_________________
Image

"Let no one steal your dreams."
Paul Cookson


Latest plug-in update: Paragrapher v.1.4
Custom Font Links
Tools
Character Paths
White Bases


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Sat Jul 28, 2018 9:00 am  (#11) 
Offline
GimpChat Member

Joined: Oct 30, 2016
Posts: 145
Skinnyhouse wrote:
Thank you Ofnuts for pointing this out. And I am more than very happy to comply with this - I shall add the required information at once and edit the post.

A courteous response Skinnyhouse, to a less than courteous post.


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Sun Jul 29, 2018 5:01 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: Aug 08, 2016
Posts: 1980
Location: East Midlands of England
Thank you for your kind words TL.

I do think that Ofnuts has a number of extremely useful points to make in his follow up post and I value both his input and insight as a professional programmer. I have, personally, learnt a lot from his work and it must be extremely frustrating for him to witness the efforts of those, like myself, who battle with bits of code in order to get something working in Gimp.

I have to admit that I knew very little about licenses and stuff before this (obviously my own responsibility) and now I can understand the importance of documenting ownership, dating versions and modifications etc – hence the benefits of having someone around who works in the industry and to whom these things are so blindingly obvious.

I know that there is some information on script writing resources pinned to the ‘Gimp Scripts and Plugins’ section but perhaps some information about licences and modifications and their value could also be pinned there too. It might help others motivated to help fellow members in this time of transition from Gimp 2.8 to Gimp 2.10.

_________________
Image

"Let no one steal your dreams."
Paul Cookson


Latest plug-in update: Paragrapher v.1.4
Custom Font Links
Tools
Character Paths
White Bases


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Mon May 20, 2019 2:57 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Jul 06, 2013
Posts: 2605
Location: California
It is possible to change the theme of the scrolling interface to go with the gimp theme? I am using Gimp 2.10.10 Windows 64 Bit. I downloaded gimp from gimp.org

My Theme:
Image

The Python Scrolling Interface:
Image

I also tried Skinnyhouse's version of the gimpfu ammeded scrollbar and it crashed right away. I went back to jazzon's script. It works.. just not feeling the theme color since it doesn't match the theme I use.


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Tue May 21, 2019 12:19 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Jul 06, 2013
Posts: 2605
Location: California
MareroQ wrote:
After making changes works well.
A great solution - it lacked me this.
Thanks Jazzon.


It is possible for us to use the one that you made changes to, MareroQ?

Also is it possible to change the color in order for it to match the theme you're using? I'm using gimp 2.10.10 which I downloaded from gimp.org. OS I'm using is Windows 10 64 Bit.

My Theme:
Image

Plugin Theme:
Image


Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Tue May 21, 2019 1:42 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2240
Location: Poland
Hi Mackenzieh.

The case with the scroll bar has been a bit complicated (different python versions) but the Jazzon recipe is still valid.
It is not complicated after all.
Copy the gimpfu.py file to a safe place and edit the original file (preferably in Notepad ++ 7.6.6:
https://notepad-plus-plus.org/download/v7.6.6.html ).
according to post # 1 (just look for spaces in the code's text).
Another (worse) option is to try the attached file (but without a guarantee of operation on your system - in my for Gimp 2.10 32bit works very well).


Attachments:
gimpfu-2.10.10.zip [7.67 KiB]
Downloaded 159 times

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: alt-drag and non-scrolling plugins
PostPosted: Tue May 21, 2019 2:01 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: Jul 06, 2013
Posts: 2605
Location: California
MareroQ wrote:
Hi Mackenzieh.

The case with the scroll bar has been a bit complicated (different python versions) but the Jazzon recipe is still valid.
It is not complicated after all.
Copy the gimpfu.py file to a safe place and edit the original file (preferably in Notepad ++ 7.6.6:
https://notepad-plus-plus.org/download/v7.6.6.html ).
according to post # 1 (just look for spaces in the code's text).
Another (worse) option is to try the attached file (but without a guarantee of operation on your system - in my for Gimp 2.10 32bit works very well).

I will try the file first. I am not a coder but I will try it if the file doesn't go well. I have Gimp 2.10.10, Windows 10.. 64 bit.

Edit:
It works with all themes:
Dark:
Image
Gray:
Image
Light:
Image
System:
Image

I'm not sure if it works for themes other than the ones installed, but my guess is, it should.


Top
Post new topic Reply to topic  [ 16 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Drag & Drop

14

No new posts Attachment(s) SCROLLING INTERFACE HELP

2

No new posts Scrolling fish.

7

No new posts Attachment(s) SCROLLING SCRIPT-FU dialog modification

9

No new posts Attachment(s) Script-Fu Scrolling Interface For GIMP 2.10.10_Win32bit

0


cron

* Login  



Powered by phpBB3 © phpBB Group