AttributeError: HelloWorld instance has no attribute 'connec
Добавлено: 04 май 2013, 20:21
Подскажите,пожалуйста,как мне исправить эту ошибку?
вот мой код:
Traceback (most recent call last): File "C:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python\qgis\utils.py", line 164, in startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/User/.qgis//python/plugins\HelloWorld__init__.py", line 15, in classFactory return HelloWorld(iface) File "C:/Users/User/.qgis//python/plugins\HelloWorld\HelloWorld.py", line 21, in init self.connect(self.ui.pushButton,QtCore.SIGNAL("clicked()"),self.function) AttributeError: HelloWorld instance has no attribute 'connect'
вот мой код:
Код: Выделить всё
import sys,os import win32api from PyQt4.QtCore import * from PyQt4.QtGui import * from qgis.core import * import ctypes from PyQt4 import uic
class HelloWorld:
def __init__(self, iface):
self.iface = iface
self.canvas = iface.mapCanvas()
self.connect(self.ui.pushButton,QtCore.SIGNAL("clicked()"),self.function)
def initGui(self):
self.action = QAction(QIcon(":/plugins/"), "&HelloWorld", self.iface.mainWindow())
self.action.setWhatsThis("Configuration for test plugin")
self.action.setStatusTip("This is status tip")
QObject.connect(self.action, SIGNAL("activated()"), self.hello_world)
self.iface.addPluginToMenu("HelloWorld", self.action)
def unload(self):
self.iface.removePluginMenu("HelloWorld",self.action)
self.iface.removeToolBarIcon(self.action)
def function( self ):
QMessageBox.information(self.iface.mainWindow(), QCoreApplication.translate('HelloWorld', "HelloWorld"), QCoreApplication.translate('HelloWorld', "HelloWorld"))
def hello_world(self):
path = os.path.dirname( os.path.abspath( __file__ ) )
self.optionsDialog = uic.loadUi(os.path.join(path,"untitled.ui"))
if name == "main": pass