@@ -0,0 +1,1976 @@
+%0D%0Aimport IconProvider%0D%0Afrom Settings import DIALOGFILTER, OUTPUTDATA%0D%0A%0D%0Afrom PySide2 import QtWidgets, QtGui%0D%0A%0D%0A%0D%0Aclass FileDialog:%0D%0A%0D%0A    def __init__(self, filter=None):%0D%0A%0D%0A        self.names = %5B%5D%0D%0A        self.filter = filter%0D%0A%0D%0A    def getFilename(self):%0D%0A        '''%0D%0A        getSaveFileName(%5Bparent=None%5B, caption=%22%22%5B, dir=%22%22%5B, filter=%22%22%5B,%0D%0A                    selectedFilter=%22%22%5B, options=QFileDialog.Options()%5D%5D%5D%5D%5D%5D)%0D%0A        '''%0D%0A        filename, _ = QtWidgets.QFileDialog.getSaveFileName(%0D%0A            self,%0D%0A            'Save File As',%0D%0A            '',%0D%0A            %22ReStructuredText Files (*.rst *.txt)%22%0D%0A        )%0D%0A        if filename:%0D%0A            text = self.editor.toPlainText()%0D%0A            try:%0D%0A                f = open(filename, %22wb%22)%0D%0A                f.write(text)%0D%0A                f.close()%0D%0A                # self.rebuildHTML()%0D%0A            except IOError:%0D%0A                QtGui.QMessageBox.information(%0D%0A                    self,%0D%0A                    %22Unable to open file: %25s%22 %25 filename%0D%0A                )%0D%0A%0D%0A        return filename%0D%0A%0D%0A    def dialog(self):%0D%0A%0D%0A        dialog = QtWidgets.QFileDialog()%0D%0A%0D%0A        provider = IconProvider.IconProvider()%0D%0A        dialog.setIconProvider(provider)%0D%0A        dialog.setNameFilter(DIALOGFILTER)%0D%0A        dialog.setNameFilterDetailsVisible(True)%0D%0A        dialog.setDirectory(OUTPUTDATA)%0D%0A        # allow only to select one file%0D%0A        dialog.setFileMode(QtWidgets.QFileDialog.AnyFile)%0D%0A        # display also size and date%0D%0A        dialog.setViewMode(QtWidgets.QFileDialog.Detail)%0D%0A        # make it a save dialog%0D%0A        dialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)%0D%0A        # put default name in the save dialog%0D%0A        dialog.selectFile(self.lineedit.text())%0D%0A%0D%0A        # open custom file dialog using custom icons%0D%0A        if dialog.exec_():%0D%0A            self.names = dialog.selectedFiles()%0D%0A            # filter = dialog.selectedFilter()%0D%0A%0D%0A        if not self.names:%0D%0A            return%0D%0A

refactor all file dialogs