<p>I have no experience with QT, but this is a problem with the line</p>
<p>If not filename.IsEmpty():</p>
<p>Instead try</p>
<p>If filename is not Null:</p>
<p>Or</p>
<p>If filename != ''</p>
<p>Don't capitalise ' if', that's my tablet doing that. Are you in Indonesia? I think I recognise a little bahasa in your comments<br>
</p>
<div class="gmail_quote">On Dec 25, 2013 3:10 AM, "Suryo Miles" <<a href="mailto:suryomiles666@gmail.com">suryomiles666@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>I try to make plugin in QGIS and i want to make save as button but i got error message like this<br><br>""Traceback (most recent call last):<br> File "C:\Users\Mr.Pakde/.qgis2/python/plugins\latih\latihdialog.py", line 69, in <br>
<br>saveAs<br> if not filename.isEmpty():<br>AttributeError: 'unicode' object has no attribute 'isEmpty' ""<br><br>I write my code like this :<br> <br> cariButton = self.ui.btnCari<br>
QtCore.QObject.connect(cariButton,QtCore.SIGNAL('clicked()'),self.cari)<br>
saveButton = self.ui.btnSave <br> QtCore.QObject.connect(saveButton, QtCore.SIGNAL('clicked()'),self.saveAs) <br><br> def cari(self, event=None):<br> #open dialog<br> filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '*.xml') <br>
<br> self.ui.lineFile.setText(filename)<br> #panggil isi data<br> <br> self.isiDataFile(filename)<br> <br> def isiDataFile(self, nmfile):<br> #buka dengan open mode baca<br> teksFile = open(nmfile, 'r').read()<br>
<br> self.ui.textFile.setText(teksFile)<br> <br> def _save(self, filename): <br> f = open( filename, "w" )<br> f.write( "%s" % self.lineFile.text() )<br> f.close()<br>
def savefile(self):<br> if self.filename:<br> self._save( "%s" % self.filename )<br> else:<br> self.saveAs()<br><br> def saveAs(self):<br> filename = QtGui.QFileDialog(self).getSaveFileName()<br>
if not filename.isEmpty():<br> _filename = "%s" % filename<br> self._save( _filename )<br> self.setFilename( _filename )<br><br></div><div><br><br></div>
</div>
<br>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></blockquote></div>