#!/usr/bin/python2.5
import sys
from PyQt4 import QtGui,QtCore
from sms_ui import *
class Awesome(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.QObject.connect(self.ui.btnSend, QtCore.SIGNAL('clicked()'), self.smsgo)
def smsgo(self):
a=1
if __name__ == "__main__":
#This function means this was run directly, not called from another python file.
app = QtGui.QApplication(sys.argv)
myapp = Awesome()
myapp.show()
sys.exit(app.exec_())
QtCore.QObject.connect(self.ui.btnSend, QtCore.SIGNAL('clicked()'), self.smsgo)
def smsgo(self):
a=1
manager = QNetworkAccessManager(self);
connect(manager, SIGNAL(finished("QNetworkReply*")), self, SLOT(replyFinished("QNetworkReply*")));
manager.post(QNetworkRequest(QUrl(sms)));
manager = QNetworkAccessManager(self);
connect(manager, SIGNAL(finished("QNetworkReply*")), self, SLOT(replyFinished("QNetworkReply*")));
manager.post(QNetworkRequest(QUrl(sms)));

#!/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_())