mirror of https://github.com/python/cpython.git
When a file name is selected ("OK" button, <Return> in the filename entry),
and the "key" keyword parameter was used to invoke .go(), use the directory of the selected file as the stored directory to return to when the same key is used again. This is useful since the user may well entry at least part of the path in the filename box instead of doing a lot of clicking around in the listboxes.
This commit is contained in:
parent
bb6193c553
commit
073b829021
|
@ -122,7 +122,11 @@ def go(self, dir_or_file=os.curdir, pattern="*", default="", key=None):
|
|||
self.top.grab_set()
|
||||
self.how = None
|
||||
self.master.mainloop() # Exited by self.quit(how)
|
||||
if key: dialogstates[key] = self.get_filter()
|
||||
if key:
|
||||
directory, pattern = self.get_filter()
|
||||
if self.how:
|
||||
directory = os.path.dirname(self.how)
|
||||
dialogstates[key] = directory, pattern
|
||||
self.top.destroy()
|
||||
return self.how
|
||||
|
||||
|
|
Loading…
Reference in New Issue