File system dialog boxes
- fsdialog - dialog boxes for the user to select a file or directory.
SYNOPSIS
-
package require Tk 9 8.6.6
package require fsdialog 3.0
ttk::fsdialog configfile ?name?
ttk::fsdialog extensions ?spec?
ttk::fsdialog filesystems ?systems?
ttk::fsdialog history ?name ...?
ttk::fsdialog preferences ?option? ?value option value ...?
DESCRIPTION
-
The fsdialog package installs direct replacements for the
original tk_getOpenFile, tk_getSaveFile, and
tk_chooseDirectory commands of Tk. The replacements provide more
advanced features for user interaction. See the manual pages of the original
commands for the details on their usage.
To control the advanced features, the package provides some additional commands.
- ttk::fsdialog configfile ?name?
-
Specify a configuration file for the dialogs to automatically store and retrieve the preference settings and history. By default, the package will use the file "~/.config/tcltk/fsdialog.cfg", but only if that file exists. Calling this command without the name argument will create the default configuration file, so it is guaranteed to be used. Specify an empty string for name to prevent the use of the default configuration file, even if it exists.
- ttk::fsdialog extensions ?spec?
-
Specify a mapping from file extensions to icons. The file lists normally show a generic file icon for regular files and a directory icon for directories. It may be desirable to differentiate file types by displaying a different icon for each type. The icons must be made available in various sizes under the icons/Tango-fsd subdirectory. Alternatively, the xdgicons package can be used for providing the icons. If no spec argument is supplied, the command returns the currently configured mapping.
Example:
ttk::fsdialog extensions { .mp3 audio-x-generic .png image-x-generic .html text-html }
- ttk::fsdialog filesystems ?systems?
-
Configure which file system types will be accessible through the dialogs. By default the dialogs will provide access to the full directory tree that is available to the script. With starkits, starpacks, and similar technologies that includes the internal virtual file system. When this is undesired, the filesystems command may be used to set a list of the allowed file system types. Common types are: native, tclvfs, zipfs. If no systems argument is supplied, the command returns the currently configured list of allowed file systems. An empty list means all file system types are allowed.
- ttk::fsdialog history ?name ...?
-
Get or seed the list of files and directories that will be presented to the user in various drop-down lists. That list is normally maintained automatically, but this command makes it available for external storage and loading.
- ttk::fsdialog preferences ?option? ?value option value ...?
-
Configure preference settings. This command is provided for situations where the use of a specific configuration file for the file system dialogs is not desired. For example, when the preferences are going to be stored as part of the overall application configuration.
If no name or value arguments are supplied, the command returns a list containing alternating option names and values for the channel. If name is supplied but no value then the command returns the current value of the given option. If one or more pairs of name and value are supplied, the command sets each of the named options to the corresponding value; in this case the return value is an empty string.
The following settings are available:
- details boolean
- Show the short (0) or long (1) version of the file list. Default: 0.
- duopane boolean
- Combine files and directories in a single pane (0) or show directories in a separate pane (1). Default: 0.
- hidden boolean
- Show hidden files and directories. Default: 0.
- mixed boolean
- List directories before files (0) or list all entries without making a distinction between files and directories (1). This setting only has effect when files and directories are shown in a single pane. Default: 0.
- reverse boolean
- Show the entries in reverse sorting order. Default: 0.
- sort property
- Select which property to use for sorting the entries in the file pane. The directory pane is always sorted by name. Possible values are name, size, mtime, atime, ctime, uid, gid, and inode. The value date is accepted as an alias for mtime. Default: name.
KEYBOARD TRAVERSAL
-
The dialogs can be navigated using the keyboard. The following bindings are in place:
- Tab cycles the keyboard focus forward through the widgets.
- Shift-Tab cycles the keyboard focus backward through the widgets.
- Alt-Home changes the view to the user's home directory.
- Alt-Up changes the view one level up in the directory tree.
- Alt-Left moves the view back through the history of visited directories.
- Alt-Right moves the view forward through the history of visited directories.
- F5 refreshes the file list
- F6 moves the keyboard focus to the directory entry box.
- F7 moves the keyboard focus to the file entry box.
- F10 opens a dialog box for creating a new directory.
COPYRIGHT
- Copyright © 2018 Schelte Bron