![]() |
2010-09-02
, 07:05
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#2
|
![]() |
2010-09-02
, 07:11
|
Posts: 18 |
Thanked: 2 times |
Joined on Aug 2010
|
#3
|
![]() |
2010-09-02
, 11:11
|
Posts: 18 |
Thanked: 2 times |
Joined on Aug 2010
|
#4
|
manager = QNetworkAccessManager(self); connect(manager, SIGNAL(finished("QNetworkReply*")), self, SLOT(replyFinished("QNetworkReply*"))); manager.post(QNetworkRequest(QUrl(sms)));
![]() |
2010-09-02
, 11:39
|
Posts: 17 |
Thanked: 4 times |
Joined on Jan 2010
@ Finland
|
#5
|
Ok, I have a new question.
Here is my code snipit
I get this error:Code:manager = QNetworkAccessManager(self); connect(manager, SIGNAL(finished("QNetworkReply*")), self, SLOT(replyFinished("QNetworkReply*"))); manager.post(QNetworkRequest(QUrl(sms)));
nameerror: global name 'Qnetworkaccessmanager' is not defined
The Qnetworkaccessmanager is defiantly confusing me a bit. Any hints in the right direction?
![]() |
2010-09-02
, 11:49
|
Posts: 18 |
Thanked: 2 times |
Joined on Aug 2010
|
#6
|
![]() |
2010-09-02
, 11:54
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#7
|
![]() |
2010-09-02
, 11:59
|
Posts: 18 |
Thanked: 2 times |
Joined on Aug 2010
|
#8
|
Missing import statement?
Something like
from PyQt4.QtNetwork import QNetworkAccessManager
nicolai
![]() |
2010-09-03
, 01:06
|
Posts: 18 |
Thanked: 2 times |
Joined on Aug 2010
|
#9
|
#!/usr/bin/python2.5 import sys from PyQt4 import QtGui,QtCore,QtNetwork from PyQt4.QtNetwork import QNetworkAccessManager from sms2_ui import * class MyForm(QtGui.QMainWindow): def __init__(self, parent=None): #build parent user interface QtGui.QWidget.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) QtCore.QCoreApplication.setOrganizationName("Dimand Corp") QtCore.QCoreApplication.setApplicationName("SMS Exetel") self.settings = QtCore.QSettings() #connect buttons QtCore.QObject.connect(self.ui.btnSMS, QtCore.SIGNAL('clicked()'), self.doAddNew) QtCore.QObject.connect(self.ui.actionFrom_2, QtCore.SIGNAL('triggered()'), self.doSetNum) QtCore.QObject.connect(self.ui.actionUsername_3, QtCore.SIGNAL('triggered()'), self.doSetName) QtCore.QObject.connect(self.ui.actionPassword_3, QtCore.SIGNAL('triggered()'), self.doSetPass) QtCore.QObject.connect(self.ui.actionQuit, QtCore.SIGNAL('triggered()'), QtGui.qApp, QtCore.SLOT('quit()')) #Create Sub's def doAddNew(self): msg = self.ui.plainTextEditSMS.toPlainText() user = self.settings.value("Username").toString() password = self.settings.value("Password").toString() fromnum = self.settings.value("FromNum").toString() sms = "https://smsgw.exetel.com.au/sendsms/api_sms.php?username="+ user + "&password=" + password + "&mobilenumber=" + self.ui.lineTo.displayText() + "&message=" + msg + "&sender=" + fromnum + "&messagetype=Text" self.manager = QNetworkAccessManager(self); #QtCore.QObject.connect(self.manager, QtCore.SIGNAL('finished("QNetworkReply*")'),self, QtCore.SLOT('finished("QNetworkReply*")')); self.manager.get(QtNetwork.QNetworkRequest(QtCore.QUrl(sms))); self.ui.lineTo.clear() self.ui.plainTextEditSMS.clear() def doSetNum(self): text, ok = QtGui.QInputDialog.getText(self, "Settings", "Send Number:", QtGui.QLineEdit.Normal, QtCore.QDir.home().dirName()) if ok and text != '': self.settings.setValue("FromNum", text) def doSetName(self): text, ok = QtGui.QInputDialog.getText(self, "Settings", "Username:", QtGui.QLineEdit.Normal, QtCore.QDir.home().dirName()) if ok and text != '': self.settings.setValue("Username", text) def doSetPass(self): text, ok = QtGui.QInputDialog.getText(self, "Settings", "Password:", QtGui.QLineEdit.Normal, QtCore.QDir.home().dirName()) if ok and text != '': self.settings.setValue("Password", text) if __name__ == "__main__": #This function means this was run directly, not called from another python file. app = QtGui.QApplication(sys.argv) myapp = MyForm() myapp.show() sys.exit(app.exec_())
![]() |
2010-09-11
, 10:45
|
Posts: 3,319 |
Thanked: 5,610 times |
Joined on Aug 2008
@ Finland
|
#10
|
Basically, i used the designer to create a gui and the main code is the program, but i keep getting an attribute error when i try and make a function for some buton.
Any insight?