Ruby/TK: Versatile file-chooser dialogs?

A

Axel

Hi,

does anybody know of more versatile dialogs than the standard
Tk.getOpenFile, getSaveFile, chooseDirectory for:

* file(s)-open
* file-save
* dir-chooser

Wishlist (for Windows; other OSs should be usable):

* Useable from within Ruby/TK without using (knowing...) TCL
* Favorite dirs and files
* Recent dirs and files
* Using filters (regexp would be nice)
* Having incremental search (i.e., limiting the displayed files/dirs
while typing into a search field)
* Pasting and copying file path from/to clipboard
* Fast

Nice to have:
* Font color dependent on File extension.

Axel
 
H

Hidetoshi NAGAI

From: Axel <[email protected]>
Subject: Ruby/TK: Versatile file-chooser dialogs?
Date: Sat, 13 Feb 2010 18:55:06 +0900
Message-ID: said:
Wishlist (for Windows; other OSs should be usable):

About Tk.getOpenFile and getSaveFile:
* Favorite dirs and files
* Recent dirs and files

For dir, :initialdir option may be useful.
# And sometimes, :initialfile option may help you.
* Using filters (regexp would be nice)

:filetypes option can control listed files in the dialog.
Extension-style or glob-style of file patterns are available
on its description.
Please read the Tcl/Tk's manual about tk_getOpenFile.
You can give a Ruby's array for a Tcl's list.
e.g.
Tcl's list
------------------------------------------
{
{{Text Files} {.txt} }
{{TCL Scripts} {.tcl} }
{{C Source Files} {.c} TEXT}
{{GIF Files} {.gif} }
{{GIF Files} {} GIFF}
{{All Files} * }
}
------------------------------------------
==>
Ruby's array
------------------------------------------
[
["Text Files", [".txt"] ],
["TCL Scripts", [".tcl"] ],
["C Source Files", [".c"], "TEXT"],
["GIF Files", [".gif"] ],
["GIF Files", [], "GIFF"],
["All Files", ["*"], ]
]
------------------------------------------
* Having incremental search (i.e., limiting the displayed files/dirs
while typing into a search field)

"File name" field of Tk.getOpenFile, getSaveFile
accepts a glob pattern for filtering listed files.
Incremental search is not available.
But on Tk8.5 said:
* Pasting and copying file path from/to clipboard

e.g.
------------------------------------------
TkClipboard.append(Tk.getOpenFile)

f = TkClipboard.get
Tk.getOpenFile:)initialdir=>File.dirname(f),:initialfile=>File.basename(f))
------------------------------------------

Use a faster machine. ;-)
Nice to have:
* Font color dependent on File extension.

You must write a script (or a class).
Please check the usage of TkWindow#grab, TkWindow#grab_release,
and TkVariable#wait or TkWindow#wait_destroy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top