<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19019"></HEAD>
<BODY>
<DIV><FONT color=#000080 size=2 face=Arial>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN 
class=741150221-01042011>Hi,</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN 
class=741150221-01042011></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=741150221-01042011>I am 
working on my first QGIS plug-in wohoo . </SPAN></FONT></DIV>
<DIV><SPAN class=741150221-01042011><TD class=msg-user></TD><TD 
class=msg-data><SPAN><FONT color=#000080 size=2 face=Arial>But honestly this is 
my first ever stab at OO code in python using pyQT. I have </FONT><A 
title=blocked::http://pastebin.com/dWT5eezP 
href="http://pastebin.com/dWT5eezP"><FONT 
title=blocked::http://pastebin.com/dWT5eezP color=#000080 size=2 
face=Arial>http://pastebin.com/dWT5eezP</FONT></A><FONT color=#000080 size=2 
face=Arial> (for code highlighting - or see end of message below trace 
back)</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=741150221-01042011><SPAN><FONT color=#000080 size=2 
face=Arial>The line </FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=741150221-01042011><SPAN><FONT size=2><FONT color=#000080 
face=Arial>self.inputConfig()<BR></FONT></FONT></SPAN></SPAN><FONT size=2><FONT 
face=Arial><FONT color=#000080><SPAN class=741150221-01042011><SPAN>throws his 
error : argument 1 has unexpected type 'instance' </SPAN></SPAN><SPAN 
class=741150221-01042011><SPAN>.See traceback below. There I am trying to open a 
file selection dialogue window ....</SPAN></SPAN></FONT></FONT></FONT></DIV>
<DIV><SPAN class=741150221-01042011><SPAN><FONT color=#000080 size=2 
face=Arial></FONT></SPAN></SPAN> </DIV>
<DIV><FONT size=2><FONT face=Arial><FONT color=#000080><SPAN 
class=741150221-01042011><SPAN>Ay idea what it excepts instead of self ? 
</SPAN></SPAN><SPAN class=741150221-01042011>Any python gurus 
?</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN 
class=741150221-01042011></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN 
class=741150221-01042011>Thanks</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN 
class=741150221-01042011>Karsten</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN 
class=741150221-01042011></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN 
class=741150221-01042011>______</SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN 
class=741150221-01042011></SPAN></FONT> </DIV>
<DIV><SPAN class=741150221-01042011><FONT color=#800000 size=2 
face=Arial>Traceback (most recent call last):<BR>  File 
"D:/OSGeo4W/apps/qgis/./python/plugins\StreamEditCustomForm\streameditcustomform.py", 
line 72, in run<BR>    self.inputConfig()<BR>  File 
"D:/OSGeo4W/apps/qgis/./python/plugins\StreamEditCustomForm\streameditcustomform.py", 
line 54, in inputConfig<BR>    filename = 
QFileDialog.getOpenFileName(self, 'Open File', '.')<BR>TypeError: 
QFileDialog.getOpenFileName(QWidget parent=None, QString caption=QString(), 
QString directory=QString(), QString filter=QString(), QString 
selectedFilter=None, QFileDialog.Options options=0): argument 1 has unexpected 
type 'instance'<BR><BR>Python version:<BR>2.5.2 (r252:60911, Feb 21 2008, 
13:11:45) [MSC v.1310 32 bit (Intel)]</FONT></SPAN></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN class=741150221-01042011>______<SPAN 
class=741150221-01042011>______<SPAN 
class=741150221-01042011>______</SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011><SPAN class=741150221-01042011><SPAN 
class=741150221-01042011><SPAN 
class=741150221-01042011></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></FONT> </DIV>
<DIV><FONT color=#008000 size=2 face=Arial># Import the PyQt and QGIS 
libraries<BR>from PyQt4.QtCore import *<BR>from PyQt4.QtGui import *<BR>from 
qgis.core import *<BR># Initialize Qt resources from file resources.py<BR>import 
resources<BR># Import the code for the dialog<BR>from streameditcustomformdialog 
import StreamEditCustomFormDialog</FONT></DIV>
<DIV><FONT color=#008000></FONT> </DIV>
<DIV><FONT color=#008000 size=2 face=Arial>class 
StreamEditCustomForm:</FONT></DIV>
<DIV><FONT color=#008000></FONT> </DIV>
<DIV><FONT color=#008000 size=2 face=Arial>    def __init__(self, 
iface):<BR>        # Save reference to the 
QGIS interface<BR>        self.iface = 
iface</FONT></DIV>
<DIV><FONT color=#008000></FONT> </DIV>
<DIV><FONT color=#008000 size=2 face=Arial>    def 
initGui(self):<BR>        # Create action 
that will start plugin 
configuration<BR>        self.action = 
QAction(QIcon(":/plugins/streameditcustomform/icon.png"), 
\<BR>            "Stream 
Edit Custom Form", 
self.iface.mainWindow())<BR>        # connect 
the action to the run method<BR>        
QObject.connect(self.action, SIGNAL("triggered()"), self.run)</FONT></DIV>
<DIV><FONT color=#008000></FONT> </DIV>
<DIV><FONT color=#008000 size=2 
face=Arial>        # Add toolbar button and 
menu item<BR>        
self.iface.addToolBarIcon(self.action)<BR>        
self.iface.addPluginToMenu("&Stream Edit Custom Form", 
self.action)</FONT></DIV>
<DIV><FONT color=#008000></FONT> </DIV>
<DIV><FONT color=#008000 size=2 face=Arial>    def 
unload(self):<BR>        # Remove the plugin 
menu item and icon<BR>        
self.iface.removePluginMenu("&Stream Edit Custom 
Form",self.action)<BR>        
self.iface.removeToolBarIcon(self.action)<BR>        
<BR>        <BR>    def 
inputConfig(self):<BR>            
filename = QFileDialog.getOpenFileName(self, 'Open File', 
'.')<BR>            fname 

open(filename)<BR>            
data = 
fname.read()<BR>            
self.textEdit.setText(data)<BR>            
fname.close()         </FONT></DIV>
<DIV><FONT color=#008000></FONT> </DIV>
<DIV><FONT color=#008000 size=2 face=Arial>    # run method that 
performs all the real work<BR>    def run(self):</FONT></DIV>
<DIV><FONT color=#008000></FONT> </DIV>
<DIV><FONT color=#008000 size=2 
face=Arial>        # create and show the 
dialog<BR>        dlg = 
StreamEditCustomFormDialog()<BR>        # 
show the dialog<BR>        
dlg.show()<BR>        result = 
dlg.exec_()    <BR>        # 
See if OK was pressed<BR>        if result == 
1:<BR>            # do 
something useful (delete the line containing pass 
and<BR>            # 
substitute with your 
code<BR>            
self.inputConfig()<BR>            
pass</FONT></DIV></FONT></DIV></BODY></HTML>