Esempio n. 1
0
    def __init__(self):
        super(NewFileDialog, self).__init__()

        self.setWindowTitle('Select location of database files...')
        self.setFileMode(QFileDialog.Directory)
        self.setLabelText(QFileDialog.Accept, 'OK')

        QFileDialog.accept(self)
Esempio n. 2
0
    def accept(self):

        try:
            file_path = self.selectedFiles()[0]
            if not os.path.isfile(file_path):
                if not file_path.lower().endswith('.inp'):
                    file_path += '.inp'
                f = open(file_path, 'w')
                f.close()
            QFileDialog.accept(self)
        except Exception as e:
            # fix_print_with_import
            print(e)
            return
Esempio n. 3
0
    def accept(self):
        try:
            file_path = self.selectedFiles()[0]
            if os.path.isfile(file_path):
                ret = QtGui.QMessageBox.question(
                    self.iface.mainWindow(),
                    Parameters.plug_in_name,
                    u'The file already exists. Overwrite?',
                    # TODO: softcode
                    QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)

                if ret == QtGui.QMessageBox.No:
                    return
            QFileDialog.accept(self)

        except Exception as e:
            # fix_print_with_import
            print(e)
            return