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 22 Jul 2014, 05:22
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Same trouble calling functions from gtkdialog...
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
sunburnt


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

PostPosted: Sat 11 Dec 2010, 17:23    Post subject:  Same trouble calling functions from gtkdialog...  

I keep running into this snag... Rolling Eyes Calling functions from gtkdialog.
It`s a PATH selector button and entry box.
Full GUI has inPATH, inFILE, outPATH, outFILE buttons and entry boxes.
If there`s a better way to get path and file dialogs... Please!
Code:
#!/bin/sh
appNAME=`basename $0`
appDIR=/root/my-applications/$appNAME
mkdir -p $appDIR
if [ ! -s $appDIR/input.path ];then echo '/mnt' > $appDIR/input.path ;fi

inPATH() {
   SEL=`Xdialog --stdout --title " Input Path" --dselect $(<$appDIR/input.path) 0 0`
   if [ $? -eq 0 ];then echo $SEL > $appDIR/input.path ;fi
}
Encode() {
   export -f inPATH
   export appDIR

   export Encode="<window><hbox>
   <vbox>
   <frame Input File><vbox>
      <button><label>Input Path</label>
         <action>inPATH</action>
         <action>refresh:INPATH</action>
      </button>
      <entry><variable>INPATH</variable><input>cat $appDIR/input.path</input></entry>
   </vbox></frame>
   </vbox>
   </hbox></window>"
   gtkdialog3 -p Encode > $appDIR/vob-avi.encode
}
Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Sun 12 Dec 2010, 04:47    Post subject:  

Code:
#!/bin/sh
appNAME=`basename $0`
export appDIR=/root/my-applications/$appNAME
mkdir -p $appDIR
[ ! "$INPATH" ] && INPATH=/mnt

Encode() {
   export Encode="<window>
   <frame Input File><vbox>
   <button><label>Input Path</label>
     <action type=\"fileselect\">INPATH</action>
     <action>refresh:INPATH</action>
    </button>
    <entry accept=\"directory\"><variable>INPATH</variable><input>echo $INPATH</input></entry>
   </vbox></frame>
   </window>"
   gtkdialog3 -p Encode > $appDIR/vob-avi.encode
}

Encode

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


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

PostPosted: Sun 12 Dec 2010, 22:01    Post subject:  

Thanks zigbert... I can`t figure what "INPATH" does in this line.
Code:
<action type=\"fileselect\">INPATH</action>

When you click the button you get /root for a path.
I wanted the dialog to come up with the path in the Entry Box.

Also the tag is "fileselect", but it`s a path or directory dialog.
What makes it that way? And how do you get a file dialog?
Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Mon 13 Dec 2010, 14:20    Post subject:  

sunburnt wrote:
I can`t figure what "INPATH" does in this line.
Code:
<action type=\"fileselect\">INPATH</action>
INPATH defines what variable that should store the result of the file-selection box. When you refresh the <entry>, you get its new value.

sunburnt wrote:
When you click the button you get /root for a path.
I wanted the dialog to come up with the path in the Entry Box.
The easy way is to add 'cd "$INPATH"' before executing the gtkdialog code. This works fine for simple tasks, but for more sophisticated guis, I think you need to build your own file-selection box. I have done that for Pburn. - You'll find it in /usr/local/pburn/box_chooser.

sunburnt wrote:
Also the tag is "fileselect", but it`s a path or directory dialog.
What makes it that way? And how do you get a file dialog?
File-select is a special kind of gtk-button. -> to open the file-chooser widget. To accept only directories, <entry> is defined as 'accept="directory"'.


Sigmund

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


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

PostPosted: Mon 13 Dec 2010, 14:39    Post subject:  

Thanks again zigbert. It`s strange that the Entry box would effect the FileSelect button that way.
You would think that they would be separate entities.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 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.0584s ][ Queries: 12 (0.0082s) ][ GZIP on ]