I am using getOpenFileName to open file , I have 3 class that I bind between them in the main . For example ,
Class A () Class B () Class C () Main()
Main it showing window which have 3 pushing buttons : each button is calling one of three classes , and each one open another window responsible on its own function ; however, class C is responsible on getting files from directory .
What I want to do is that make getOpenFileName remember the last visited directory even after I close class's window , but still the main is running . in other words ,cache file path which I opened last time .
The code below for more illustration .
Class C():
def OpenFileX(self):
self.file, _ = QtWidgets.QFileDialog.getOpenFileName(self, 'Single File', QtCore.QDir.rootPath() , '*.csv')
self.textBrowserMS.setText(self.fileName)
return self.fileName
def getfileOG(self):
filePath, _ = QtWidgets.QFileDialog.getOpenFileName(self, 'Single File', QtCore.QDir.rootPath() , '*.csv')
self.textBrowserOG.setText(filePath)
def getfileConfig(self):
filePath, _ = QtWidgets.QFileDialog.getOpenFileName(self, 'Single File', QtCore.QDir.rootPath() , '*.csv')
self.textEdit_config.setText(filePath)
Main Class
Import C
class analysis(QtWidgets.QMainWindow, C.Ui_Dialog):
def __init__(self,parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
#self.ui = C.Ui_MainWindow()
self.setupUi(self)
Any ideas How I can do that