import logging
import sys
import suds
from PyQt4 import QtCore, QtGui, QtNetwork
from service import Ui_Form
from suds.wsse import *
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("suds.client").setLevel(logging.CRITICAL)
url = "http://xxxxxxxxx:xxxx/services/FireScopeConfigurationWebService/v1?wsdl"
token = UsernameToken("xxx", "xxxxx")
security = Security()
security.tokens.append(token)
client = suds.client.Client(url)
client.set_options(wsse = security)
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Form()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.createButton,QtCore.SIGNAL("clicked()"), self.create_srv)
ciEditLine = QtGui.QLineEdit() #variable 1
str(ciEditLine.displayText())
monitorEditLine = QtGui.QLineEdit() #variable 2
str(monitorEditLine.displayText())
bolEditLine = QtGui.QLineEdit() #variable 3
str(bolEditLine.displayText())
ipEditLine = QtGui.QLineEdit() #variable 4
str(ipEditLine.displayText())
def create_srv(self):
try:
response = client.service.createConfigurationItem(ciEditLine, monitorEditLine, bolEditLine, ipEditLine)
print response
except WebFault, e:
print e
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = StartQT4()
myapp.show()
sys.exit(app.exec_())
GUIの4つのLineEditボックスからユーザー入力を取得し、それらをWebサービス呼び出しの関数の変数として使用しようとしています。しかし、私はこのエラーを受け取ります。
Traceback (most recent call last):
File "start.py", line 34, in create_srv
str(ciEditLine.displayText())
NameError: global name 'ciEditLine' is not defined
ed
これは私の最初のアプリなので、簡単に感謝します。
どんな助けでも大歓迎です。
ウィリアム