[Qgis-user] Plugin QGIS Error "QTextEdit.setPlainText(QString): not enough arguments"

Suryo Miles suryomiles666 at gmail.com
Wed Jan 1 01:15:20 PST 2014


I try to make save as button but i got this error message when try to save
file in my directory

    File
"C:\Users\Mr.Pakde/.qgis2/python/plugins\condition\conditiondialog.py",
line 80, in saveAs
        self._save( _filename )
    File
"C:\Users\Mr.Pakde/.qgis2/python/plugins\condition\conditiondialog.py",
line 68, in _save
        f.write( 'Rekomendasi :' + str(self.ui.textRec1.setPlainText() ) )
    TypeError: QTextEdit.setPlainText(QString): not enough arguments

this is my code

    Smpan = self.ui.btnSave
            QtCore.QObject.connect(Smpan,
QtCore.SIGNAL('clicked()'),self.saveAs)

        def Compare1(self):
            input1 = self.ui.lineInput1.text()
            input2 = self.ui.lineInput2.text()
            compare = ''
            if input1 == input2:
                compare = 'Data dapat digunakam'
            else:
                compare = 'Data tidak cocok'
            self.ui.textRec1.setPlainText(compare)

        def _save(self, simpan):
            f = open( simpan, 'w' )
            f.write( 'Input 1 :' + str(self.ui.lineInput1.text()) )
            f.write( 'Input 2 :' + str(self.ui.lineInput2.text()) )
            f.write( 'Rekomendasi :' + str(self.ui.textRec1.setPlainText())
)
            f.close()
        def savefile(self):
            if self.simpan:
                  self._save( "%s" % self.simpan )
            else:
                  self.saveAs()

        def saveAs(self):
                tulis = QtGui.QFileDialog(self).getSaveFileName()
                if tulis !="":
                    _filename = "%s" % tulis
                    self._save( _filename )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140101/6b4425fa/attachment.html>


More information about the Qgis-user mailing list