Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
tkinter.filedialog.LoadFileDialog Class Reference
Inheritance diagram for tkinter.filedialog.LoadFileDialog:
Inheritance graph
[legend]
Collaboration diagram for tkinter.filedialog.LoadFileDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def ok_command
def go
def quit
def dirs_double_event
def dirs_select_event
def files_double_event
def files_select_event
def ok_event
def filter_command
def get_filter
def get_selection
def cancel_command
def set_filter
def set_selection

Public Attributes

 master
 directory
 top
 botframe
 selection
 filter
 midframe
 filesbar
 files
 dirsbar
 dirs
 ok_button
 filter_button
 cancel_button
 how

Static Public Attributes

string title = "Load File Selection Dialog"

Detailed Description

File selection dialog which checks that the file exists.

Definition at line 225 of file filedialog.py.


Member Function Documentation

def tkinter.filedialog.FileDialog.cancel_command (   self,
  event = None 
) [inherited]

Definition at line 205 of file filedialog.py.

00205 
00206     def cancel_command(self, event=None):
00207         self.quit()

Here is the call graph for this function:

def tkinter.filedialog.FileDialog.dirs_double_event (   self,
  event 
) [inherited]

Definition at line 143 of file filedialog.py.

00143 
00144     def dirs_double_event(self, event):
00145         self.filter_command()

Here is the call graph for this function:

def tkinter.filedialog.FileDialog.dirs_select_event (   self,
  event 
) [inherited]

Definition at line 146 of file filedialog.py.

00146 
00147     def dirs_select_event(self, event):
00148         dir, pat = self.get_filter()
00149         subdir = self.dirs.get('active')
00150         dir = os.path.normpath(os.path.join(self.directory, subdir))
00151         self.set_filter(dir, pat)

Here is the call graph for this function:

def tkinter.filedialog.FileDialog.files_double_event (   self,
  event 
) [inherited]

Definition at line 152 of file filedialog.py.

00152 
00153     def files_double_event(self, event):
00154         self.ok_command()

Here is the call graph for this function:

def tkinter.filedialog.FileDialog.files_select_event (   self,
  event 
) [inherited]

Definition at line 155 of file filedialog.py.

00155 
00156     def files_select_event(self, event):
00157         file = self.files.get('active')
00158         self.set_selection(file)

Here is the call graph for this function:

def tkinter.filedialog.FileDialog.filter_command (   self,
  event = None 
) [inherited]

Definition at line 165 of file filedialog.py.

00165 
00166     def filter_command(self, event=None):
00167         dir, pat = self.get_filter()
00168         try:
00169             names = os.listdir(dir)
00170         except os.error:
00171             self.master.bell()
00172             return
00173         self.directory = dir
00174         self.set_filter(dir, pat)
00175         names.sort()
00176         subdirs = [os.pardir]
00177         matchingfiles = []
00178         for name in names:
00179             fullname = os.path.join(dir, name)
00180             if os.path.isdir(fullname):
00181                 subdirs.append(name)
00182             elif fnmatch.fnmatch(name, pat):
00183                 matchingfiles.append(name)
00184         self.dirs.delete(0, END)
00185         for name in subdirs:
00186             self.dirs.insert(END, name)
00187         self.files.delete(0, END)
00188         for name in matchingfiles:
00189             self.files.insert(END, name)
00190         head, tail = os.path.split(self.get_selection())
00191         if tail == os.curdir: tail = ''
00192         self.set_selection(tail)

Here is the call graph for this function:

Here is the caller graph for this function:

def tkinter.filedialog.FileDialog.get_filter (   self) [inherited]

Definition at line 193 of file filedialog.py.

00193 
00194     def get_filter(self):
00195         filter = self.filter.get()
00196         filter = os.path.expanduser(filter)
00197         if filter[-1:] == os.sep or os.path.isdir(filter):
00198             filter = os.path.join(filter, "*")
00199         return os.path.split(filter)

Here is the caller graph for this function:

def tkinter.filedialog.FileDialog.get_selection (   self) [inherited]

Definition at line 200 of file filedialog.py.

00200 
00201     def get_selection(self):
00202         file = self.selection.get()
00203         file = os.path.expanduser(file)
00204         return file

Here is the caller graph for this function:

def tkinter.filedialog.FileDialog.go (   self,
  dir_or_file = os.curdir,
  pattern = "*",
  default = "",
  key = None 
) [inherited]

Definition at line 114 of file filedialog.py.

00114 
00115     def go(self, dir_or_file=os.curdir, pattern="*", default="", key=None):
00116         if key and key in dialogstates:
00117             self.directory, pattern = dialogstates[key]
00118         else:
00119             dir_or_file = os.path.expanduser(dir_or_file)
00120             if os.path.isdir(dir_or_file):
00121                 self.directory = dir_or_file
00122             else:
00123                 self.directory, default = os.path.split(dir_or_file)
00124         self.set_filter(self.directory, pattern)
00125         self.set_selection(default)
00126         self.filter_command()
00127         self.selection.focus_set()
00128         self.top.wait_visibility() # window needs to be visible for the grab
00129         self.top.grab_set()
00130         self.how = None
00131         self.master.mainloop()          # Exited by self.quit(how)
00132         if key:
00133             directory, pattern = self.get_filter()
00134             if self.how:
00135                 directory = os.path.dirname(self.how)
00136             dialogstates[key] = directory, pattern
00137         self.top.destroy()
00138         return self.how

Here is the call graph for this function:

Reimplemented from tkinter.filedialog.FileDialog.

Definition at line 231 of file filedialog.py.

00231 
00232     def ok_command(self):
00233         file = self.get_selection()
00234         if not os.path.isfile(file):
00235             self.master.bell()
00236         else:
00237             self.quit(file)
00238 

Here is the call graph for this function:

def tkinter.filedialog.FileDialog.ok_event (   self,
  event 
) [inherited]

Definition at line 159 of file filedialog.py.

00159 
00160     def ok_event(self, event):
00161         self.ok_command()

Here is the call graph for this function:

def tkinter.filedialog.FileDialog.quit (   self,
  how = None 
) [inherited]

Definition at line 139 of file filedialog.py.

00139 
00140     def quit(self, how=None):
00141         self.how = how
00142         self.master.quit()              # Exit mainloop()

Here is the caller graph for this function:

def tkinter.filedialog.FileDialog.set_filter (   self,
  dir,
  pat 
) [inherited]

Definition at line 208 of file filedialog.py.

00208 
00209     def set_filter(self, dir, pat):
00210         if not os.path.isabs(dir):
00211             try:
00212                 pwd = os.getcwd()
00213             except os.error:
00214                 pwd = None
00215             if pwd:
00216                 dir = os.path.join(pwd, dir)
00217                 dir = os.path.normpath(dir)
00218         self.filter.delete(0, END)
00219         self.filter.insert(END, os.path.join(dir or os.curdir, pat or "*"))

Here is the caller graph for this function:

def tkinter.filedialog.FileDialog.set_selection (   self,
  file 
) [inherited]

Definition at line 220 of file filedialog.py.

00220 
00221     def set_selection(self, file):
00222         self.selection.delete(0, END)
00223         self.selection.insert(END, os.path.join(self.directory, file))
00224 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 60 of file filedialog.py.

Definition at line 104 of file filedialog.py.

Definition at line 54 of file filedialog.py.

Definition at line 87 of file filedialog.py.

Definition at line 85 of file filedialog.py.

Definition at line 76 of file filedialog.py.

Definition at line 74 of file filedialog.py.

Definition at line 67 of file filedialog.py.

Definition at line 100 of file filedialog.py.

Definition at line 129 of file filedialog.py.

Definition at line 53 of file filedialog.py.

Definition at line 71 of file filedialog.py.

Definition at line 96 of file filedialog.py.

Definition at line 63 of file filedialog.py.

string tkinter.filedialog.LoadFileDialog.title = "Load File Selection Dialog" [static]

Reimplemented from tkinter.filedialog.FileDialog.

Definition at line 229 of file filedialog.py.

Definition at line 56 of file filedialog.py.


The documentation for this class was generated from the following file: