The time now is Fri 20 Apr 2018, 07:14
All times are UTC - 4 |
Page 50 of 85 [1265 Posts] |
Goto page: Previous 1, 2, 3, ..., 48, 49, 50, 51, 52, ..., 83, 84, 85 Next |
Author |
Message |
don570

Joined: 10 Mar 2010 Posts: 4985 Location: Ontario
|
Posted: Wed 06 Mar 2013, 21:27 Post subject:
vary the width opf combobox |
|
I've discovered how to vary the width of the combobox at
the time of launch of the script.
A practical example is Bulldog finder, which widens up
when it is launched with a folder path as an argument $1
As an example I change the width based on whether my app has an
argument $1
Code: | export WIDTH=240
[ -z "$1" ] && WIDTH=150] |
then while building the combobox
Code: | <combobox case-sensitive="false" value-in-list="true" width-request="'$WIDTH'"> |
.
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Fri 15 Mar 2013, 15:48 Post subject:
DYCP Effect |
|
Ah, the good old C64 times...
Does anyone remember DYCP (Different Y Character Position) effect?
It seems that Bash+Gtkdialog+SVG are powerful enough for that - here's an example (save it with .sh extension or else ROX will identify it as .svg file):
Code: | #!/bin/bash
# DYCP example by SFR'2013
export SINUS=/dev/shm/sinus_table
[ -e $SINUS ] && rm $SINUS
# Create sinus table
for i in {0..63}; do
RAD=`echo "$i*(3.14/32)" | bc -l`
VAL=`echo "s($RAD) * 48 + 72" | bc -l`
echo ${VAL/.*} >> $SINUS
done
dycp () {
SIN=( `cat $SINUS` )
echo '<svg width="256" height="128" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<text font-family="Monospace" font-size="32" font-weight="bold">
<tspan x="10" y="'${SIN[0]}'">P</tspan>
<tspan x="30" y="'${SIN[2]}'">U</tspan>
<tspan x="50" y="'${SIN[4]}'">P</tspan>
<tspan x="70" y="'${SIN[6]}'">P</tspan>
<tspan x="90" y="'${SIN[8]}'">Y</tspan>
<tspan x="130" y="'${SIN[12]}'">L</tspan>
<tspan x="150" y="'${SIN[14]}'">I</tspan>
<tspan x="170" y="'${SIN[16]}'">N</tspan>
<tspan x="190" y="'${SIN[18]}'">U</tspan>
<tspan x="210" y="'${SIN[20]}'">X</tspan>
<tspan x="230" y="'${SIN[22]}'">!</tspan>
</text>
</svg>' > /dev/shm/dycp_pic.svg
# Shift array right
echo ${SIN[63]} ${SIN[@]:0:63} > $SINUS
}
export -f dycp && dycp
export MAIN='
<window title="DYCP">
<vbox>
<pixmap>
<variable>PICTURE</variable>
<input file>/dev/shm/dycp_pic.svg</input>
</pixmap>
<button ok></button>
<timer visible="false" milliseconds="true" interval="50">
<action>dycp</action>
<action>refresh:PICTURE</action>
</timer>
</vbox>
</window>
'
gtkdialog -cp MAIN |
Of course it's rather pointless (and resource hungry), but personally I love such things!
_________________
EDIT: Ok, I wouldn't be myself if I wouldn't go further - here's DYCP-Scroller:
Code: | #!/bin/bash
# DYCP Scroll by SFR'2013
export TEXT=" Hey! This is probably the very first DYCP-Scroller for Puppy Linux. ;) Greetings!"
TEMPDIR=/dev/shm/dycp_scroll_$$
mkdir $TEMPDIR
trap 'rm -rf $TEMPDIR' EXIT
export PIC=$TEMPDIR/pic.svg
export SINUS=$TEMPDIR/sinus_table
export X_POS=$TEMPDIR/dycp_x
export TEXT_POS=$TEMPDIR/text_position
echo 0 > $X_POS
echo 0 > $TEXT_POS
# Create sinus table
for i in {0..63}; do
RAD=`echo "$i*(3.14/32)" | bc -l`
VAL=`echo "s($RAD) * 48 + 72" | bc -l`
echo ${VAL/.*} >> $SINUS
done
dycp () {
SIN=( `cat $SINUS` )
read X < $X_POS
read POS < $TEXT_POS
echo '<svg width="256" height="128" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<text font-family="Monospace" font-size="32" font-weight="bold">
<tspan x="'$((10-$X))'" y="'${SIN[0]}'">'${TEXT:$POS:1}'</tspan>
<tspan x="'$((30-$X))'" y="'${SIN[2]}'">'${TEXT:$(($POS+1)):1}'</tspan>
<tspan x="'$((50-$X))'" y="'${SIN[4]}'">'${TEXT:$(($POS+2)):1}'</tspan>
<tspan x="'$((70-$X))'" y="'${SIN[6]}'">'${TEXT:$(($POS+3)):1}'</tspan>
<tspan x="'$((90-$X))'" y="'${SIN[8]}'">'${TEXT:$(($POS+4)):1}'</tspan>
<tspan x="'$((110-$X))'" y="'${SIN[10]}'">'${TEXT:$(($POS+5)):1}'</tspan>
<tspan x="'$((130-$X))'" y="'${SIN[12]}'">'${TEXT:$(($POS+6)):1}'</tspan>
<tspan x="'$((150-$X))'" y="'${SIN[14]}'">'${TEXT:$(($POS+7)):1}'</tspan>
<tspan x="'$((170-$X))'" y="'${SIN[16]}'">'${TEXT:$(($POS+8)):1}'</tspan>
<tspan x="'$((190-$X))'" y="'${SIN[18]}'">'${TEXT:$(($POS+9)):1}'</tspan>
<tspan x="'$((210-$X))'" y="'${SIN[20]}'">'${TEXT:$(($POS+10)):1}'</tspan>
<tspan x="'$((230-$X))'" y="'${SIN[22]}'">'${TEXT:$(($POS+11)):1}'</tspan>
<tspan x="'$((250-$X))'" y="'${SIN[24]}'">'${TEXT:$(($POS+12)):1}'</tspan>
</text>
</svg>' > $PIC
X=$(($X+2))
if [ $X = 20 ]; then
X=0
POS=$(($POS+1)); [ $POS -gt ${#TEXT} ] && POS=0
echo ${SIN[@]:1:63} ${SIN[0]} > $SINUS
else
echo ${SIN[63]} ${SIN[@]:0:63} > $SINUS
fi
echo $X > $X_POS
echo $POS > $TEXT_POS
}
export -f dycp && dycp
export MAIN='
<window title="DYCP Scroller">
<vbox>
<pixmap>
<variable>PICTURE</variable>
<input file>'$PIC'</input>
</pixmap>
<button ok></button>
<timer visible="false" milliseconds="true" interval="50">
<action>dycp</action>
<action>refresh:PICTURE</action>
</timer>
</vbox>
</window>
'
gtkdialog -cp MAIN |
Have fun & Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6541 Location: Valåmoen, Norway
|
Posted: Fri 15 Mar 2013, 18:53 Post subject:
|
|
like it
The days of C64 were sure wonderful. The coding wasn't meant to be useful - only cool.
Thank you for sharing
Sigmund
_________________ Stardust resources
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Sun 17 Mar 2013, 12:02 Post subject:
|
|
Dear SFR,
That was an impressive bit of coding. I ported it to BaCon, with a few mods to reduce file reads/writes, and it works nicely. Thanks. Now to find a good use for this lovely routine
With kind regards,
vovchik
http://www.murga-linux.com/puppy/viewtopic.php?p=692604#692604
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Sun 17 Mar 2013, 17:29 Post subject:
|
|
Thanks guys!
I guess I also miss the old days, because computers' capabilities were very limited and there was a challenge - to crush those limits!
For instance - see how amazing gfx can still be created in ancient 320x256x32 (my_jaw_dropped).
[sorry for being a bit off-topic]
@Vovchik - Bacon version works OOTB on Slacko, no recompiling needed; nice work!
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Wed 20 Mar 2013, 12:24 Post subject:
|
|
@SFR: Awesome work
I'd like to add those to the gtkdialog repository so is it okay and what is the licence? GPL2 would be good.
Regards,
Thunor
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Wed 20 Mar 2013, 13:03 Post subject:
|
|
Thanks
Sure, and GPL2 is fine.
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
brokenman
Joined: 20 Oct 2011 Posts: 25
|
Posted: Wed 20 Mar 2013, 22:55 Post subject:
Always on top or underneath Subject description: Launch app condition |
|
I cut my teeth on a C64. I remember the 20min load times from an external cassette reader for some games like ghost busters. Good times.
I'd like to know if it is possible to launch a gtkdialog app and have it always underneath all other apps, as opposed to always on top? I mean to say if i click the gtkdialog app it will not come to the front but remain at the back under all other apps on the desktop layer. The app is a desklet type thing that i want to remain on the desktop.
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 8670 Location: qld
|
Posted: Thu 21 Mar 2013, 02:17 Post subject:
|
|
Hello brokenman
maybe try gtkdesklets by akash_rawal, supports transparency too. Ah..but you've been there! Did it not work?
There is code earlier in that thread that I used with raw gtkdialog, I wrote a weather widget , broken now of course due to the change in the sites html, but nevertheless may give you an idea
http://murga-linux.com/puppy/viewtopic.php?p=598629#598629.. plus even earlier there is a basic RAM widget. I got bored with widgets though after that!
_________________ Puppy Linux Blog - contact me for access
|
Back to top
|
|
 |
brokenman
Joined: 20 Oct 2011 Posts: 25
|
Posted: Fri 22 Mar 2013, 22:47 Post subject:
|
|
Thanks very much. Your gtkdesklet seems to remain on the desktop layer and doesn't come to the front when clicked which is exactly what i need! Now i just need to scour your code to see what makes it stay there. I am using the gtkdesklet applet but my applet doesn't behave in the manner i want (staying in background).
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Sun 24 Mar 2013, 08:42 Post subject:
|
|
Dear SFR,
I re-did one of your wave examples only to use markup - no svgs - and obtain the same wave effect using the little-used span markup command "rise". It gives you a y-axis displacement in "pango" units. I also use the span attrobute "letter_spacing" for the x axis (in 1024th of a point). My code is attached.
With kind regards,
vovchik
Description |
|

Download |
Filename |
bmw-markup-demo.tar.gz |
Filesize |
21.69 KB |
Downloaded |
370 Time(s) |
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Sun 24 Mar 2013, 14:37 Post subject:
|
|
Hey Vovchik
Thanks for the tip, I had no idea about this 'rise' attribute.
And, what's most important, it works also in Gtkdialog:
Code: | #!/bin/bash
# DYCP 2 by SFR'2013
# Uses Vovchik's tip: markup "rise" attribute instead of svg
# GPL v2 applies
TEMPDIR=/dev/shm/dycp_$$
mkdir $TEMPDIR
trap 'rm -rf $TEMPDIR' EXIT
export SINUS=$TEMPDIR/sinus_table
# Create sinus table
for i in {0..63}; do
RAD=`echo "$i*(3.14/64)" | bc -l`
SIN[$i]=$(printf "%.0f" $(echo "((s($RAD)*100)+10)*1024" | bc -l))
done
echo ${SIN[@]} > $SINUS
# -----------------------------------------------------------------------------
dycp () {
TEXT="DYCP using 'rise' attribute."
SIN=( $(<$SINUS) )
echo -n '<span font="Monospace bold 36" color="black">'
for i in `seq 0 $((${#TEXT}-1))`; do
echo -n '<span rise="'${SIN[$(( ($i*3)&63 ))]}'">'${TEXT:$i:1}'</span>'
done
echo -n '</span>'
echo ${SIN[63]} ${SIN[@]:0:63} > $SINUS
}
export -f dycp
export MAIN='
<window title="DYCP" height-request="256" allow-grow="false">
<text use-markup="true" wrap="false">
<variable>DYCP</variable>
<input>dycp</input>
</text>
<timer visible="false" milliseconds="true" interval="50">
<action>refresh:DYCP</action>
</timer>
<action signal="hide">exit:abort</action>
</window>
'
gtkdialog -cp MAIN |
___________
PS. In .tgz below there's a couple of other old effects ported to Bash/Gtkdialog (same 'svg+refresh' technique, so nothing original really ).
Greetings!
Description |
|

Download |
Filename |
some_old_effects.tar.gz |
Filesize |
4.1 KB |
Downloaded |
348 Time(s) |
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Last edited by SFR on Mon 01 Apr 2013, 17:13; edited 2 times in total
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Sun 24 Mar 2013, 14:52 Post subject:
|
|
Dear5 SFR,
Nice job. I honestly didn't know about the "rise" attribute either, until recently, and then thought it might just work. Your code is tiny, which is very nice. Too bad that <span> doesn't have an x-axis attribute like "shift". Then we could control the entire space in both directions.
With kind regards,
vovchik
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Sun 24 Mar 2013, 15:25 Post subject:
|
|
Dear SFR,
The archive contains great stuff by you. I will try to port those demos. Have a problem with interference.sh, but I will try to figure out why.
With kind regards,
vovchik
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Sun 24 Mar 2013, 15:53 Post subject:
|
|
Oops, I think I know what kind of problems.
I forgot that in Gtkdialog-0.8.0 (you're still on Lupu, right?) in some cases closing the window through upper-right X won't terminate gtkdialog process...
So most likely my scripts just jammed your CPU (sorry about that ).
Ok, I reuploaded corrected scripts, with added:
Code: | <action signal="hide">exit:abort</action> |
line, which should prevent the problem.
Sorry again &
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
|
Page 50 of 85 [1265 Posts] |
Goto page: Previous 1, 2, 3, ..., 48, 49, 50, 51, 52, ..., 83, 84, 85 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
|