Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 29 Jul 2014, 23:09
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Get gtkdialog to read a file of values before refresh.
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5010
Location: Arizona, U.S.A.

PostPosted: Tue 14 Dec 2010, 00:40    Post subject:  Get gtkdialog to read a file of values before refresh.  

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:
   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?
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5649
Location: Valåmoen, Norway

PostPosted: Tue 14 Dec 2010, 13:04    Post subject:  

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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5649
Location: Valåmoen, Norway

PostPosted: Tue 14 Dec 2010, 13:11    Post subject:  

Code:
   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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5010
Location: Arizona, U.S.A.

PostPosted: Tue 14 Dec 2010, 19:52    Post subject:  

Nope, my previous example used "echo $OUTFILE".

My code writes to the vob-avi.encode file:
Code:
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:
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.
0_vob-avi_Encode.png
 Description   Fairly simple to understand...
 Filesize   36.86 KB
 Viewed   528 Time(s)

0_vob-avi_Encode.png

Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5649
Location: Valåmoen, Norway

PostPosted: Wed 15 Dec 2010, 04:31    Post subject:  

Quote:
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 Laughing

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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5010
Location: Arizona, U.S.A.

PostPosted: Wed 15 Dec 2010, 11:49    Post subject:  

Not to mention externally refreshing them with code from the script.

Why not something like this?
Code:
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.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5649
Location: Valåmoen, Norway

PostPosted: Wed 15 Dec 2010, 14:40    Post subject:  

Code:
#!/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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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
[ Time: 0.0684s ][ Queries: 13 (0.0086s) ][ GZIP on ]