Simple GtkDialog gui... How To Do.?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Simple GtkDialog gui... How To Do.?

#1 Post by sunburnt »

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

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#2 Post by don570 »

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 .

_______________________________________
Attachments
script66.sh.gz
Remove fake gz extension
(1.66 KiB) Downloaded 292 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

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

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#4 Post by sunburnt »

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.
Attachments
WallPapersSelector_Burke_01.png
(160.42 KiB) Downloaded 546 times

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#5 Post by amigo »

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

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#6 Post by jamesbond »

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. :lol:
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#7 Post by technosaurus »

you mean N=$((N+1))
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#8 Post by amigo »

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

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#9 Post by jamesbond »

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 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#10 Post by amigo »

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.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#11 Post by goingnuts »

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

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

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#12 Post by sunburnt »

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
.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#13 Post by sunburnt »

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

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

<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+ ...
.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#14 Post by 8-bit »

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

Code: Select all

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

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#15 Post by sunburnt »

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... 8)
.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#16 Post by goingnuts »

sunburnt: GtkDialog1-1.3 will add directly to list without duplicates - run "examples/fselect2list_test" to test.

User avatar
john biles
Posts: 1458
Joined: Sun 17 Sep 2006, 14:05
Location: Australia
Contact:

#17 Post by john biles »

Hello sunburnt,
How can anyone focus on your GUI with a wallpaper like that. Any other interesting wallpapers you'd like to share. LOL!
Attachments
WallPapersSelector_Burke_01.png
(160.42 KiB) Downloaded 379 times
Legacy OS 2017 has been released.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#18 Post by 8-bit »

goingnuts wrote:sunburnt: GtkDialog1-1.3 will add directly to list without duplicates - run "examples/fselect2list_test" to test.
The problem with this is that the version of gtkdialog you reference is a group remake of gtkdialog that will not work with a lot of Puppy gtk scripts and until all of this is worked out with the version you reference included in most Puppys by default, one would end up with an application that required a specific version.
I remember the rewrites of scripts to comply with the latest version of gtkdialog by thunor.

And correct me if I am wrong. Gtkdialog 1-1.3 you refer to is a work/rewrite in progress.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#19 Post by goingnuts »

I consider GtkDialog1-1.3 finished. I just suggest a solution - could even be just for inspiration of how it was done. Btw. several standard puppy holds more than 1 version of gtkdialog - so that can be handled too.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#20 Post by sunburnt »

My only use ( and most folks ) for GtkDialog is Puppy compatibility.
This is what keeps me from using BaCon and HUG, it has to be compiled for each variant.

A common GtkDialog for all Puppies is the only thing that gives it value.

Post Reply