From 52605564df33a4edc44b99301fcc9babb2a18f98 Mon Sep 17 00:00:00 2001 From: Anshul Shah Date: Sun, 30 Oct 2016 15:30:53 +0530 Subject: [PATCH 1/4] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1051c9c..1b4d4a6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing to PyMail -We'd love for you to contribute to our source code and to make AngularJS even better than it is +We'd love for you to contribute to our source code and to make PyMail even better than it is today! Here are the guidelines we'd like you to follow: - [Code of Conduct](#coc) From 76ca1b0024cc4a14f75a5587250c7cf4e3b4e889 Mon Sep 17 00:00:00 2001 From: Nikhil Sheoran Date: Sun, 30 Oct 2016 16:21:51 +0530 Subject: [PATCH 2/4] Modified README, Added Instruction for updating UI, Removed un-necessary print messages --- README.md | 4 +++- UI/{login_dash.ui => dashboard.ui} | 0 components/{login_dash.py => dashboard.py} | 0 receive_module.py | 12 +----------- scr.sh | 2 +- 5 files changed, 5 insertions(+), 13 deletions(-) rename UI/{login_dash.ui => dashboard.ui} (100%) rename components/{login_dash.py => dashboard.py} (100%) diff --git a/README.md b/README.md index cdc30eb..cfdb50c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PyMail #### A simple Python GUI based SMTP and POP3 Client ----------------------------------------------------------- +----------------------------------------------------------- ## Setup - Clone the repo: @@ -21,5 +21,7 @@ MESSAGE_LIMIT = 20 python main.py ``` +- In order to modify GUI using Qt-Designer, modify the .ui files in components and execute ```./run.sh``` to generate the corresponding .py files + ## License [MIT License](http://anshul.mit-license.org/) diff --git a/UI/login_dash.ui b/UI/dashboard.ui similarity index 100% rename from UI/login_dash.ui rename to UI/dashboard.ui diff --git a/components/login_dash.py b/components/dashboard.py similarity index 100% rename from components/login_dash.py rename to components/dashboard.py diff --git a/receive_module.py b/receive_module.py index 030d81b..53de328 100644 --- a/receive_module.py +++ b/receive_module.py @@ -8,12 +8,6 @@ import logging import email -# from email.parser import Parser - -# in conf.py put -# username = --- -# password = --- - CRLF = '\r\n' TERMINATOR = CRLF + '.' + CRLF @@ -48,7 +42,6 @@ def send_message(self,m): # sends a message m without logging def send_password(self,m): - logging.debug("\nC: *********") self.sock.send((m + '\r\n').encode('utf-8')) # sends a message mes and receives a line from socket @@ -105,7 +98,7 @@ def __init__(self, host_name, host_port, user_id, passw, log_level=logging.DEBUG sock.connect((host_name, host_port)) self.connection = True except Exception as e: - print('can\'t connect to {0} on {1} port \r\n{3}'.format(host, port, e.__repr__())) + print('can\'t connect to {0} on {1} port \r\n{2}'.format(host, port, e.__repr__())) self.connection = False return @@ -182,6 +175,3 @@ def get_email_body(self, index): reload(sys) sys.setdefaultencoding('utf8') pop_obj = pop3lib(HOST_ADDR,POP3_PORT,USERNAME,PASSWORD) - # print pop_obj.get_message_list(1,1) - # print pop_obj.get_email_body(14) - # print "DONE" diff --git a/scr.sh b/scr.sh index 34f579f..3e46831 100755 --- a/scr.sh +++ b/scr.sh @@ -1,3 +1,3 @@ pyside-uic UI/compose.ui -o components/compose.py pyside-uic UI/mainwindow.ui -o components/mainwindow.py -pyside-uic UI/login_dash.ui -o components/login_dash.py +pyside-uic UI/dashboard.ui -o components/dashboard.py From 841f8146581ea017eccde0083cb7fb997c65e35e Mon Sep 17 00:00:00 2001 From: Nikhil Sheoran Date: Sat, 12 Nov 2016 19:12:12 +0530 Subject: [PATCH 3/4] Renamed login_dash to dashboard --- components/__init__.py | 2 +- main.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/components/__init__.py b/components/__init__.py index 7ba960f..1291699 100644 --- a/components/__init__.py +++ b/components/__init__.py @@ -1,3 +1,3 @@ import compose -import login_dash +import dashboard import mainwindow diff --git a/main.py b/main.py index c4e775e..e3ba7db 100644 --- a/main.py +++ b/main.py @@ -2,9 +2,8 @@ from receive_module import * import sender_module import sys,os -from components import mainwindow,compose,login_dash +from components import mainwindow,compose,dashboard import conf -from PyQt4 import QtCore as QtCore2 class ControlMainWindow(QtGui.QMainWindow): #Initialize New Window @@ -80,7 +79,7 @@ class LoginDashboard(QtGui.QWidget): #Initialization function that defines the control to listen to def __init__(self, parent=None): super(LoginDashboard, self).__init__(parent) - self.ui = login_dash.Ui_Form() + self.ui = dashboard.Ui_Form() self.ui.setupUi(self) self.ui.received_email.cellClicked.connect(self.slotItemClicked) self.ui.compose_button.clicked.connect(self.compose) @@ -167,7 +166,7 @@ def send_email(self): self.ui.subject.setText("") self.ui.body.clear() - #Discards the data in the body, sender, receiver and subject fields and return to login_dash page + #Discards the data in the body, sender, receiver and subject fields and return to dashboard page def discard(self): self.parent().setCurrentIndex(0) self.ui.sender.setText(self.pop_obj.username) From 8a456ae7a5f4970cab07197770a41cb08dc6c06f Mon Sep 17 00:00:00 2001 From: Nikhil Sheoran Date: Sat, 12 Nov 2016 19:39:24 +0530 Subject: [PATCH 4/4] Fixed str and list error --- receive_module.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/receive_module.py b/receive_module.py index 53de328..cd8a838 100644 --- a/receive_module.py +++ b/receive_module.py @@ -161,7 +161,11 @@ def get_email_body(self, index): body = "" if b.is_multipart(): for payload in b.get_payload(): - body = body + payload.get_payload() + d = payload.get_payload() + if type(d) is list: + body = body + ','.join(str(v) for v in d) + else: + body = body + str(payload.get_payload()) else: body = b.get_payload() body = body.replace("\r","") @@ -175,3 +179,5 @@ def get_email_body(self, index): reload(sys) sys.setdefaultencoding('utf8') pop_obj = pop3lib(HOST_ADDR,POP3_PORT,USERNAME,PASSWORD) + pop_obj.get_message_count() + pop_obj.get_email_body(1) \ No newline at end of file