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 19 Sep 2014, 16:10
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog File Selector Question
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [8 Posts]  
Author Message
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Sun 13 Oct 2013, 19:20    Post subject:  GtkDialog File Selector Question  

Hi.

How do I define a GtkDialog File Selector to let the user select multiple files.

Code used is:
Code:
      <entry fs-title="'$FSDIRTITLE'">
         <default>'$IMGINDIR'</default>
         <variable>IMGINDIR</variable>
      </entry>
      <button tooltip-text="Click to select image directory">
         <input file stock="gtk-open"></input>
         <action type="fileselect">IMGINDIR</action>
      </button>

Thanks,

RSH

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Mon 14 Oct 2013, 09:22    Post subject:  

I believe the underlying gtk widget will only work for a single selection.
Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Mon 14 Oct 2013, 11:50    Post subject:  

I don't know the exact answer, but I have solved this in pBurn by building my own file-selector in the main gui.

The code is in /usr/local/pburn/func_gui (from line 260)


Sigmund

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


Joined: 23 Nov 2006
Posts: 8252

PostPosted: Mon 14 Oct 2013, 12:03    Post subject:  

yad file selector has the option for multiple file selection..you might want to check that out

mike
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Mon 14 Oct 2013, 16:57    Post subject:  

amigo wrote:
I believe the underlying gtk widget will only work for a single selection.

Yes, I feared this already. Thanks.

Might be some work to do for the gtkdialog developers?

zigbert wrote:
I don't know the exact answer, but I have solved this in pBurn by building my own file-selector in the main gui.

The code is in /usr/local/pburn/func_gui (from line 260)

This sounds great. Thanks!

Hopefully I'll be able to read and understand your program's code. Laughing

mikeb wrote:
yad file selector has the option for multiple file selection..you might want to check that out

Also thank you. The yad option is already running and working. Just want to try to get off the yad dependency.

RSH

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Tue 15 Oct 2013, 04:43    Post subject:  

Quote:
Hopefully I'll be able to read and understand your program's code.
If any trouble, please ask.
_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
simargl7

Joined: 05 Oct 2013
Posts: 18

PostPosted: Tue 15 Oct 2013, 05:28    Post subject:  

maybe rewriting your program in Vala

Cool

http://valadoc.org/#!api=gtk+-3.0/Gtk.FileChooserDialog

Code:

      // The FileChooserDialog:
      Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (
            "Select your favorite file", this, Gtk.FileChooserAction.OPEN,
            "_Cancel",
            Gtk.ResponseType.CANCEL,
            "_Open",
            Gtk.ResponseType.ACCEPT);

      // Multiple files can be selected:
      chooser.select_multiple = true;
Back to top
View user's profile Send private message 
matiasbatero


Joined: 11 Oct 2012
Posts: 60
Location: Mar del Plata, Argentina

PostPosted: Thu 24 Oct 2013, 23:28    Post subject:  

For i know, there is no way to do a multiple selection with built-in gtkdialog widgets. You have 2 solutions:

1) Build your own filebrowser using gtkdialog-tree (allows multiple selection) and passing arguments to buttons actions. The filebrowser can be so complex that you want. For example, i built one that draw 5 columns:
Specific-icon column (capturing file extension)
Name, Path, Size, Modified Date, filetype-mime

a) Folder/icon distintions browser can be performed using (while/read) (you can watch zigbert's lightweight approach). It's very clear code and very efficient. Here while/read works good.

b) I like the Specific-icon column, because is more similar that "chooser native dialog" .. and for stetic purposes!, but requires a correct implementation to run fast. It consists on: Export (ls) raw list by columns. Each column = one file. Then each files can be passed like argument to bash filter functions and concatenated in only a unique file with tree input format. This is my implementation. I have a program with +200 diferent filetype assignation and works like speed of light.

2) You can use mixed solution with Zenity or Yad.
You can draw a <button> that launch ( yad --file ) and then redirect output to the widget. Using file, and timer, or custom bash function.

3) You can build a Python script with pygtk, calling a chooser dialog, and passing+parsing values for gtkdialog widgets. Or using Vala, Perl, C++ to draw the widget.

4) If you use GTK2, you have gtk-server to do this implementation natively
Data project_004.png
Description  Example
png

 Download 
Filename  Data project_004.png 
Filesize  247.27 KB 
Downloaded  112 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [8 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.0635s ][ Queries: 12 (0.0039s) ][ GZIP on ]