Page 35 of 76

Posted: Sat 26 May 2012, 22:17
by technosaurus
did bigbass jump ship?

Posted: Wed 06 Jun 2012, 00:06
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

Posted: Sat 09 Jun 2012, 19:18
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

___________________________________________________

Posted: Sat 16 Jun 2012, 20:51
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

Posted: Mon 18 Jun 2012, 21:18
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
_______________________________________________

Posted: Wed 20 Jun 2012, 10:42
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?

Posted: Wed 20 Jun 2012, 23:36
by don570
Have you tested it?
No I thought you tested it.

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

_________________________________

Posted: Thu 21 Jun 2012, 15:44
by zigbert
don570 wrote:No I thought you tested it.
:D

Posted: Sat 23 Jun 2012, 01:48
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

Posted: Sat 23 Jun 2012, 03:25
by disciple
A pity it can't refresh more often than once a second...

Posted: Sat 23 Jun 2012, 11:03
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">

Posted: Sat 23 Jun 2012, 11:12
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

Posted: Sat 23 Jun 2012, 12:00
by disciple
Cool!

restrain combobox

Posted: Tue 07 Aug 2012, 22:43
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


________________________________________________________

Help with gtk-dialog

Posted: Fri 07 Sep 2012, 04:59
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.

Posted: Fri 07 Sep 2012, 06:33
by smokey01
Walter, to make tabs in a single window use the <notebook> command. The syntax can be found on the first page of this thread.

This should give you a clue how to use the enter key to accept input.

#! /bin/bash

export DIALOG='
<window title="Enter password" icon-name="gtk-dialog-question">
  <vbox>
    <hbox>
      <text>
        <label>Label:</label>
      </text>
      <entry activates-default="true">
        <variable>PASS0</variable>
      <visible>password</visible>
      </entry>
    </hbox>
    <hbox>
      <button cancel></button>
      <button can-default="true" has-default="true" use-stock="true">
        <label>gtk-ok</label>
      </button>
    </hbox>
  </vbox>
</window>
'

eval $(gtkdialog --program=DIALOG)
echo "$PASS0"

Posted: Fri 07 Sep 2012, 17:08
by zigbert
To activate <entry> from enter-key you could use the 'activate' signal.

Code: Select all

<entry>
<action signal="activate">command</action>
</entry>

Help with gtk-dialog

Posted: Fri 07 Sep 2012, 23:51
by walter leonardo
Use the function of the enter key and if it works, but only in a "Calcular" button and I want to get all the buttons work in "calcular"

As you would?


Code: Select all

#!/bin/bash
#Autor: Walter Leonardo Iñiguez
MAIN_DIALOG='
<window title="Programa VatiOhms"> 
<notebook page="0" labels=" Tab 1| Tab 2| Tab 3| Tab 4">        
<vbox>
  <frame  Calcular el Voltaje: V=I.R >
   <hbox>
     <text>
      <label>Ingrese Resistencia (Ohm):  </label>
     </text>
     <entry>
     <default>""</default>
      <variable>Resistencia</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry>
     <default>""</default>
      <variable>V</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Ingrese Corriente (Ampere):</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Corriente</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Val</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>El voltaje es:                         </label>
     </text>
     <entry>
      <variable>Voltaje</variable>
      <input>echo "scale=6;$Resistencia*$Corriente" | bc</input>
      <input>echo "scale=6;$V/$Corriente" | bc</input>
      <input>echo "scale=6;sqrt($Val*$Resistencia)" | bc</input>
     </entry>
     <text>
      <label>Volts</label>
     </text>
   </hbox>

   <hbox>
     <button>
  	  <label>Borrar datos</label>
	  <action type="clear">Voltaje</action><action type="clear">Resistencia</action><action type="clear">Corriente</action><action type="clear">V</action><action type="clear">Val</action>
     </button>
     <button can-default="true" has-default="true" use-stock="true">
      <label>Calcular</label>
      <action>refresh:Voltaje</action>
     </button>
   </hbox>
 </frame>
 
 
 <frame Calcular la Resistencia: R=V/I >
   <hbox>
     <text>
      <label>Ingrese Tensión (Volt):         </label>
     </text>
     <entry>
     <default>""</default>
      <variable>Volts</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry>
     <default>""</default>
      <variable>Va</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Ingrese Corriente (Ampere):</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Amper</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Vas</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>La resistencia es:                 </label>
     </text>
     <entry>
      <variable>Resistor</variable>
      <input>echo "scale=3;$Volts/$Amper" | bc</input>
      <input>echo "scale=3;($Va/$Amper)/$Amper" | bc</input>
      <input>echo "scale=3;$Volts/($Vas/$Volts)" | bc</input>
     </entry>
     <text>
      <label>Ohms</label>
     </text>
   </hbox>

  	<hbox>
  	 <button>
  	  <label>Borrar datos</label>
	  <action type="clear">Resistor</action><action type="clear">Volts</action><action type="clear">Amper</action><action type="clear">Va</action><action type="clear">Vas</action>
     </button>
     <button can-default="true" has-default="true" use-stock="true">
      <label>Calcular</label>
      <action>refresh:Resistor</action>
     </button>
    </hbox>
   </frame>
 
 
 <frame Calcular la Corriente: I=V/R >
   <hbox>
     <text>
      <label>Ingrese Tensión (Volt):        </label>
     </text>
     <entry>
     <default>""</default>
      <variable>Tensio</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry>
     <default>""</default>
      <variable>Vac</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Ingrese Resistencia (Ohm): </label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Resisten</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Vat</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>La Corriente es:                  </label>
     </text>
     <entry>
      <variable>Corrient</variable>
      <input>echo "scale=6;$Tensio/$Resisten" | bc</input>
      <input>echo "scale=6;$Vat/$Tensio" | bc</input>
      <input>echo "scale=6;(sqrt($Vac*$Resisten))/$Resisten" | bc</input>
     </entry>
     <text>
      <label>Amperes</label>
     </text>
   </hbox>
   

    <hbox>
     <button>
  	  <label>Borrar datos</label>
	  <action type="clear">Corrient</action><action type="clear">Tensio</action><action type="clear">Resisten</action><action type="clear">Vat</action><action type="clear">Vac</action>
     </button>
     <button can-default="true" has-default="true" use-stock="true">
      <label>Calcular</label>
      <action>refresh:Corrient</action>
     </button>
   </hbox>
 </frame>
 
 
 <frame Calcular los Vatios (Watts): W=I.V >
   <hbox>
     <text>
      <label>Ingrese Tensión (Volt):          </label>
     </text>
     <entry>
     <default>""</default>
      <variable>Tensione</variable>
     </entry>
     <text>
      <label>o resistencia</label>
     </text>
     <entry>
     <default>""</default>
      <variable>Vad</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Ingrese Corriente (Ampere): </label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Amperiore</variable>
     </entry>
     <text>
      <label>o resistencia</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Vag</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Los Vatios son:                     </label>
     </text>
     <entry>
      <variable>Vatios</variable>
      <input>echo "scale=6;$Tensione*$Amperiore" | bc</input>
      <input>echo "scale=6;($Vad*$Amperiore)*$Amperiore" | bc</input>
      <input>echo "scale=6;($Tensione/$Vag)*$Tensione" | bc</input>
     </entry>
     <text>
      <label>Vatios</label>
     </text>
   </hbox>
   

    <hbox>
     <button>
  	  <label>Borrar datos</label>
	  <action type="clear">Vatios</action><action type="clear">Tensione</action><action type="clear">Amperiore</action><action type="clear">Vad</action><action type="clear">Vag</action>
     </button>
     <button can-default="true" has-default="true" use-stock="true">
      <label>Calcular</label>
      <action>refresh:Vatios</action>
     </button>
   </hbox>
 </frame>
 
 
    <hbox>
     <button>
  	  <label>BORRAR TODOS LOS DATOS</label>
	  <action type="clear">Resistor</action><action type="clear">Volts</action><action type="clear">Amper</action><action type="clear">Va</action><action type="clear">Vas</action><action type="clear">Vatios</action><action type="clear">Tensione</action><action type="clear">Amperiore</action><action type="clear">Vad</action><action type="clear">Vag</action><action type="clear">Corrient</action><action type="clear">Tensio</action><action type="clear">Resisten</action><action type="clear">Vat</action><action type="clear">Vac</action><action type="clear">Voltaje</action><action type="clear">Resistencia</action><action type="clear">Corriente</action><action type="clear">V</action><action type="clear">Val</action>
     </button>
    <button>
      <label>SALIR</label>
      <action>exit:EXIT</action>
     </button>
  </hbox>
</vbox>
</notebook>
</window>
' gtkdialog3 --program=MAIN_DIALOG
 

Help with gtk-dialog

Posted: Fri 07 Sep 2012, 23:56
by walter leonardo
Now use the function tabs in my program and it worked well with the function of the enter key, but the enter key works only see in every window. What would be the problem?

Code: Select all

#!/bin/bash
#Autor: Walter Leonardo Iñiguez
MAIN_DIALOG='
<window title="Programa VatiOhms">
<notebook page="0" labels=" Tab 1| Tab 2| Tab 3| Tab 4">         
<vbox>
  <frame>
  <text use-markup="true">
  <label>"<b><u>Calcular el Voltaje: V=I.R</u></b>"</label>
  </text>
   <hbox>
     <text>
      <label>Ingrese Resistencia (Ohm):  </label>
     </text>
     <entry>
     <default>""</default>
      <variable>Resistencia</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry>
     <default>""</default>
      <variable>V</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Ingrese Corriente (Ampere):</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Corriente</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Val</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>El voltaje es:                         </label>
     </text>
     <entry>
      <variable>Voltaje</variable>
      <input>echo "scale=6;$Resistencia*$Corriente" | bc</input>
      <input>echo "scale=6;$V/$Corriente" | bc</input>
      <input>echo "scale=6;sqrt($Val*$Resistencia)" | bc</input>
     </entry>
     <text>
      <label>Volts</label>
     </text>
   </hbox>

   <hbox>
     <button>
  	  <label>Borrar datos</label>
	  <action type="clear">Voltaje</action><action type="clear">Resistencia</action><action type="clear">Corriente</action><action type="clear">V</action><action type="clear">Val</action>
     </button>
     <button can-default="true" has-default="true" use-stock="true">
      <label>Calcular</label>
      <action>refresh:Voltaje</action>
     </button>
   </hbox>
 </frame>
 </vbox>
 
 <vbox>
 <frame Calcular la Resistencia: R=V/I >
   <hbox>
     <text>
      <label>Ingrese Tensión (Volt):         </label>
     </text>
     <entry>
     <default>""</default>
      <variable>Volts</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry>
     <default>""</default>
      <variable>Va</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Ingrese Corriente (Ampere):</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Amper</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Vas</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>La resistencia es:                 </label>
     </text>
     <entry>
      <variable>Resistor</variable>
      <input>echo "scale=3;$Volts/$Amper" | bc</input>
      <input>echo "scale=3;($Va/$Amper)/$Amper" | bc</input>
      <input>echo "scale=3;$Volts/($Vas/$Volts)" | bc</input>
     </entry>
     <text>
      <label>Ohms</label>
     </text>
   </hbox>

  	<hbox>
  	 <button>
  	  <label>Borrar datos</label>
	  <action type="clear">Resistor</action><action type="clear">Volts</action><action type="clear">Amper</action><action type="clear">Va</action><action type="clear">Vas</action>
     </button>
     <button can-default="true" has-default="true" use-stock="true">
      <label>Calcular</label>
      <action>refresh:Resistor</action>
     </button>
    </hbox>
   </frame>
 </vbox>
 
 <vbox>
 <frame Calcular la Corriente: I=V/R >
   <hbox>
     <text>
      <label>Ingrese Tensión (Volt):        </label>
     </text>
     <entry>
     <default>""</default>
      <variable>Tensio</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry>
     <default>""</default>
      <variable>Vac</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Ingrese Resistencia (Ohm): </label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Resisten</variable>
     </entry>
     <text>
      <label>o vatios</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Vat</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>La Corriente es:                  </label>
     </text>
     <entry>
      <variable>Corrient</variable>
      <input>echo "scale=6;$Tensio/$Resisten" | bc</input>
      <input>echo "scale=6;$Vat/$Tensio" | bc</input>
      <input>echo "scale=6;(sqrt($Vac*$Resisten))/$Resisten" | bc</input>
     </entry>
     <text>
      <label>Amperes</label>
     </text>
   </hbox>
   

    <hbox>
     <button>
  	  <label>Borrar datos</label>
	  <action type="clear">Corrient</action><action type="clear">Tensio</action><action type="clear">Resisten</action><action type="clear">Vat</action><action type="clear">Vac</action>
     </button>
     <button can-default="true" has-default="true" use-stock="true">
      <label>Calcular</label>
      <action>refresh:Corrient</action>
     </button>
   </hbox>
 </frame>
</vbox>

<vbox>
 <frame Calcular los Vatios (Watts): W=I.V >
   <hbox>
     <text>
      <label>Ingrese Tensión (Volt):          </label>
     </text>
     <entry>
     <default>""</default>
      <variable>Tensione</variable>
     </entry>
     <text>
      <label>o resistencia</label>
     </text>
     <entry>
     <default>""</default>
      <variable>Vad</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Ingrese Corriente (Ampere): </label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Amperiore</variable>
     </entry>
     <text>
      <label>o resistencia</label>
     </text>
     <entry activates-default="true">
     <default>""</default>
      <variable>Vag</variable>
     </entry>
   </hbox>

   <hbox>
     <text>
      <label>Los Vatios son:                     </label>
     </text>
     <entry>
      <variable>Vatios</variable>
      <input>echo "scale=6;$Tensione*$Amperiore" | bc</input>
      <input>echo "scale=6;($Vad*$Amperiore)*$Amperiore" | bc</input>
      <input>echo "scale=6;($Tensione/$Vag)*$Tensione" | bc</input>
     </entry>
     <text>
      <label>Vatios</label>
     </text>
   </hbox>
   

    <hbox>
     <button>
  	  <label>Borrar datos</label>
	  <action type="clear">Vatios</action><action type="clear">Tensione</action><action type="clear">Amperiore</action><action type="clear">Vad</action><action type="clear">Vag</action>
     </button>
     <button can-default="true" has-default="true" use-stock="true">
      <label>Calcular</label>
      <action>refresh:Vatios</action>
     </button>
   </hbox>
 </frame>

    <hbox>
     <button>
  	  <label>BORRAR TODOS LOS DATOS</label>
	  <action type="clear">Resistor</action><action type="clear">Volts</action><action type="clear">Amper</action><action type="clear">Va</action><action type="clear">Vas</action><action type="clear">Vatios</action><action type="clear">Tensione</action><action type="clear">Amperiore</action><action type="clear">Vad</action><action type="clear">Vag</action><action type="clear">Corrient</action><action type="clear">Tensio</action><action type="clear">Resisten</action><action type="clear">Vat</action><action type="clear">Vac</action><action type="clear">Voltaje</action><action type="clear">Resistencia</action><action type="clear">Corriente</action><action type="clear">V</action><action type="clear">Val</action>
     </button>
    <button>
      <label>SALIR</label>
      <action>exit:EXIT</action>
     </button>
  </hbox>
  </vbox>
</notebook>
</window>
' gtkdialog3 --program=MAIN_DIALOG
 

Posted: Wed 26 Sep 2012, 11:52
by smokey01
Can anyone offer a simple gtkdialog GUI for netcat.

I would like to be able to run netcat in backgrounded listening mode when I start the computer. If someone was to call me using netcat, my system should open a chat window so the caller and callee can chat.

It's easy enough to do it in two terminal on the local and remote computer.

EG: listening computer:
netcat -lp <port>

EG: Calling computer:
netcat 192.168.x.x <port>

Both terminals will connect and you can chat in the terminal windows.

This can also be done on a WAN but you need to do some port forwarding.

I would also be happy just to use the terminal/console as long as it is backgrounded until invoked by the caller. I just don't want in in the tray until it's required.

Thanks