Page 1 of 1

ptooltips 0.2

Posted: Thu 30 Jul 2009, 13:56
by zigbert
Ptooltips
With this simple script you can add tooltips to your gtkdialog (or any other code).

syntax: ptooltips "your tooltip text"

It uses yaf-splash for gui, and getcurpos to return mouse position. Yaf-splash is already in your Puppy, while getcurpos (2kb) only exist in the upcoming Puppy 4.3 and Puppy 5.

Download
username: puppy
password: linux

ptooltips-0.2 (1 kb)

Image

Sigmund Berglund

Posted: Thu 30 Jul 2009, 14:02
by trio
Hmm,

So, this is what you up to :lol: Asking about a command to tell the cursor location

Posted: Thu 30 Jul 2009, 15:58
by zigbert
Example code:

Code: Select all

#!/bin/bash
export test_app="
  <button>
    <input file stock=\"gtk-yes\"></input>
    <action signal=\"enter\">ptooltips \"Let's test tooltips\" &</action>
    <action signal=\"leave\">ptooltips -end &</action>
  </button>"
gtkdialog3 --program=test_app

Posted: Fri 31 Jul 2009, 03:41
by 01micko
Hello Sigmund

Well I got it to work with pcdlite ... but.... how can I force it to display more lines? It is a limitation of ptooltips? If so, how can I hack it?

I like it! :)

Mick

Posted: Fri 31 Jul 2009, 20:20
by zigbert
Hello Mick
This is how you solve it.
Be aware that a tooltips containing many lines, might get out of screen area. The tooltips-placement-function doesn't like more than 3-4 lines (I think).

Code: Select all

#!/bin/bash
export TXT="Are
you
sure?"

export script='
 <vbox>
  <text><label>Are you sure?</label></text>
  <hbox>
   <button no></button>
   <button yes>
     <action signal="enter">ptooltips "$TXT" &</action>
     <action signal="leave">ptooltips -end &</action>
     <action>EXIT:sure</action>
   </button>
  </hbox>
 </vbox>
</window>'

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog3 --program=script); do
   eval $STATEMENTS
done
IFS=$I

[ $EXIT = sure ] && gxmessage 'You are sure' 

Posted: Fri 31 Jul 2009, 21:23
by BarryK
zigbert,
Just to let you know, your Ptooltips is a great innovation and this is definitely going to be in 4.3beta!

Posted: Sat 01 Aug 2009, 00:31
by 01micko
Thanks Sigmund

Turns out ptooltips is not the right tool for what I was looking. :) . Still put it to good use though.

Mick

Posted: Sat 01 Aug 2009, 15:59
by zigbert
Version 0.2

After using it 1 day, I have upgraded to a less irritating edition. :)

Posted: Mon 03 Aug 2009, 06:39
by disciple
You almost need a mailing list or something to announce all your new creations :)

Posted: Wed 05 Aug 2009, 07:02
by zigbert
Ptooltips had a short life.
Potong has showed us that tooltips ARE supported by gtkdialog.

Try his script and be amazed.

Code: Select all

#!/bin/bash
a_function()
{
echo "you pressed ${1}"
}
b_function()
{
echo "you pressed ${1}=${!1}"
}

# variables to be exported
export BUTTON1="_plain tooltip" BUTTON2="_markup tooltip"
# functions can be exported too!
export -f a_function b_function

export GUI="
<window title=\"Tooltip Test\" window-position=\"1\">
<vbox>
<button use-underline=\"true\" label=\"$BUTTON1\" tooltip-text=\" press alt p \" xalign=\"0.3\" yalign=\"0.7\" width-request=\"100\" height-request=\"200\">
<action signal=\"clicked\">a_function BUTTON1</action>
</button>
<button use-underline=\"true\" tooltip-markup=\"<span background='yellow'><b> press alt m </b></span>\">
<label>$BUTTON2</label>
<action signal=\"map-event\">echo \"this button was mapped before it was clicked\"</action>
<action signal=\"clicked\">b_function BUTTON2</action>
</button>
<button use-underline=\"true\" has_focus=\"true\" use-stock=\"true\" label=\"gtk-cancel\" tooltip-text=\" press alt c or enter to close \"></button>
<frame frames can only have text Sad>
<text use-underline=\"true\" use-markup=\"true\" label=\"<span foreground='blue'><b>N.B.</b> _labels <i>can have tooltips</i> <u>too!...but no actions Sad)</u></span>\" tooltip-text=\" press alt l\">
</text>
</frame>
</vbox>
</window>
" 
gtkdialog3 -d -p GUI 

Posted: Wed 05 Aug 2009, 07:49
by disciple

Code: Select all

gtkdialog3 -d -p GUI 
Plus this as well.

I was going to say it would be better to make gtkdialog do tooltips itself :)
I wonder what other hidden features there are...

Posted: Wed 05 Aug 2009, 09:28
by zigbert
Plus this as well.
Thank you

Posted: Wed 05 Aug 2009, 13:03
by trio
HOLY WOW!!!!!

Please anybody can find a really complete guide of gtk-dialog!!!! Many hidden features there may be .......

Posted: Wed 05 Aug 2009, 19:49
by vovchik
Dear trio,

I posted a French;language guide to gtkdialog with a lot of nice examples. Please search the forum and you will find it, with me as author of the post.

With kind regards,
vovchik