@@ -444,19 +444,39 @@ def getDialog(self, parent=None, caption='', acceptMode=QFileDialog.AcceptOpen,
444
444
445
445
@classmethod
446
446
def getOpenFileNames (self , parent = None , caption = '' , filter = '' , selectedFilter = None , useEncoding = False ):
447
- return self .getDialog (parent , caption , QFileDialog .AcceptOpen , QFileDialog .ExistingFiles , filter , selectedFilter , useEncoding )
447
+ if useEncoding :
448
+ return self .getDialog (parent , caption , QFileDialog .AcceptOpen , QFileDialog .ExistingFiles , filter , selectedFilter , useEncoding )
449
+ res = QFileDialog .getOpenFileNames (parent , caption , getLastUsedDir (), filter )
450
+ if len (res ) > 0 :
451
+ setLastUsedDir (res [- 1 ])
452
+ return res
448
453
449
454
@classmethod
450
455
def getOpenFileName (self , parent = None , caption = '' , filter = '' , selectedFilter = None , useEncoding = False ):
451
- return self .getDialog (parent , caption , QFileDialog .AcceptOpen , QFileDialog .ExistingFile , filter , selectedFilter , useEncoding )
456
+ if useEncoding :
457
+ return self .getDialog (parent , caption , QFileDialog .AcceptOpen , QFileDialog .ExistingFile , filter , selectedFilter , useEncoding )
458
+ res = QFileDialog .getOpenFileName (parent , caption , getLastUsedDir (), filter )
459
+ if res :
460
+ setLastUsedDir (res )
461
+ return res
452
462
453
463
@classmethod
454
464
def getSaveFileName (self , parent = None , caption = '' , filter = '' , selectedFilter = None , useEncoding = False ):
455
- return self .getDialog (parent , caption , QFileDialog .AcceptSave , QFileDialog .AnyFile , filter , selectedFilter , useEncoding )
465
+ if useEncoding :
466
+ return self .getDialog (parent , caption , QFileDialog .AcceptSave , QFileDialog .AnyFile , filter , selectedFilter , useEncoding )
467
+ res = QFileDialog .getSaveFileName (parent , caption , getLastUsedDir (), filter )
468
+ if res :
469
+ setLastUsedDir (res )
470
+ return res
456
471
457
472
@classmethod
458
473
def getExistingDirectory (self , parent = None , caption = '' , useEncoding = False ):
459
- return self .getDialog (parent , caption , QFileDialog .AcceptOpen , QFileDialog .DirectoryOnly , '' , None , useEncoding )
474
+ if useEncoding :
475
+ return self .getDialog (parent , caption , QFileDialog .AcceptOpen , QFileDialog .DirectoryOnly , '' , None , useEncoding )
476
+ res = QFileDialog .getExistingDirectory (parent , caption , getLastUsedDir (), QFileDialog .ShowDirsOnly )
477
+ if res :
478
+ setLastUsedDir (res )
479
+ return res
460
480
461
481
462
482
class FileFilter :
0 commit comments