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 Fri 31 Oct 2014, 01:03
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 Posts_count  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5039
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: 5760
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_website 
sunburnt


Joined: 08 Jun 2005
Posts: 5039
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: 5760
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_website 
sunburnt


Joined: 08 Jun 2005
Posts: 5039
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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0631s ][ Queries: 12 (0.0063s) ][ GZIP on ]