Ruby/TK: Versatile file-chooser dialogs?

Discussion in 'Ruby' started by Axel, Feb 13, 2010.

  1. Axel

    Axel Guest

    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
     
    Axel, Feb 13, 2010
    #1
    1. Advertising

  2. Axel

    Roger Pack Guest

    Axel wrote:
    > Hi,
    >
    > does anybody know of more versatile dialogs than the standard
    > Tk.getOpenFile, getSaveFile, chooseDirectory for:
    >
    > * file(s)-open
    > * file-save
    > * dir-chooser


    They're probably there, but only if you dig into Tk.

    ref:
    https://www.ruby-forum.com/topic/196978
    --
    Posted via http://www.ruby-forum.com/.
     
    Roger Pack, Feb 13, 2010
    #2
    1. Advertising

  3. Axel

    Axel Guest


    > They're probably there, but only if you dig into Tk.
    >
    > ref:https://www.ruby-forum.com/topic/196978


    "If you hate the standard dialogs, you must create your own dialogs."

    and

    "...written in Tcl/Tk you can load and use them on Ruby/Tk."

    OK, that answers my question. Seems that I have to go the not-so-easy
    way.

    Axel
     
    Axel, Feb 13, 2010
    #3
  4. From: Axel <>
    Subject: Ruby/TK: Versatile file-chooser dialogs?
    Date: Sat, 13 Feb 2010 18:55:06 +0900
    Message-ID: <>
    > 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, <Tab> completion is available.

    > * 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))
    ------------------------------------------

    > * Fast


    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.
    --
    Hidetoshi NAGAI ()
     
    Hidetoshi NAGAI, Feb 14, 2010
    #4
  5. Axel

    Axel Guest


    > You must write a script (or a class).
    > ...
    > --
    > Hidetoshi NAGAI ()


    I've started to write my own dialog(s). Hope I'll finish sometime ;)

    Thank you for your help!

    Axel
     
    Axel, Feb 14, 2010
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. htamimi

    Versatile Soft-Core Framework

    htamimi, Nov 6, 2004, in forum: VHDL
    Replies:
    0
    Views:
    1,636
    htamimi
    Nov 6, 2004
  2. =?Utf-8?B?Unlv?=

    File Chooser...

    =?Utf-8?B?Unlv?=, Sep 16, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,240
    =?Utf-8?B?UHVQdQ==?=
    Dec 2, 2005
  3. Szymon Madejczyk
    Replies:
    2
    Views:
    542
    Szymon Madejczyk
    Sep 15, 2003
  4. Robert M. Gary

    URL file chooser

    Robert M. Gary, Jan 31, 2006, in forum: Java
    Replies:
    2
    Views:
    548
    Robert M. Gary
    Jan 31, 2006
  5. Replies:
    7
    Views:
    576
    Oliver Wong
    Feb 17, 2006
Loading...

Share This Page