2 from PyQt4.QtCore import *
3 from PyQt4.QtGui import *
4 from csv_service import csvServ
7 from GUI.main_window import *
8 from GUI.inbox_window import *
9 from GUI.message_window import *
10 from GUI.sent_window import *
12 msgs=csvServ("sms.csv", "sent.csv")
14 def showInboxMessages():
15 #ui.stackedWidget.setCurrentIndex(1)
18 def showSentMessages():
19 #ui.stackedWidget.setCurrentIndex(3)
23 #ui.stackedWidget.setCurrentIndex(2)
24 msg = msgs.getMsg(inboxWindow.listView.currentIndex().row())
25 print msg.getMsgText()
26 inboxMsgWindow.msg_text.setText(msg.getMsgText())
27 inboxMsgWindow.msg_address.setText(msg.getSenderName())
28 inboxMsgWindow.msg_date.setText(msg.getDate())
30 #####################################
33 if msg.getImageData() == "":
34 inboxMsgWindow.frame.setPixmap(QPixmap("graphics/contact_trans_120.png"))
37 arr=QByteArray(msg.getImageData())
41 inboxMsgWindow.frame.setPixmap(img.scaled(120,120, Qt.KeepAspectRatioByExpanding))
47 #ui.stackedWidget.setCurrentIndex(4)
48 msg = msgs.getMsg(sentWindow.listView.currentIndex().row(), 1)
49 sentMsgWindow.msg_text.setText(msg.getMsgText())
50 sentMsgWindow.msg_address.setText(msg.getRecName())
51 sentMsgWindow.msg_date.setText(msg.getDate())
53 #####################################
55 if msg.getImageData() == "":
56 sentMsgWindow.frame.setPixmap(QPixmap("graphics/contact_trans_120.png"))
58 arr=QByteArray(msg.getImageData())
62 sentMsgWindow.frame.setPixmap(img.scaled(120,120, Qt.KeepAspectRatioByExpanding))
67 #allSenders=msgs.getAllSenders()
70 recvModel=RecvModel(msgs.recvLst)
71 inboxWindow.listView.setModel(recvModel)
74 #allSenders=msgs.getAllSenders()
77 sentModel=SentModel(msgs.sentLst)
78 sentWindow.listView.setModel(sentModel)
80 #for x in msgs.sentLst:
85 ################## Connect SIGNALS #######################
87 QObject.connect(mainWindow.inbox_button, SIGNAL("clicked()"), showInboxMessages)
88 QObject.connect(mainWindow.sent_button, SIGNAL("clicked()"),showSentMessages)
89 QObject.connect(inboxWindow.listView, SIGNAL("clicked(QModelIndex)"),showMsg)
90 QObject.connect(sentWindow.listView, SIGNAL("clicked(QModelIndex)"),showSentMsg)
91 #QObject.connect(ui.msg_back, SIGNAL("clicked()"),showInboxMessages)
92 #QObject.connect(ui.sent_msg_back, SIGNAL("clicked()"),showSentMessages)
93 #QObject.connect(ui.sentView, SIGNAL("clicked(QModelIndex)"),showSentMsg)
95 ############################################################
97 ################# Other Init functions #####################
102 ###########################################################
104 if __name__ == '__main__':
105 app = QApplication(sys.argv)
106 #MainWindow = QtGui.QMainWindow()
107 #ui = Ui_MainWindow()
108 #ui.setupUi(MainWindow)
111 ####### Initialization #########
112 mainWindow = Ui_MainWindow()
113 inboxWindow = Ui_InboxWindow(mainWindow)
114 sentWindow = Ui_SentWindow(mainWindow)
115 inboxMsgWindow = Ui_MessageWindow(inboxWindow)
116 sentMsgWindow = Ui_MessageWindow(sentWindow)
117 #mainWindow=QMainWindow()
120 ################################
124 sys.exit(app.exec_())