Page 1 of 1
Get gtkdialog to read a file of values before refresh.
Posted: Tue 14 Dec 2010, 04:40
by sunburnt
Button`s first action runs Xdialog file dialog that writes OUTFILE="FileName" to $1/vob-avi.encode.
It`s next action runs $1/vob-avi.encode in the current shell to reread it`s $OUTFILE value.
The next action then refreshes the Entry Box and it`s $OUTFILE value.
Code: Select all
export Encode="<window><vbox>
<frame Input File><vbox>
<button><label>Output File</label>
<action>vob-avi.sh outFILE</action>
<action>. $1/vob-avi.encode</action>
<action>refresh:OUTFILE</action>
</button>
<entry><variable>OUTFILE</variable><input>echo $OUTFILE</input></entry>
<button ok></button>
</vbox></window>"
gtkdialog3 -p Encode
But running $1/vob-avi.encode doesn`t work, so the value remains the same.
Many of Puppy`s dialogs must kill and rerun themselves to refresh themselves.
I assume that this is the only way to get this to work?
Posted: Tue 14 Dec 2010, 17:04
by zigbert
sunburnt
The solution is simple. Instead of refresh the internal variable $OUTFILE, you should put its value in a file, - and then refresh the <entry>
Code: Select all
export Encode="<window><vbox>
<frame Input File><vbox>
<button><label>Output File</label>
<action>vob-avi.sh outFILE</action>
<action>refresh:OUTFILE</action>
</button>
<entry><variable>OUTFILE</variable><input>cat /path/file-OUTFILE</input></entry>
<button ok></button>
</vbox></window>"
gtkdialog3 -p Encode
vob-avi.sh must hold
echo "refresh-text (filoename)" > /path/file-OUTFILE
Sigmund
Posted: Tue 14 Dec 2010, 17:11
by zigbert
Code: Select all
export Encode="<window><vbox>
<frame Input File><vbox>
<button><label>Output File</label>
<action>vob-avi.sh outFILE</action>
<action>. $1/vob-avi.encode</action>
<action>refresh:OUTFILE</action>
</button>
<entry><variable>OUTFILE</variable><input>echo $OUTFILE</input></entry>
<button ok></button>
</vbox></window>"
gtkdialog3 -p Encode
Remember that the xml-code is a variable itself. That means gtkdialog reads the value of "$OUTFILE" when Encode is executed. That's why $OUTFILE can't be refreshed. it could probably work if you used
<input>echo '$OUTFILE'</input> instead
Sigmund
Posted: Tue 14 Dec 2010, 23:52
by sunburnt
Nope, my previous example used "echo $OUTFILE".
My code writes to the vob-avi.encode file:
Code: Select all
outFILE() {
SEL=`Xdialog --stdout --title " Output File" --fselect $OUTPATH 0 0`
if [ $? -eq 0 ];then SEL=`basename $SEL`
echo "$ENC" | sed "s%^OUTFILE.*$%OUTFILE=\"$SEL\"%" > $appDIR/vob-avi.encode
fi
}
Now I have it writing separate files and it works...
Code: Select all
outFILE() {
SEL=`Xdialog --stdout --title " Output File" --fselect $OUTPATH 0 0`
[ $? -eq 0 ] && basename $SEL > $appDIR/output.file
}
But I`m sure Barry has tried to get gtkdialog to refresh it`s own controls with no luck.
And many of his GUIs kill and rerun to accomplish a refresh.
The radio boxes on my GUI work just fine, they change themselves.
It`s amazing that gtkdialog won`t use it`s own control assignment output code internally.
Here`s the GUI for setting the /paths/files, and video & audio encoding.
### I need to get codecs that ffmpeg has installed so the GUI shows them.
Posted: Wed 15 Dec 2010, 08:31
by zigbert
But I`m sure Barry has tried to get gtkdialog to refresh it`s own controls with no luck.
And many of his GUIs kill and rerun to accomplish a refresh.
He didn't try hard enough
There is no problem refreshing most of the widgets in a gtkdialog gui, but you're right. - it has to be done the gtkdialog way. Troublesome widgets that comes to my mind are the <pixmap>, <button>, <combobox>, <menuitem> and <menu> widgets, which has no or very limited possibility to refresh them self without a rerun.
Sigmund
Posted: Wed 15 Dec 2010, 15:49
by sunburnt
Not to mention externally refreshing them with code from the script.
Why not something like this?
Code: Select all
gtkdialog (process or id) (control`s variable)
It`s important to be able to at least refresh the whole GUI from code.
Not being able to change the text on a button is not good.
But not being able to change the text in a text box is really not good.
Posted: Wed 15 Dec 2010, 18:40
by zigbert
Code: Select all
#!/bin/bash
echo Yes > /tmp/text
export script='
<vbox>
<text><variable>TXT</variable><input>cat /tmp/text</input></text>
<button no><action>echo No > /tmp/text</action><action>refresh:TXT</action></button>
</vbox>'
gtkdialog3 -p script