--- /dev/null
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+from csv_service import csvServ
+from sent_model import *
+from windows import *
+
+msgs=csvServ("sms.csv", "sent.csv")
+
+
+def showInboxMessages():
+ ui.stackedWidget.setCurrentIndex(1)
+
+def showSentMessages():
+ ui.stackedWidget.setCurrentIndex(3)
+
+
+def showMsg():
+ ui.stackedWidget.setCurrentIndex(2)
+ msg = msgs.getMsg(ui.listView.currentRow())
+ ui.msg_text.setText(msg.getMsgText())
+ ui.msg_from.setText(msg.getSenderName())
+ ui.msg_date.setText(msg.getDate())
+
+
+def showSentMsg():
+ ui.stackedWidget.setCurrentIndex(4)
+ msg = msgs.getMsg(ui.sentView.currentIndex().row(), 1)
+ ui.sent_msg_text.setText(msg.getMsgText())
+ ui.sent_msg_to.setText(msg.getRecName())
+ ui.sent_msg_date.setText(msg.getDate())
+
+ #####################################
+
+ arr=QByteArray(msg.getImageData())
+ img = QPixmap()
+ img.loadFromData(arr)
+
+ ui.frame.setPixmap(img.scaled(100,100))
+
+def populateInbox():
+ #allSenders=msgs.getAllSenders()
+ #for x in allSenders:
+
+ for x in msgs.recvLst:
+ ui.listView.addItem(x.getSenderName())
+
+def populateSent():
+ #allSenders=msgs.getAllSenders()
+ #for x in allSenders:
+
+ sentModel=SentModel(msgs.sentLst)
+ ui.sentView.setModel(sentModel)
+
+ #for x in msgs.sentLst:
+ #print x.getRecName()
+
+
+def init():
+
+ ################## Connect SIGNALS #######################
+
+ QObject.connect(ui.inboxButton, SIGNAL("clicked()"),showInboxMessages)
+ QObject.connect(ui.sentButton, SIGNAL("clicked()"),showSentMessages)
+ QObject.connect(ui.listView, SIGNAL("itemClicked(QListWidgetItem*)"),showMsg)
+ QObject.connect(ui.msg_back, SIGNAL("clicked()"),showInboxMessages)
+ QObject.connect(ui.sent_msg_back, SIGNAL("clicked()"),showSentMessages)
+ QObject.connect(ui.sentView, SIGNAL("clicked(QModelIndex)"),showSentMsg)
+
+ ############################################################
+
+ ################# Other Init functions #####################
+
+ populateInbox()
+ populateSent()
+
+ ###########################################################
+
+import sys
+app = QtGui.QApplication(sys.argv)
+MainWindow = QtGui.QMainWindow()
+ui = Ui_MainWindow()
+ui.setupUi(MainWindow)
+MainWindow.show()
+
+####### Initialization #########
+
+init()
+
+################################
+
+sys.exit(app.exec_())
+
+
+
+