GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
brokenman
Posts: 25
Joined: Thu 20 Oct 2011, 23:00

#676 Post by brokenman »

find a file on your system something like /root/.config/gtk-2.0/gtkfilechooser.ini
In it there is a setting `ShowHidden=false`. Change it to true.
Yes. That's what i was looking for. Thanks very much. I didn't even realize a config file was created!

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

page full of script examples

#677 Post by don570 »

There's a single page full of script examples for beginners.
A very convenient resource. HERE

and the user manual is HERE


and stock icons are listed HERE



___________________________________________________

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

press the Enter key

#678 Post by don570 »

To explain how it is possible to press the Enter key to
input the data to your program I have written a little script.

Just look at the script and run it and you will
understand the method that Zigbert explains on the first page.

Decompress to obtain script.
_________________________________________________
Attachments
demo_script.tar.gz
Decompress to obtain script
(662 Bytes) Downloaded 531 times

User avatar
glene77is
Posts: 196
Joined: Tue 17 Aug 2010, 22:09
Location: Memphis, TN, USA
Contact:

#679 Post by glene77is »

Don 570,
Thanks for the demo script.
Just what I needed to begin with.
Resolved some myterious syntax that was killing my efforts.
Thanks. :D
glene77is
Puppy Linux is more fun than a barrel of M$ monkeys :P
www.geocities.WS/glene77is
glene77is --- {^,^} --- electricity is shocking, Memphis, TN, USA.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#680 Post by don570 »

Porteus is getting behind the gtkdialog bandwagen :lol:

http://forum.porteus.org/viewtopic.php?f=94&t=1132

Some examples
http://puppy2.org/slaxer/Porteus/Gtkdia ... color.html

_________________________________________________________

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#681 Post by technosaurus »

did bigbass jump ship?
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#682 Post by don570 »

To show the selection of a folder by the two possible
methods Xdialog or gtkdialog. Compare each method
and decide which is best.

I wrote a simple script to compress a folder that the user selects.

The big difference is that Xdialog adds a slash at end of path.

Image
Attachments
compression-demo.tar.gz
(1.32 KiB) Downloaded 457 times
Last edited by don570 on Sat 09 Jun 2012, 19:19, edited 1 time in total.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#683 Post by don570 »

I wanted to show how it is possible to choose a folder and
enter data in another field at the same time.

To see the final application I created go HERE

Using the most recent version of gtkdialog this is possible
(See image) When the folder is choosen the time
to compress is calculated (using a simple estimate based on size)
and then displayed in box underneath.

Compare this with the old method where a
refresh button had to be clicked to make a calculation.

I've included two scripts to show the two methods.
Re quires the most recent version of gtkdialog
Image

refresh button version...

Image

___________________________________________________
Attachments
Gtkdialog-demos.tar.gz
two scripts to demonstrate calulating time
(1.85 KiB) Downloaded 433 times

postfs1

#684 Post by postfs1 »

zigbert wrote: ...
'mpg321 /dir/file' to play a audio-file.
If you use 'ffmpeg -i "/dir/file" -f au - | aplay -D plughw' it will play mp3, ogg, wma, flac, wav, ... without including more dependencies.
...
I tried -a 0:0, then -a :hw, then -a 'hw:0,0', then -a 0:hw:0, but now, i know the right word!
Finally, i've found the solution! Thanks!

-=Quirky Linux -1.40=- Image
mpg321 -a :plughw -o alsa /folder/file.mp3

OR:

mpg321 -a 0,0:plughw -o alsa /folder/file.mp3

To share sound card which has no hardware sound mixing:

aoss mpg321 -o alsa /folder/file.mp3

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#685 Post by don570 »

To Zigbert

On the first page -----> scrolling text example

Is this line correct? Just one quote sign?

Code: Select all

  while : ; do echo -e "x\n 100; sleep 0.5; done
_______________________________________________

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#686 Post by zigbert »

don570 wrote:To Zigbert

On the first page -----> scrolling text example

Is this line correct? Just one quote sign?

Code: Select all

  while : ; do echo -e "x\n 100; sleep 0.5; done
_______________________________________________
I guess it should be

Code: Select all

  while : ; do echo -e "x\n 100"; sleep 0.5; done
Have you tested it?

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#687 Post by don570 »

Have you tested it?
No I thought you tested it.

It's a bit too complicated for me :cry:

_________________________________

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#688 Post by zigbert »

don570 wrote:No I thought you tested it.
:D

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

#689 Post by 01micko »

Scrolling text with <text> and <timer> widgets, added theme thrown in..

Code: Select all

#!/bin/sh 
# Scrolling text & embedded timer event illustration #2
# using text and timer widgets
FG=$1 BG=$2 MSG=$3
! [ "$1" -a "$2" -a "$3" ] && echo "usage: $0 fg-color bg-color \"string\"" &&\
FG=white BG=black MSG="This is a test... I repeat: This is a test... "

echo 'style "gtkdialog-prog" 
{ 
	bg[NORMAL] = "'"$BG"'" 
	fg[NORMAL] = "'"$FG"'"
} 
widget "*prog" style "gtkdialog-prog" 

class "*" style "gtkdialog-prog"' > /tmp/gtkrc_prog

export GTK2_RC_FILES=/tmp/gtkrc_prog:/root/.gtkrc-2.0 

function scrolltext() { 
  thestr="${1}" 
  echo -en "${thestr:2}${thestr:0:2}" 
} 

export SCROLLMSG="$MSG" 
export -f scrolltext

export GTKBOX=' 
<window title="Embedded Timer Event #2"> 
  <vbox width-request="300">
    <text>
      <variable>SCROLLMSG</variable> 
      <input>scrolltext "$SCROLLMSG"</input>
    </text>
    <timer interval="1" visible="false">
      <action type="refresh">SCROLLMSG</action>
    </timer>  
  </vbox>
</window>' 

gtkdialog4 -p GTKBOX -c 
unset GTKBOX
Puppy Linux Blog - contact me for access

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#690 Post by disciple »

A pity it can't refresh more often than once a second...
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#691 Post by zigbert »

disciple wrote:A pity it can't refresh more often than once a second...
It can

Code: Select all

<timer milliseconds="true" interval="200" visible="false">

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#692 Post by zigbert »

Mick
I have cut down the code to give a simple-as-possible example.
Main post updated

Code: Select all

#!/bin/sh
export MSG="This is a test... I repeat: This is a test... "
export GTKBOX='
<vbox width-request="300">
 <text>
  <variable>MSG</variable>
  <input>echo -en "${MSG:2}${MSG:0:2}"</input>
 </text>
 <timer milliseconds="true" interval="200" visible="false">
  <action type="refresh">MSG</action>
 </timer> 
</vbox>'
gtkdialog4 -p GTKBOX

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#693 Post by disciple »

Cool!
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

restrain combobox

#694 Post by don570 »

Two scripts AVAILABLE

I posted two scripts in programming section of forums
to demonstrate how to restrain the combobox

From a list of audio players , only the installed
audio players are shown.

Image


________________________________________________________

User avatar
walter leonardo
Posts: 234
Joined: Thu 10 Dec 2009, 22:10

Help with gtk-dialog

#695 Post by walter leonardo »

Could you help me with mine program electricity for puppy linux I'm doing. I want to do the calculations by pressing "enter" instead of pressing the button "calculate". Could you do that for me?. Now I send the files.
I'd also like to know how to make programs in a single window with multiple tabs, each program in each tab.
Attachments
vatiohms.tar.gz
(1 KiB) Downloaded 506 times

Post Reply