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, 05:32
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 Posts_count  
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: 2263

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: 5760
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_website 
mikeb


Joined: 23 Nov 2006
Posts: 8394

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: 5760
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_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  150 Time(s) 
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.0751s ][ Queries: 12 (0.0157s) ][ GZIP on ]