Filter button should set selection's directory, too

This commit is contained in:
Guido van Rossum 1995-09-01 20:36:47 +00:00
parent bf4d8f9d87
commit b9e39c8861
2 changed files with 8 additions and 2 deletions

View File

@ -77,9 +77,9 @@ class FileDialog:
def go(self, directory=os.curdir, pattern="*", default=""):
self.directory = directory
self.set_filter(directory, pattern)
self.filter_command()
self.set_selection(default)
self.selection.focus_set()
self.filter_command()
self.top.grab_set()
try:
self.master.mainloop()
@ -136,6 +136,9 @@ class FileDialog:
self.files.delete(0, END)
for name in matchingfiles:
self.files.insert(END, name)
head, tail = os.path.split(self.selection.get())
if tail == os.curdir: tail = ''
self.set_selection(tail)
def get_filter(self):
filter = self.filter.get()

View File

@ -77,9 +77,9 @@ class FileDialog:
def go(self, directory=os.curdir, pattern="*", default=""):
self.directory = directory
self.set_filter(directory, pattern)
self.filter_command()
self.set_selection(default)
self.selection.focus_set()
self.filter_command()
self.top.grab_set()
try:
self.master.mainloop()
@ -136,6 +136,9 @@ class FileDialog:
self.files.delete(0, END)
for name in matchingfiles:
self.files.insert(END, name)
head, tail = os.path.split(self.selection.get())
if tail == os.curdir: tail = ''
self.set_selection(tail)
def get_filter(self):
filter = self.filter.get()