The time now is Fri 13 Dec 2019, 19:26
All times are UTC - 4 |
Page 33 of 99 [1478 Posts] |
Goto page: Previous 1, 2, 3, ..., 31, 32, 33, 34, 35, ..., 97, 98, 99 Next |
Author |
Message |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Thu 09 Jun 2011, 19:06 Post subject:
|
|
8-bit wrote: | I could not get the checkmark png images for yes and no found and as a result, the one example does not work for me. |
I've attached them to my post on the previous page
They are from the Elementary icon set.
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: Fri 10 Jun 2011, 12:04 Post subject:
|
|
thunor wrote: | 8-bit wrote: | I could not get the checkmark png images for yes and no found and as a result, the one example does not work for me. |
I've attached them to my post on the previous page
They are from the Elementary icon set. |
I had used some other png files to get it to work, but I downloaded the ones from your post and they work too.
I do have another question though.
I am running Lupu 520 and in doing a search for "yes", I came up empty handed.
So I assume those png files are not part of a standard puppy.
I had initially used ones from /usr/local/lib/X11/pixmaps.
I picked some that were close, copied them to the directory containing the toggle script, and renamed them to correspond with the names in the script.
One thing I did notice is that a toggle configuration file is written when toggle is run. But even if I have the no.png images displayed when I stop the script, they are not retained for the next time toggle is run.
It always starts with the yes.png images.
So what is that configuration file for?
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Fri 10 Jun 2011, 17:06 Post subject:
|
|
8-bit wrote: | One thing I did notice is that a toggle configuration file is written when toggle is run. But even if I have the no.png images displayed when I stop the script, they are not retained for the next time toggle is run.
It always starts with the yes.png images.
So what is that configuration file for? |
It's just an example for illustrative purposes which happens to default to yes.
The "configuration" file TOGGLE is necessary because if an exported shell variable were used instead, funcImageToggle would be able to change the exported variable but not the original variable resulting in the image not toggling. That's what you meant right? If so see this.
Replace
Code: | echo 0 > TOGGLE; funcImageToggle |
with
Code: | if [ ! -f TOGGLE ]; then echo 0 > TOGGLE; funcImageToggle; fi |
and you'll get the functionality you're expecting
Regards,
Thunor
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: Fri 10 Jun 2011, 19:29 Post subject:
|
|
Thank you for making things clear.
I already knew of how to get the script to use the configuration file on startup.
But while I am here, I will ask that the modded gtkdialog file I uploaded be checked out to see if everything works as expected.
I still have the modified source code files, I used gtkdilaog3-0.7.20-pe-1 for my source and added the patches I found in this thread.
So if I missed something or you would like me to upload the modified source in a tar.gz file yell.
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 8739 Location: qld
|
Posted: Fri 10 Jun 2011, 21:23 Post subject:
|
|
Ah thunor.. this is fun! I will write a revision of the clunky wallpaper setter soon.
8-bit.. your binary works just fine , I notice it's not stripped though, you can get it alot smaller with "strip --strip-unneeded"
Here is a spin on thunor's code that demos the pixmap refreshing capability: (notice how only one of the buttons refreshes the pixmap )
Code: | #!/bin/bash
function funcImageToggle() {
if [ $(< TOGGLE) = 1 ]; then
ln -sf no.png toggle.png
echo 0 > TOGGLE
else
ln -sf yes.png toggle.png
echo 1 > TOGGLE
fi
}
export -f funcImageToggle
echo 0 > TOGGLE; funcImageToggle
export MAIN_DIALOG='
<window title="btnImageToggle" resizable="false" width-request="300" height-request="100">
<vbox homogeneous="true">
<hbox homogeneous="true">
<pixmap>
<variable>TOGGLEPIX</variable>
<input file>toggle.png</input>
</pixmap>
<button>
<variable>TOGGLEME</variable>
<input file>toggle.png</input>
<label>"Toggle Me!"</label>
<action>funcImageToggle</action>
<action type="refresh">TOGGLEME</action>
<action type="refresh">TOGGLEMETOO</action>
<action type="refresh">TOGGLEPIX</action>
</button>
<button tooltip-text="Toggle me too!">
<variable>TOGGLEMETOO</variable>
<input file>toggle.png</input>
<action>funcImageToggle</action>
<action type="refresh">TOGGLEMETOO</action>
<action type="refresh">TOGGLEME</action>
</button>
</hbox>
</vbox>
<action signal="hide">exit:Exit</action>
</window>
'
gtkdialog4 --center --program=MAIN_DIALOG |
I took the liberty to make a combined patch of moose's and thunor's patches, (see attached), gunzip it and place it in the dir with the source dir and (patriot's source) and run: Code: | patch -p0 < gtkdialog_moose_thunor_pixmap.patch |
Have fun!
Description |
|

Download |
Filename |
gtkdialog_moose_thunor_pixmap.patch.gz |
Filesize |
1.19 KB |
Downloaded |
359 Time(s) |
_________________ Puppy Linux Blog - contact me for access
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 8739 Location: qld
|
Posted: Fri 10 Jun 2011, 21:59 Post subject:
|
|
Ok, this is the not so clunky SWS (simple-wallpaper-setter)
Thanks to thunor's patches to gtkdialog.
note, this depends on the gtkdialog4 executable posted by 8-bit, or roll your own with the patch above, name it "gtkdialog4" and pop it in /usr/sbin or /usr/bin
Description |
|
Filesize |
37.27 KB |
Viewed |
1148 Time(s) |

|
Description |
|

Download |
Filename |
sws-0.3exp.pet |
Filesize |
4.14 KB |
Downloaded |
368 Time(s) |
_________________ Puppy Linux Blog - contact me for access
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4872 Location: Blue Springs, MO
|
Posted: Fri 10 Jun 2011, 23:28 Post subject:
|
|
As long as it doesn't _remove_ or change existing functionality when compared to gtkdialog3, there is no need to bump the version number. ... perhaps a symlink or version file etc... (btw there is an operational difference between 2 & 3 that required a version bump)
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: Fri 10 Jun 2011, 23:42 Post subject:
|
|
For all concerned about my calling the patched gtkdialog 4, I was not actually bumping the version number.
Or at least I did not mean to.
It was a case of calling it what I did for testing purposes so as not to interfere with the gtkdialog3 file that was already on my PC.
As a matter of fact, I compiled it as gtkdialog3 and just renamed the executable for co-existence while testing it.
If you do not like it being called gtkdialog4, just rename it to gtkdialog3.
I hope I made myself clear as mud on that.
Also, since I have never used the strip option in compiling, and have no idea where or how to implement it, my compile was not stripped.
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 8739 Location: qld
|
Posted: Fri 10 Jun 2011, 23:57 Post subject:
|
|
Understood 8-bit and I was thinking along those lines too.
I'm going to put the exec in the next spup (as gtkdialog3) just to see if anything breaks, I don't think it will but you never know.
As a note, my patch does not include this from thunor (return ""; [in src/stringman.c]) .. as I understood his edit on the previous page took care of that. Please correct me if I'm wrong and I'll do another patch. Gtkdialog is not segfaulting for me if it doesn't find the image without that line.
BTW strip --strip-unneeded <name-of-exec> is all that's needed to strip in most cases. (learnt that from disciple a few years ago now )
_________________ Puppy Linux Blog - contact me for access
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: Sat 11 Jun 2011, 00:33 Post subject:
|
|
01micko,
Thank you for the strip command usage.
I tried it and it brought the gtkdialog4 executable from 371K to 123K.
And also, I did modify the source for the "return;" in my compile.
Also, nice work on the Simple Wallpaper Switcher!
And lastly, I lied! The name originally compiled to was just "gtkdialog".
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6995 Location: Auckland, New Zealand
|
Posted: Sat 11 Jun 2011, 01:31 Post subject:
|
|
Note that .so and .a files would normally be stripped before packaging too. If you strip these without the --strip-unneeded flag then it breaks them, but you can strip executables without --strip-unneeded... and they might even end up smaller.
_________________ Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3425 Location: Oregon
|
Posted: Sat 11 Jun 2011, 11:13 Post subject:
|
|
thunor opens the door!
With the changes made to gtkdialog3, and after seeing 01micko's Simple Wallpaper Switcher, one could design a package/application and call it something like "Picture This".
Feed it the name of a picture directory and display each picture in that directory.
For trying to find a specific picture that had some name given by a camera
it would come in handy.
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Sun 12 Jun 2011, 17:49 Post subject:
|
|
Here's some code to enable <pixmap> to be scaled (no need to use external command-line scalers anymore):
[EDIT] 20110618-22:01 Gtkdialog is now in a repository (see this post).
This is how it works:
By default the image will be loaded without constraint as per the norm (width will default to -1 and height -1).
If either <width> or <height> (or both) is set then "the image will be scaled to fit in the requested size, preserving the image's aspect ratio."
e.g.
<width>100</width><height>100</height>
<width>100</width> (equivalent to <width>100</width><height>-1</height>)
<height>100</height> (equivalent to <width>-1</width><height>100</height>)
I achieved this by replacing gtk_image_new/set_from_file() with gdk_pixbuf_new_from_file_at_size() and I recommend reading the link.
Last edited by thunor on Sat 18 Jun 2011, 16:58; edited 4 times in total
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 8739 Location: qld
|
Posted: Sun 12 Jun 2011, 18:28 Post subject:
|
|
thunor,
re my earlier post..
is the return ""; still needed in stringman.c?
TIA
_________________ Puppy Linux Blog - contact me for access
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Sun 12 Jun 2011, 19:09 Post subject:
|
|
01micko wrote: | thunor,
re my earlier post..
is the return ""; still needed in stringman.c?
TIA |
Yes. It is missing and a bug.
|
Back to top
|
|
 |
|
Page 33 of 99 [1478 Posts] |
Goto page: Previous 1, 2, 3, ..., 31, 32, 33, 34, 35, ..., 97, 98, 99 Next |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|