GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#741 Post by thunor »

@SFR: Awesome work :D

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

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#742 Post by SFR »

Thanks :D
Sure, and GPL2 is fine.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

brokenman
Posts: 25
Joined: Thu 20 Oct 2011, 23:00

Always on top or underneath

#743 Post by brokenman »

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.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#744 Post by 01micko »

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. ... 629#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

brokenman
Posts: 25
Joined: Thu 20 Oct 2011, 23:00

#745 Post by brokenman »

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).

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#746 Post by vovchik »

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
Attachments
bmw-markup-demo.tar.gz
(21.69 KiB) Downloaded 554 times

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#747 Post by SFR »

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: Select all

#!/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 :wink: ).

Greetings!
Attachments
some_old_effects.tar.gz
(4.1 KiB) Downloaded 548 times
Last edited by SFR on Mon 01 Apr 2013, 21:13, edited 2 times in total.
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#748 Post by vovchik »

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

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#749 Post by vovchik »

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

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#750 Post by SFR »

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 :oops: ).
Ok, I reuploaded corrected scripts, with added:

Code: Select all

<action signal="hide">exit:abort</action>
line, which should prevent the problem.

Sorry again &
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#751 Post by vovchik »

Dear SFR,

Many thanks, but it doesn't seem to be a gtkdialog problem. I am using thunor's latest - compiled on my machine:

Code: Select all

gtkdialog version 0.8.4 r503M
And I have all the other dependencies: bc, rsvg*. And my bash is relatively new. And everything works except for interference.sh. I am scratching my head a bit, but something will occur to me eventually. I had a similar problem in programming a chess front end a few days ago. I dimensioned two arrays from 0 to 15 to hold chess figures and, in my stupidity, wrote DECLARE xx[15], yy[15]. After hours scouring the code, it occurred to me that the arrays should be [16] in size, with indexes starting at 0 :(

With kind regards,
vovchik

PS. I am using Lucid - but very modified...upgraded and enhanced

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#752 Post by vovchik »

Dear SFR,

Here are two BaCon versions of your very nice cube demo. I had to modify the bacon source because of nesting limitations in one of my versions, but both attached binaries will run just fine. And the mod to BaCon is pretty trivial and explained in the source. There is very little CPU use.

Thanks for the great stuff.

With kind regards,
vovchik
Attachments
vector_cube.tar.gz
(39.16 KiB) Downloaded 511 times

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#753 Post by SFR »

Cool, thanks! :)
Precalculating sin/cos tables is instant now.

BTW, have you found out what's wrong with interference, because I tried it in Lupu (VBox) and works ok for me. :?

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#754 Post by thunor »

@SFR

Is there a gtkdialog version of your cube demo?

I'm just committing your programs now and I was seeing if there were any more.

Regards,
Thunor

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#755 Post by SFR »

Hey Thunor

Yes, a few post above, in attached tgz (I just re-uploaded it again, because vector.sh was creating some tempfiles in / instead of /dev/shm/.... Corrected now.)
http://murga-linux.com/puppy/viewtopic. ... 355#694355

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#756 Post by vovchik »

Dear SFR,

I managed in BaCon to eliminate all disk reads and writes for your examples, which is hard to do with bash because you can't just call librsvg or gtk_image_set_from_pixbuf directly. :(

Works nicely and is modest in terms of CPU use.

With kind regards,
vovchik
Attachments
wavy-inline.tar.gz
(44.34 KiB) Downloaded 504 times

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#757 Post by SFR »

Hey Vovchik

I tried to re-compile both sources and got:

Code: Select all

# bacon bmrw-inline.bac 
Converting 'bmrw-inline.bac'... done.
Compiling 'bmrw-inline.bac'... Compiler emits messages!
#
hug.bac is in place already, so I guess I also need to pass some additional argument(s)..?
Any tip? :wink:

Thanks & Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#758 Post by vovchik »

Dear SFR,

I used the latest bacon 2.0 - released on 1 April - and the latest HUG 0.84. They are both available at http://www.basic-converter.org/. I just recompiled and everything works fine. I take it you have librsvg, since it's needed to transform the svgs into pixbufs. Thunor could, if he wished, make gtk_image_set_from_pixbuf available in gtkdialog, but then he would have to contend with an additional dependent functions in libsrvg, which is probably a bad idea.

If you are using the latest BaCon and latest HUG, the thing should compile without any errors. :)

With kind regards,
vovchik


PS. I used GTK2. I don't know how all of this would work with GTK3.

PPS. My compile line is:

Code: Select all

bacon -o -s -o -Os -o -fdata-sections -o -ffunction-sections -o -Wl,--gc-sections "$myfile"

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#759 Post by SFR »

Oh yes, so probably BaCon version 1.0 build 29 is the cause.
I'll try later with the latest version.
But both binaries work fine. :)

EDIT: Yep, 2.0 did the job indeed - it's all right now.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#760 Post by vovchik »

Dear SFR,

I have done some nice spirals here: http://basic-converter.proboards.com/in ... 314&page=5. You might be "inspired" to see whether you can get them to work in gtkdialog. The only problem may be the refresh speed, but I think it should be OK even in an interpreter.

With kind regards,
vovchik

Post Reply