Ejemplo n.º 1
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:
            print e
            return
Ejemplo n.º 2
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:
            print e
            return