I have a QgsFileWidget in my dialog that enables the choosing of a file. I need to set it to choose a folder instead. I understand that I need to use something like:
self.dlg.outputFilePathChooser.StorageMode.GetDirectory
To change this setting. However the above when placed in the run(self) function does not change the setting. I used the Plugin Builder to generate a blueprint and all my code is under the run(self) function. I've tried placing this line of code (which doesn't give any errors in the Log) in various places e.g. after if result: in the run(self) function or in the initGui(self) function.
I have tried adding QgsFileWidget before GetDirectory like so:
self.dlg.outputFilePathChooser.QgsFileWidget.StorageMode.GetDirectory
But get the error 'AttributeError: 'QgsFileWidget' object has no attribute 'QgsFileWidget''
I have also tried formatting it like at the following link, this prevents the plugin from opening, with error 'NameError: name 'GetDirectory' is not defined':
How to use QGSFileWidget to save file?
How do I format & where do I place the code to achieve my desired result (QgsFileWidget opens a dialog to pick a folder, NOT a file)?