Programming karma

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Programming karma

#1 Post by Lobster »

been using dir2pet in Lucid 5.1 (from console) :)

Managed to create this which puts the files just above root
http://tmxxine.com/chant/cyberchant.pet
- a menu entry is added but not yet usable
. . . near enough

run xpupsay-1.2-i486.pet which should be in the above root dir/folder
restart x and the ganesh.sh should run (right click and change permissions if not working)

Now the puzzle . . .
Why does Ganesh only appear sometimes?
(I appreciate that he is a representation of the Universal Brahman
- but even so) :wink:
Maybe he does not appear at all for you and I am blessed?
Anyway need more Ganesh

Second problem is how to hit enter
in this bit of code
from the ganesh.sh
after adding a mantra number
(at the moment you click on OK once number added)

Code: Select all

# # # # # # # # # # # # # # #
function input_message()
# # # # # # # # # # # # # # #
{
Xdialog --title "INPUT BOX" --inputbox \
"How many mantras to recite?" 0 0 2> /tmp/inputbox.tmp.$$
retval=$?
input=`cat /tmp/inputbox.tmp.$$`
rm -f /tmp/inputbox.tmp.$$
case $retval in
0)
echo "Input string is '$input'";;
1)
echo "Cancel pressed.";;
255)
echo "Box closed.";;
esac
repetitions=$input
}
Can the code be improved?
- I just 'nabbed from net' and added/hacked . . .
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#2 Post by seaside »

Lobster,
Second problem is how to hit enter
in this bit of code
from the ganesh.sh
after adding a mantra number
(at the moment you click on OK once number added)
I'm not sure if xdialog can default with an enter key. Perhaps Gtkdialog would be ok as follows:

Code: Select all

#! /bin/bash

export DIALOG='
<window title="Mantras" icon-name="gtk-dialog-question">
  <vbox>
    <hbox>
      <text>
        <label>Mantra Recitals:</label>
      </text>
      <entry activates-default="true">
        <default>How Many ??</default>
	<variable>NUM</variable>
      </entry>
    </hbox>
    <hbox>
      <button cancel></button>
      <button can-default="true" has-default="true" use-stock="true" > 
        <label>gtk-ok</label>
   
      </button>
    </hbox>
  </vbox>
</window>
'
CHOICES=`gtkdialog3 --program=DIALOG`
eval $CHOICES
repetitions=$NUM
Must keep those musical apps healthy and well fed. :D

Regards,
s

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#3 Post by Lobster »

Perhaps Gtkdialog would be ok as follows:
I cut and pasted your solution Seaside
and it solved both problems :)

This is my sort of programming :wink:
Thank you so much :D

Interestingly you benefit and share in the merit of
any mantra recitations this inspires
In fact I will do extra as part of a challenge
http://imoveyou.com/

PS. and the code was more comprehensible to me
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#4 Post by Lobster »

I have updated the program here
http://www.murga-linux.com/puppy/viewto ... 208#445208

and it works great :)
but I would like to ensure that clicking in the close program
(x top left of initial dialog) does not start the program
but works the same as cancel

I would also like to have the ability to disable full screen mode
which is here in the code

Code: Select all

#if [ "gtk-fullscreen" = "1" ]
#then
#echo true
#fi
#else echo false
but frankly I have not a clue what I am meant to be doing
any help offered is welcome :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

Post Reply