Table of Contents

Class: MillerBrowser OpenSave/miller.py

Miller-column file system browser

style can be open or save

selections are always a list, even if multiple is 0

initialdir is where the browser points to at start

initialfile is the file/directory name that will initially appear in the type-in widget.

dirsOnly controls whether the browser shows files or not.

filters is a (possibly empty) list of tuples: (type description, glob(s)) [for open panels] or (type description, glob(s), extension) [for save panels]. The type description is used in the interface to describe the filtering (should be something like "PDB") and is returned when the type method is called. glob(s) can be either a single glob string or a list of such strings. The glob(s) are used to filter the files (directories if dirOnly is true) shown in the browser. If dirsOnly is true, globs will have / appended if they don't already end in /. Glob matching is always case- insensitive. By default, extension will be appended to the save file name if no extension is specified (and therefore typically begins with a .). The user can override this behavior. extension can be None. filters can be an empty tuple if no filtering is needed.

defaultFilter controls what filter is initially on. It is an index into the filters list. Can be one of the filter descriptions or a menu index. Negative indices count from the end of the menu.

addAll controls whether an all files (or directories) choice will be added to the list of filters (only will be added if list of filters is non-empty)

historyID is used to keep a per-dialog file history list. It should be a string that differs between browsers that open/save different files. For example, "main chimera file open" or "FindHBond file save".

kw are passed to the Tkinter.Frame constructor

Base Classes   
Tkinter.Frame
Methods   
__init__
addFilter
columnChange
destroy
getFilter
getPaths
getPathsAndTypes
makeFaveDirs
makeFaveFiles
makeFilterMenu
makeMainColumn
newFolder
newFolderCB
pathExists
rememberDir
rememberFile
setFilter
setPath
  __init__ 
__init__ (
        self,
        parent=None,
        style='open',
        multiple=0,
        initialdir=None,
        initialfile=None,
        dirsOnly=0,
        filters=[],
        defaultFilter=-1,
        addAll=1,
        selectionCommand=None,
        dblClickCommand=None,
        fileEntryCommand=None,
        historyID="",
        **kw,
        )

  addFilter 
addFilter (
        self,
        filterInfo,
        index=-1,
        )

Add the given filter to the list of filters.

filterInfo is the same format as a single entry of the filters keyword of __init__. index is where in the list of filter to insert the new filter (same format as defaultFilter keyword of __init__).

  columnChange 
columnChange ( self,  event )

  destroy 
destroy ( self )

  getFilter 
getFilter ( self )

Get the type description associated with the current filter.

  getPaths 
getPaths ( self,  remember=1 )

Get the path(s) indicated in the browser.

Returns a (possibly empty) list of paths. If remember is true, then the paths will be remembered in the list of file and directory favorites.

  getPathsAndTypes 
getPathsAndTypes ( self,  remember=1 )

Get the path(s) indicated in the browser, and their types.

Returns a (possibly empty) list of path/type two-tuples. If remember is true, then the paths will be remembered in the list of file and directory favorites.

Since this method may query the user for types, it should only be called once per dialog use

  makeFaveDirs 
makeFaveDirs ( self )

  makeFaveFiles 
makeFaveFiles ( self )

  makeFilterMenu 
makeFilterMenu ( self )

  makeMainColumn 
makeMainColumn (
        self,
        path,
        errorPath=None,
        )

  newFolder 
newFolder ( self )

  newFolderCB 
newFolderCB ( self,  button )

Exceptions   
ValueError, "Empty new folder name"
  pathExists 
pathExists ( self,  path )

Due to the vagaries of Windows network shares, must use this instead of os.path.exists

  rememberDir 
rememberDir ( self,  dirName )

Put a directory in the list of directory favorites

  rememberFile 
rememberFile ( self,  fileName )

Put a file in the list of file favorites

  setFilter 
setFilter (
        self,
        descript,
        filt=None,
        )

Set the file filtering in the browser.

The defaultFilter keyword of __init__ is normally used to set up initial filtering, so this is only used if the filtering must be changed programatically after that.

descript is the type description associated with the filter. filt is for internal use only.

Exceptions   
KeyError, "No filter named '%s'" %( descript )
  setPath 
setPath ( self,  path )

Set the path shown in the browser

One normally use the initialdir keyword to __init__ to set up the initial browser path. setPath is used if the path must be changed programatically after that.


Table of Contents

This document was automatically generated on Tue Nov 5 16:56:36 2002 by HappyDoc version 2.0.1