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 Sun 21 Dec 2014, 12:38
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Simple GtkDialog gui... How To Do.?
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
sunburnt


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

PostPosted: Sat 21 Dec 2013, 00:50    Post_subject:  Simple GtkDialog gui... How To Do.?  

A gui to build a list of image files selected with the gtk file chooser.
So a listbox and a filer button with Ok to write the listbox to a file.

Simple right.? I tried many different methods, none worked.
I figured just write each /path/file selected to a file and refresh the listbox. Nope...
So I tried using the tree and it`s insert method didn`t work.

Or for example: 2 lists, one refreshes the other with it`s selected item.?
I`ve made a few guis like this in the past, but none of the code works now.
.
Back to top
View user's profile Send_private_message 
don570


Joined: 10 Mar 2010
Posts: 3437
Location: Ontario

PostPosted: Sat 21 Dec 2013, 15:10    Post_subject:  

This has nothing to to with refreshing , but it might interest you.
It's a script to save text to a file. I will put it in the next version of my
manual .

_______________________________________
script66.sh.gz
Description  Remove fake gz extension
gz

 Download 
Filename  script66.sh.gz 
Filesize  1.66 KB 
Downloaded  188 Time(s) 
Back to top
View user's profile Send_private_message 
sunburnt


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

PostPosted: Sat 21 Dec 2013, 15:20    Post_subject:  

I see your solution, use an edit box instead of a list or tree. This is usable for my purpose.

I tried using 8 entry boxes as that`s all that`s needed.
But as each /path/file is selected, how to cycle through them.?
Perhaps "eval" can allow each entry`s variable inside another variable...


### UPDATE: Still couldn`t figure this out. Don`t see how to get: FileChooser > Editor
There`s no example of loading the Editor from a variable or file. Only saving it.

### Other needed gui:
2 lists, selecting in first then triggers second to load a list pointed to by the selection.
Much like a 2 panel Filer. Selection in the dir panel triggers loading the dir list in the second.
.
Back to top
View user's profile Send_private_message 
sunburnt


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

PostPosted: Sat 21 Dec 2013, 20:23    Post_subject:  

As usual, an entire afternoon spent with GtkDialog. A common gui... File chooser adds to list.
And the solution is hacky and definitely a brute force method. But it works.

As you can see, all I could get to work properly was the entry box.
Tried to do one file chooser for all entries, but I can`t get math ((N=N+1)) to work in GtkDialog.
WallPapersSelector_Burke_01.png
 Description   
 Filesize   160.42 KB
 Viewed   482 Time(s)

WallPapersSelector_Burke_01.png

Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2293

PostPosted: Sun 22 Dec 2013, 02:15    Post_subject:  

Something wrong with my display here -I am unable to see all of the penguin on the right side of the above image... Is that the radio it has on??
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2232
Location: The Blue Marble

PostPosted: Sun 22 Dec 2013, 03:22    Post_subject:  

sunburnt wrote:
Tried to do one file chooser for all entries, but I can`t get math ((N=N+1)) to work in GtkDialog.

With a screenshot like that I'm not sure I can do N=N+1 either. Laughing

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Sun 22 Dec 2013, 05:41    Post_subject:  

you mean N=$((N+1))
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2293

PostPosted: Sun 22 Dec 2013, 07:29    Post_subject:  

((N=N+1)) vs. $((N=N+1)) depends on the shell.
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2232
Location: The Blue Marble

PostPosted: Sun 22 Dec 2013, 09:37    Post_subject:  

amigo wrote:
((N=N+1)) vs. $((N=N+1)) depends on the shell.

I don't know that both these forms work. I suppose the first one is probably for bash, what does the 2nd one works on?

EDIT: second one works on bash, ash, and (surprisingly) dash, too.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2293

PostPosted: Sun 22 Dec 2013, 11:24    Post_subject:  

Without '$' is bash-only. With '$' is POSIX so that means any 'decent' replacement shell will support it. That may not include mini-shells available with busybox or others. Yes, bash can use either form, and probably ksh as well.
Back to top
View user's profile Send_private_message 
goingnuts

Joined: 07 Dec 2008
Posts: 784

PostPosted: Sun 22 Dec 2013, 14:10    Post_subject:  

Not sure if still needed (or I understand the need...) but below will add a selected file to the list (although gtkdialog2 seems to double the lines).
Code:
#! /bin/bash
export MAIN_DIALOG='
<vbox>
   <hbox>
   <text>
      <label>Add a fileselection to a list through an entry with action append to list:
      </label>
   </text>
   </hbox>
   <hbox>
      <button>
         <label>add from file</label>
         <action fileselection>ENTRY</action>
      </button>
      <entry>
         <variable>ENTRY</variable>
         <action>append:ENTRY,LIST</action>
      </entry>
   </hbox>
   <vbox>
      <list>
         <variable>LIST</variable>
      </list>
      <hbox>
         <button>
            <label>Clear</label>
            <action>clear:LIST</action>
         </button>
         <button>
            <label>Removeselected</label>
            <action removeselected>LIST</action>
         </button>
      </hbox>
   </vbox>
   <hbox>
      <button ok>
         <action>exit</action>
      </button>
      <button cancel>
         <action>exit</action>
      </button>
   </hbox>
</vbox>
'
gtkdialog2  -d --program=MAIN_DIALOG
Back to top
View user's profile Send_private_message Visit_website 
sunburnt


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

PostPosted: Wed 25 Dec 2013, 15:20    Post_subject:  

Well it`s been 5 days with the flu my girlfriend brought home. It`s been a kind one though...

goingnuts; I`ll try your code in a bit, cooking the Christmas ham here.


I still don`t see how to do math within GtkDialog, but using bc "almost" worked.


I can`t remember who it was that showed me the math piece, he doesn`t come here any more.
From the philippines as I recall, a damn nice guy just like the lot of you are...


Merry Christmas fellow Puppians, one and all..! Terry Becker
.
Back to top
View user's profile Send_private_message 
sunburnt


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

PostPosted: Thu 26 Dec 2013, 01:50    Post_subject:  

goingnuts; My Puppy precise.5.4.X.5 doesn`t have a gtkdialog2 file or link, so error.

Renamed the call in you script and it errors at the button action line.
Perhaps a newer version of GtkDialog is needed. 0.8.3 seems pretty new though...

Code:
gtkdialog version 0.8.3 r493M (C) 2003-2007 Laszlo Pere, 2011-2012 Thunor

I got this to work, but it double spaces like you say ( See version above ):
Code:
<list>
<variable>LIST</variable>
<input>cat /path/file</input>
</list>


# Sadly to me as an occasional user, GtkDialog doesn`t seem better at all.
I know how hard a job Thunor has, GTK+ is a real can constantly changing of worms.
I guess I really pray for a good replacement for GTK+ ...
.
Back to top
View user's profile Send_private_message 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Thu 26 Dec 2013, 03:16    Post_subject:  

I played a little too not understanding exactly what you want to do.
I changed the add from file part something like:
Code:

      <button>
         <label>add from file</label>
         <action type="fileselect">ENTRY</action>
      </button>
      <entry>
         <variable>ENTRY</variable>
         <action>append:ENTRY,LIST</action>


This brought up a file selection window that would add files to the list variable and appear in the window of selected files.
For the Remove Selected button action, I had to use:
<action>Removeselected:LIST</action>
The information was found by looking at /usr/share/doc/gtkdialog/reference/list.html.

And I am also using the version of gtkdialog that was packaged with slacko 5.5.
Back to top
View user's profile Send_private_message 
sunburnt


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

PostPosted: Thu 26 Dec 2013, 16:27    Post_subject:  

Hi 8bit; Hope your Christmas was a good one.

I spent another few hours with GtkDialog with no more luck.

# The need is a very common and simple gui type:
List
Button to add List items ( /path/file in this case ... and shouldn`t need an Entry to make a List work )
Button to remove items ( your example worked very nicely 8bit. Thank you.! )
Ok button to use the List items ( writes them to a file in this case )
Cancel ...

In this case, the FileChooser button could write the item directly to a file, and refresh the List.
But this is a round-about method, correct way is to add directly to the list ( no refreshing ).

# Sadly, my gui with 8 Entry boxes is still the only truly working one I have.


# amigo and technosaurus; I think the leading $ is only if it`s to be used like a variable ( stdout ).?


### And I wanted to respond to amigo and jamesbond:

"Yes, whatever the subject is,"
Brooke Burke always has an impressive pair of points to offer... Cool
.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
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.1050s ][ Queries: 12 (0.0133s) ][ GZIP on ]