Initial Project Commit
[retroconv] / bak / main.py
diff --git a/bak/main.py b/bak/main.py
new file mode 100644 (file)
index 0000000..12273ce
--- /dev/null
@@ -0,0 +1,95 @@
+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_())
+
+
+
+