Compare commits

..

49 Commits
0.10 ... master

Author SHA1 Message Date
Rinaldus 7822c3690b
The program didn't work when account didn't exist.
Also fixed crash when the program tried to load incorrect mail headers
2017-11-19 18:35:54 +03:00
Rinaldus b04cb9a6ff
Fixed program crash if OS doesn't support baloon notification 2017-11-16 16:25:23 +03:00
Rinaldus 66020b44a5
Revert "Moved from external 'notify-send' command to using notify2 library"
This reverts commit 6ccb04632b.
2017-11-16 16:23:25 +03:00
Rinaldus 8fbcb94182
Revert "Fixed program crash if OS doesn't support baloon notification"
This reverts commit c025371c1b.
2017-11-16 16:22:58 +03:00
Rinaldus c025371c1b
Fixed program crash if OS doesn't support baloon notification 2017-11-16 15:40:12 +03:00
Rinaldus 6ccb04632b
Moved from external 'notify-send' command to using notify2 library
This probably fixes https://github.com/rinaldus/mail-notifier/issues/6
2017-11-16 13:59:23 +03:00
Rinaldus a49944eab6
Version 3.01 2017-10-10 16:03:29 +03:00
Rinaldus d7378800d0
Some cosmetic improvements in menu and in About window 2017-10-10 14:20:30 +03:00
Rinaldus 6b73eb58bc
Details window now remembers its size 2017-10-10 14:04:25 +03:00
Rinaldus f4b5be7933
Revert "Disabled open Details window on system tray click"
This bug seems to be fixed by KDE/Qt developers.
This reverts commit 5af9d228b3.
2017-10-09 11:44:05 +03:00
Rinaldus 5af9d228b3
Disabled open Details window on system tray click
Probably there is bug in KDE 5.9 or in latest Qt  because this function
stopped working properly. Details window appeared every time when use
context menu and it's wrong.
2017-02-15 11:37:34 +03:00
Rinaldus 147b7f47dc
added status bar in Details window 2016-07-27 11:25:58 +03:00
Rinaldus aab6cf8490
the table now clears properly after reading mail 2016-07-26 11:21:31 +03:00
Rinaldus 7be56a1550
Version 3.0 2016-07-26 07:50:33 +03:00
Rinaldus 5d9fa72bd0
filling table function was moved to main check_mail() function
Final preparations for version 3.0
2016-07-26 07:05:16 +03:00
Rinaldus ee2d66c8c8
working table 2016-07-26 06:03:10 +03:00
Rinaldus ee0cb9b7de
added GUI window for upcoming email details 2016-07-25 16:15:01 +03:00
Rinaldus d5d41dcfef
array works properly now 2016-07-25 15:16:45 +03:00
Rinaldus 52c76223a9
Revert "mail headers decoding function now returns completed array instead of single variable"
This reverts commit 51c9221822.
2016-07-25 14:50:20 +03:00
Rinaldus 51c9221822
mail headers decoding function now returns completed array instead of single variable 2016-07-25 14:02:30 +03:00
Rinaldus 9cb0d58312
improved initial email decoding function 2016-07-25 12:05:18 +03:00
Rinaldus f73ca3e0b0
added initial function for email subjects decoding 2016-07-25 11:51:04 +03:00
Rinaldus 207dbbcdb8
Popup notification behaviour was changed
Now popup notification appears only if the number of unread emails has
changed since last mail check
2016-07-22 15:02:13 +03:00
Rinaldus aba8637900
system tray icon displays count of unread mail directly on itself 2016-07-22 13:48:45 +03:00
Rinaldus 127bbebe72 changed license loading method 2016-03-23 13:51:54 +03:00
Rinaldus c069562b18 fixed problem with license file open 2016-03-23 13:35:52 +03:00
Rinaldus 91ced51326 Version 2.0 2016-03-23 13:18:15 +03:00
Rinaldus 6c08c40531 Version 2.0-beta1 2016-02-10 11:45:23 +03:00
Rinaldus 2ee5a40de7 fixed bugs with error outputs 2016-02-10 07:50:37 +03:00
Rinaldus 6a1dba2aae added save account button and account removal warning 2016-02-08 21:26:43 +03:00
Rinaldus 8518e9f93d renamed icon 2016-02-08 18:42:24 +03:00
Rinaldus 4df494adae fixed several bugs 2016-02-08 18:30:13 +03:00
Rinaldus 97f9e5ed5e added initial (very raw and bugged) multi account support 2016-02-08 16:27:32 +03:00
Rinaldus 72a16516f4 added GUI elements for upcoming multi account feature 2016-02-08 11:52:24 +03:00
Peter ce5bff27ce Merge pull request #4 from rinaldus/dev
Merge master and dev branches
2016-02-02 11:02:34 +03:00
Peter 87c40d0a1d Merge pull request #3 from RomanZhilich/fix_error_icon
Show error icon on connection error.
2016-02-02 10:51:02 +03:00
Roman Zhilich 0fc8bd1965 Show error icon on connection error. 2016-02-01 18:30:09 +03:00
Rinaldus 5cc69f6ac4 Version 1.02 2016-01-26 11:42:56 +03:00
Rinaldus 945d99b299 Rewrote periodical mail check function and fixed bug in OS X (issue #2) 2016-01-26 11:35:51 +03:00
Rinaldus cbf5009ec9 preparing to version 1.01 2016-01-25 12:50:48 +03:00
Rinaldus 27ebc0884a New icon that shows if you have connection errors 2016-01-25 12:43:44 +03:00
Rinaldus 42cf334b37 fixed the bug that application sometimes didn't detect system tray when autostarted with DE 2015-11-15 02:03:53 +03:00
Rinaldus da66d607e1 temporarily removed system tray check 2015-11-12 17:39:44 +03:00
Rinaldus 2093b1173e release date was changed 2015-11-01 12:58:24 +03:00
Rinaldus 00129789b8 changed configuration path according to program name 2015-11-01 12:53:01 +03:00
Rinaldus 14de4e5c55 improved screenshot 2015-10-31 20:56:17 +03:00
Rinaldus d49c320454 made some cosmetic changes 2015-10-31 20:49:46 +03:00
Rinaldus e4821da97a fixed screen2.jpg show 2015-10-31 20:39:50 +03:00
Rinaldus 5bde21a5c7 version 1.0 2015-10-31 20:38:11 +03:00
25 changed files with 6340 additions and 1751 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__

12
LICENSE.txt Normal file
View File

@ -0,0 +1,12 @@
Copyright (c) 2015-2017, Peter Svirshchevskiy
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -2,8 +2,15 @@
This is Light weight mail notifier written in PyQt5. It checks your mailbox periodically and notify you if you have new mail. This is Light weight mail notifier written in PyQt5. It checks your mailbox periodically and notify you if you have new mail.
## Screenshot ## Screenshots
![Screenshot](https://raw.github.com/rinaldus/mail-notify/master/screenshot.jpg) ### Version 3.0
![MailboxEmpty](https://raw.github.com/rinaldus/mail-notifier/master/screenshots/no_unread_mails-3.0.jpg)
![MailboxFull](https://raw.github.com/rinaldus/mail-notifier/master/screenshots/unread_mails-3.0.jpg)
![Details](https://raw.github.com/rinaldus/mail-notifier/master/screenshots/details-3.0.jpg)
### Version 1.0
![MailboxEmpty](https://raw.github.com/rinaldus/mail-notifier/master/screenshots/screen1.jpg)
![MailboxFull](https://raw.github.com/rinaldus/mail-notifier/master/screenshots/screen2.jpg)
![Settings](https://raw.github.com/rinaldus/mail-notifier/master/screenshots/screen3.jpg)
## Install ## Install
@ -16,6 +23,41 @@ Give execute permission to mail-notifier.py
```sh ```sh
$ chmod +x mail-notifier.py $ chmod +x mail-notifier.py
``` ```
## Todo
## Changelog
### Version 3.01 (release date: 10.10.17)
* Added status bar in Details window
* Details window now remembers its size
* Some cosmetic improvements in menu
### Version 3.0 (release date: 26.07.16)
* System tray icon displays count of unread mail directly on itself
* Popup notification behaviour was changed: now popup notification appears only if the number of unread emails has
changed since last mail check
* Now you can view a short information about unread emails by click on system tray icon or choose "Details" from system tray menu
### Version 2.0 (release date: 23.03.16)
* **Important! Users of Mail Notifier 1.x have to delete old configuration file located in ~/.config/mail-notifier/settings.conf before first launch of new version**
* New "About" window
* Added license (BSD 3-Clause)
### Version 2.0-beta1 (release date: 10.02.16)
* **Important! The configuration structure was changed. Users of Mail Notifier 1.x have to delete old configuration file located in ~/.config/mail-notifier/settings.conf before first launch of new version**
* Multi account support. Now the program is able to check new mails in several mailboxes. You will get the total quantity of new mails from all mailboxes in system tray
### Version 1.02 (release date: 26.01.16)
* Rewrote periodical mail check function and fixed bug in OS X
### Version 1.01 (release date: 25.01.16)
* New icon, that shows if you have connection problems
* Fixed bug when system tray icon sometimes didn't appear after DE start
### Version 1.0 (release date: 01.11.15)
* Settings window * Settings window
* "About program" window * All parameters are stored in configuration file *(~/.config/mail-notifier/settings.conf)*
* Many improvements
### Version 0.10 (pre release date: 28.10.15)
* Initial version
* All parameters are stored right in script

BIN
icons/add_account.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

BIN
icons/details.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
icons/mailbox_error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
icons/remove_account.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

BIN
icons/rename_account.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

BIN
icons/save_account.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
icons/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -4,15 +4,52 @@ from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (QAction, QApplication, QCheckBox, QComboBox, from PyQt5.QtWidgets import (QAction, QApplication, QCheckBox, QComboBox,
QDialog, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit, QDialog, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit,
QMessageBox, QMenu, QPushButton, QSpinBox, QStyle, QSystemTrayIcon, QMessageBox, QMenu, QPushButton, QSpinBox, QStyle, QSystemTrayIcon,
QTextEdit, QVBoxLayout) QTextEdit, QVBoxLayout, QInputDialog)
from PyQt5.QtCore import (QThread, QTimer) from PyQt5.QtCore import (QThread, QTimer, QFile, QSettings)
import imaplib import imaplib
import email
imaplib._MAXLINE = 400000
import subprocess import subprocess
import res import resources_rc
from ui_settings import Ui_Settings
from ui_about import Ui_about
from ui_details import Ui_Details
from PyQt5 import QtCore, QtGui, QtWidgets
import os
import socket
import time
from datetime import datetime, date, time
#variables #variables
timers = []
programTitle = "Mail Notifier" programTitle = "Mail Notifier"
programVersion = "3.01-dev"
settings = QSettings(os.path.expanduser("~")+"/.config/mail-notifier/settings.conf", QSettings.NativeFormat)
def GlobalSettingsExist():
if ((settings.contains("CheckInterval") and settings.value("CheckInterval") != "") and
(settings.contains("Notify") and settings.value("Notify") != "")):
return True
else:
return False
def AccountExist():
groups = settings.childGroups()
if (len(groups)) != 0:
settings.beginGroup(groups[0])
if ((settings.contains("MailServer") and settings.value("MailServer") != "") and
(settings.contains("Port") and settings.value("Port") != "") and
(settings.contains("Login") and settings.value("Login") != "") and
(settings.contains("Password") and settings.value("Password") != "") and
(settings.contains("SSL") and settings.value("SSL") != "")):
n = True
else:
n = False
settings.endGroup()
else:
n = False
if (n):
return True
else:
return False
class Window(QDialog): class Window(QDialog):
def __init__(self): def __init__(self):
@ -22,94 +59,429 @@ class Window(QDialog):
self.createActions() self.createActions()
self.setTitle=programTitle self.setTitle=programTitle
self.createTrayIcon() self.createTrayIcon()
self.trayIcon.setIcon(QIcon(":icons/mailbox_empty.png")) # Draw system tray icon
pixmap = QtGui.QPixmap(QtGui.QPixmap(":icons/mailbox_empty.png"))
painter = QtGui.QPainter(pixmap)
painter.setPen(QtGui.QColor(255, 0, 0))
painter.setFont(QtGui.QFont('Arial', QtGui.QFont.Bold))
painter.drawText(QtCore.QRectF(pixmap.rect()), QtCore.Qt.AlignCenter, "0")
painter.end()
self.trayIcon.setIcon(QtGui.QIcon(pixmap))
# End drawing system tray icon
self.trayIcon.setToolTip("You have no unread letters") self.trayIcon.setToolTip("You have no unread letters")
self.trayIcon.show() self.trayIcon.show()
# setup settings
self.ui = Ui_Settings()
self.ui.setupUi(self)
self.setWindowIcon(QIcon(os.path.dirname(os.path.realpath(__file__))+"/icons/mailbox_empty.png"))
self.SettingsRestore()
self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).clicked.connect(self.btnOK_clicked)
self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Cancel).clicked.connect(self.btnCancel_clicked)
self.ui.btnTestConnection.clicked.connect(self.btnTestConnection_clicked)
self.ui.comboAccounts.currentTextChanged.connect(self.comboAccounts_changed)
self.ui.btnAddAccount.clicked.connect(self.btnAddAccount_clicked)
self.ui.btnRenameAccount.clicked.connect(self.btnRenameAccount_clicked)
self.ui.btnSaveAccount.clicked.connect(self.btnSaveAccount_clicked)
self.ui.btnRemoveAccount.clicked.connect(self.btnRemoveAccount_clicked)
# Check if account doesn't exist, it creates default one
if (AccountExist() == False):
self.ui.comboAccounts.addItem("Default")
self.ui.comboAccounts.setCurrentText("Default")
# Main timer
self.timer = QTimer(self)
self.timer.timeout.connect(mail_check)
self.lastCheckCount = 0 # variable for prevent annoying popup notification when mail count didn't change since last check
# Menu actions # Menu actions
def createActions(self): def createActions(self):
self.quitAction = QAction(QIcon(':icons/menu_quit.png'),"&Quit", self, self.detailsShow = QAction(QIcon(':icons/details.png'),"&Details...", self, triggered=self.detailsShow)
triggered=QApplication.instance().quit) self.aboutShow = QAction(QIcon(':icons/mailbox_empty.png'),"&About " + programTitle + "...", self, triggered=self.aboutShow)
self.checkNow = QAction(QIcon(':icons/check_now.png'),"&Check now", self, self.checkNow = QAction(QIcon(':icons/check_now.png'),"&Check now", self, triggered=mail_check)
triggered=self.checkNow) self.restoreAction = QAction(QIcon(":icons/settings.png"),"&Settings...", self, triggered=self.showNormal)
# self.restoreAction = QAction("&Restore", self, self.quitAction = QAction(QIcon(':icons/menu_quit.png'),"&Quit", self, triggered=QApplication.instance().quit)
# triggered=self.showNormal)
# UI functions # UI functions
def createTrayIcon(self): def createTrayIcon(self):
self.trayIconMenu = QMenu(self) self.trayIconMenu = QMenu(self)
f = self.trayIconMenu.font()
f.setBold(True)
self.detailsShow.setFont(f)
self.trayIconMenu.addAction(self.detailsShow)
self.trayIconMenu.addSeparator()
self.trayIconMenu.addAction(self.checkNow) self.trayIconMenu.addAction(self.checkNow)
self.trayIconMenu.addAction(self.restoreAction)
self.trayIconMenu.addAction(self.aboutShow)
self.trayIconMenu.addAction(self.quitAction) self.trayIconMenu.addAction(self.quitAction)
#self.trayIconMenu.addAction(self.restoreAction)
self.trayIcon = QSystemTrayIcon(self) self.trayIcon = QSystemTrayIcon(self)
self.trayIcon.setContextMenu(self.trayIconMenu) self.trayIcon.setContextMenu(self.trayIconMenu)
self.trayIcon.activated.connect(self.trayIconActivated)
def SettingsRestore(self):
if (GlobalSettingsExist() and AccountExist()):
groups = settings.childGroups()
self.ui.comboAccounts.clear() # Clear account items before fill them again
for i in range (len(groups)):
self.ui.comboAccounts.addItem(groups[i])
self.ui.comboAccounts.setCurrentText(groups[i])
settings.beginGroup(groups[i])
self.ui.txtboxMailServer.setText(settings.value("MailServer"))
self.ui.txtboxPort.setText(settings.value("Port"))
self.ui.txtboxLogin.setText(settings.value("Login"))
self.ui.txtboxPassword.setText(settings.value("Password"))
self.ui.boolifSSL.setChecked(bool(settings.value("SSL")))
settings.endGroup()
if (self.ui.comboAccounts.count() == 0):
self.ui.comboAccounts.addItem("Default")
self.ui.comboAccounts.setCurrentText("Default")
self.ui.checkFreq.setValue(int(settings.value("CheckInterval")))
self.ui.boolifNotify.setChecked(bool(settings.value("Notify")))
def mailboxEmpty(self): def SettingsSave(self,account):
self.trayIcon.setToolTip ("You have no unread mail") settings.setValue("CheckInterval",self.ui.checkFreq.value())
self.trayIcon.setIcon(QIcon(":icons/mailbox_empty.png")) settings.setValue("Notify", self.ui.boolifNotify.isChecked())
settings.beginGroup(account)
settings.setValue("MailServer",self.ui.txtboxMailServer.text())
settings.setValue("Port",self.ui.txtboxPort.text())
settings.setValue("Login",self.ui.txtboxLogin.text())
settings.setValue("Password",self.ui.txtboxPassword.text())
settings.setValue("SSL",self.ui.boolifSSL.isChecked())
settings.endGroup()
def mailboxFull(self): def SettingsRemove(self,group):
self.trayIcon.setToolTip ("You have "+ str(Mail().checkMail())+" unread letters") settings.beginGroup(group)
self.trayIcon.setIcon(QIcon(":icons/mailbox_full.png")) settings.remove("")
notify ("You have "+ str(Mail().checkMail())+" unread letters") settings.endGroup()
def checkNow (self): def btnOK_clicked(self):
if Mail().checkMail() == 0: self.SettingsSave(self.ui.comboAccounts.currentText())
self.mailboxEmpty()
notify("You have no unread mail") if (settings.value("MailServer") == "" or settings.value("Port") == "" or settings.value("Login") == "" or settings.value("Password") == ""):
QMessageBox.critical(self, "Warning","You should fill all fields in IMAP settings!")
self.show()
mail_check()
self.ui.lblTestOutput.setText("")
self.stop()
self.start()
def btnCancel_clicked(self):
self.SettingsRestore()
self.ui.lblTestOutput.setText("")
def btnTestConnection_clicked(self):
try:
if self.ui.boolifSSL.isChecked:
self.imap = imaplib.IMAP4_SSL(self.ui.txtboxMailServer.text(), self.ui.txtboxPort.text())
else: else:
self.mailboxFull() self.imap = imaplib.IMAP4(self.ui.txtboxMailServer.text(), self.ui.txtboxPort.text())
self.imap.login(self.ui.txtboxLogin.text(), self.ui.txtboxPassword.text())
output = "Connection was established successfully"
except:
output = "Unable to establish connection to mailbox"
finally:
self.ui.lblTestOutput.setText(output)
def btnAddAccount_clicked(self):
GroupName = QInputDialog.getText(self,"Enter account name","Enter account name",QLineEdit.Normal,"")
if (GroupName[0]):
self.ui.comboAccounts.addItem(GroupName[0])
self.ui.comboAccounts.setCurrentText(GroupName[0])
def btnRenameAccount_clicked(self):
Index = self.ui.comboAccounts.currentIndex()
OldGroupName = self.ui.comboAccounts.currentText()
GroupName = QInputDialog.getText(self,"Enter account name","Enter account name",QLineEdit.Normal,self.ui.comboAccounts.currentText())
if (GroupName[0]):
self.SettingsSave(GroupName[0])
self.ui.comboAccounts.setItemText(Index, GroupName[0])
self.ui.comboAccounts.setCurrentText(GroupName[0])
self.SettingsRemove(OldGroupName)
def btnSaveAccount_clicked(self):
self.SettingsSave(self.ui.comboAccounts.currentText())
self.ui.lblTestOutput.setText("Account saved")
def btnRemoveAccount_clicked(self):
reply = QMessageBox.warning(self, 'Warning!', "Delete this account permanently?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if (reply == QMessageBox.Yes):
Index = self.ui.comboAccounts.currentIndex()
GroupName = self.ui.comboAccounts.currentText()
self.ui.comboAccounts.removeItem(Index)
self.SettingsRemove(GroupName)
# Check if account doesn't exist, it creates default one
if (AccountExist() == False):
self.ui.comboAccounts.addItem("Default")
self.ui.comboAccounts.setCurrentText("Default")
def comboAccounts_changed(self):
self.ui.lblTestOutput.setText("")
settings.beginGroup(self.ui.comboAccounts.currentText())
self.ui.txtboxMailServer.setText(settings.value("MailServer"))
self.ui.txtboxPort.setText(settings.value("Port"))
self.ui.txtboxLogin.setText(settings.value("Login"))
self.ui.txtboxPassword.setText(settings.value("Password"))
self.ui.boolifSSL.setChecked(bool(settings.value("SSL")))
settings.endGroup()
def aboutShow(self):
if (about.isMinimized):
about.hide()
about.show()
about.activateWindow()
def detailsShow(self):
details.show()
details.activateWindow()
def trayIconActivated(self, reason):
if reason in (QSystemTrayIcon.Trigger, QSystemTrayIcon.DoubleClick):
details.show()
details.activateWindow()
def start(self):
if (GlobalSettingsExist() and AccountExist()):
CheckInterval = 1000*60*int(settings.value("CheckInterval"))
else:
CheckInterval = 1000*60*5
self.timer.setInterval (CheckInterval)
self.timer.start()
def stop (self):
self.timer.stop()
class About(QDialog):
def __init__(self):
super(About, self).__init__()
self.ui = Ui_about()
self.ui.setupUi(self)
self.setWindowFlags(QtCore.Qt.Tool)
self.setFixedSize(511,334)
self.ui.lblNameVersion.setText(programTitle + " " + programVersion)
f = QtCore.QFile(":/LICENSE.txt")
if f.open(QtCore.QIODevice.ReadOnly | QtCore.QFile.Text):
text = QtCore.QTextStream(f).readAll()
f.close()
self.ui.txtLicense.setPlainText(text)
def closeEvent(self, event): def closeEvent(self, event):
print ("Closing the app") event.ignore()
self.hide()
class Details(QDialog):
def __init__(self):
super(Details, self).__init__()
self.ui = Ui_Details()
self.ui.setupUi(self)
self.setWindowFlags(QtCore.Qt.Window)
self.ui.btnRefresh.clicked.connect(self.Refresh_clicked)
if (settings.contains("Details_width") and settings.contains("Details_height")):
width = int(settings.value("Details_width"))
height = int(settings.value("Details_height"))
self.resize(width,height)
def closeEvent(self, event):
event.ignore()
settings.setValue("Details_width",self.width())
settings.setValue("Details_height",self.height())
self.hide()
def Refresh_clicked(self):
mail_check()
# Common functions # Common functions
class Mail(): class Mail():
def __init__(self): def __init__(self):
self.user= 'YOUR_MAILBOX_LOGIN' socket.setdefaulttimeout(5)
self.password= 'YOUR_MAILBOX_PASSWORD'
self.M = imaplib.IMAP4_SSL('MAIL_SERVER', 'PORT(i.e 993)') def login(self,mailserver,port,user,password,ssl):
self.M.login(self.user, self.password) try:
if ssl:
self.imap = imaplib.IMAP4_SSL(mailserver, port)
else:
self.imap = imaplib.IMAP4(mailserver, port)
self.imap.login(user, password)
return True
except:
print("Login error")
return False
def checkMail(self): def checkMail(self):
self.M.select() try:
self.unRead = self.M.search(None, 'UnSeen') self.imap.select()
self.unRead = self.imap.search(None, 'UNSEEN')
return len(self.unRead[1][0].split()) return len(self.unRead[1][0].split())
except:
print("Unable to check mail")
return "ERROR"
def parseMail(self,header):
try:
output=[]
self.imap.select(readonly=True)
typ, data = self.imap.search(None, 'UNSEEN')
for num in data[0].split():
typ, data = self.imap.fetch(num, '(RFC822)')
raw_mail = data[0][1]
mail=email.message_from_bytes(raw_mail)
h=email.header.decode_header(mail.get(header))
if (h[0][1] != "unknown-8bit"):
msg = h[0][0].decode(h[0][1]) if h[0][1] else h[0][0]
else:
msg = "Unknown charset"
output.append(msg)
return output
except:
print("Unable to get mail data")
return "ERROR"
def mail_check(): def mail_check():
if Mail().checkMail() == 0: details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Starting mail check")
window.mailboxEmpty() mail_count = 0
AllFroms=[]
AllSubjs=[]
AllDates=[]
details.ui.tableWidget.clearContents()
details.ui.tableWidget.setRowCount(0)
details.ui.tableWidget.setColumnCount(0)
if (GlobalSettingsExist() and AccountExist()):
m = Mail()
groups = settings.childGroups()
for i in range (len(groups)):
settings.beginGroup(groups[i])
group = groups[i]
user = settings.value("Login")
password = settings.value("Password")
mailserver = settings.value("MailServer")
port = settings.value("Port")
ssl = settings.value("SSL")
settings.endGroup()
if m.login(mailserver,port,user,password,ssl):
if (mail_count == "ERROR" or m.checkMail() == "ERROR"):
mail_count = "ERROR"
else: else:
window.mailboxFull() mail_count += m.checkMail()
AllFroms.extend(m.parseMail("From"))
AllSubjs.extend(m.parseMail("Subject"))
AllDates.extend(m.parseMail("Date"))
else:
mail_count = "CONNECTION_ERROR"
else:
mail_count = "CONFIGURATION_ERROR"
# Parsing mail_count values
if mail_count == 0:
# When mailbox have not unread letters
window.trayIcon.setToolTip ("You have no unread mail")
# Draw text on icon
pixmap = QtGui.QPixmap(QtGui.QPixmap(":icons/mailbox_empty.png"))
painter = QtGui.QPainter(pixmap)
painter.setPen(QtGui.QColor(255, 0, 0))
painter.setFont(QtGui.QFont('Arial', 100,QtGui.QFont.Bold))
painter.drawText(QtCore.QRectF(pixmap.rect()), QtCore.Qt.AlignCenter, "0")
painter.end()
# End drawing text on icon
window.trayIcon.setIcon(QtGui.QIcon(pixmap))
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Mail check completed. You have no unread letters")
elif mail_count == "ERROR":
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
window.trayIcon.setToolTip ("Error checking mail.")
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Error checking mail")
elif mail_count == "CONNECTION_ERROR":
window.trayIcon.setToolTip("Unable to establish connection to mailbox. Check your mail settings and make sure that you have not network problems.")
notify("Unable to establish connection to mailbox. Check your mail settings and make sure that you have not network problems.")
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Unable to establish connection to mailbox. Check your mail settings and make sure that you have not network problems")
elif mail_count == "CONFIGURATION_ERROR":
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
window.trayIcon.setToolTip("Cannot find configuration file. You should give access to your mailbox")
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Cannot find configuration file. You should give access to your mailbox")
else:
# When mailbox has unread letters
window.trayIcon.setToolTip ("You have "+ str(mail_count)+" unread letters")
# Draw text on icon
pixmap = QtGui.QPixmap(QtGui.QPixmap(":icons/mailbox_full.png"))
painter = QtGui.QPainter(pixmap)
painter.setPen(QtGui.QColor(255, 255, 255))
painter.setFont(QtGui.QFont('Arial', 100,QtGui.QFont.Bold))
painter.drawText(QtCore.QRectF(pixmap.rect()), QtCore.Qt.AlignCenter, str(mail_count))
painter.end()
# End drawing text on icon
window.trayIcon.setIcon(QtGui.QIcon(pixmap))
# Popup notification appears only if mail count changed since last check
if (mail_count != window.lastCheckCount):
notify ("You have "+ str(mail_count) +" unread letters")
# Filling table
data = {"From":AllFroms,
"Subject":AllSubjs,
"Date":AllDates,}
details.ui.tableWidget.setRowCount(len(AllFroms))
details.ui.tableWidget.setColumnCount(3)
#Enter data onto Table
try:
horHeaders = []
for n, key in enumerate(sorted(data.keys())):
#print(data.keys())
horHeaders.append(key)
for m, item in enumerate(data[key]):
newitem = QtWidgets.QTableWidgetItem(item)
details.ui.tableWidget.setItem(m, n, newitem)
except:
print("Unable to load some data")
pass
#Add Header
details.ui.tableWidget.setHorizontalHeaderLabels(horHeaders)
#Adjust size of Table
details.ui.tableWidget.resizeColumnsToContents()
details.ui.tableWidget.resizeRowsToContents()
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Mail check completed. You have "+ str(mail_count) +" unread letters")
# check was successfull, lastCheckCount is updating
window.lastCheckCount = mail_count
def notify(message): def notify(message):
try:
if settings.value("Notify"):
subprocess.Popen(['notify-send', programTitle, message]) subprocess.Popen(['notify-send', programTitle, message])
return return
except:
print(message)
class Thread(QThread):
def __init__(self):
QThread.__init__(self)
def run(self):
timer = QTimer()
timer.timeout.connect(mail_check)
timer.start(1000*60*5)
timers.append(timer)
self.exec_()
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
app = QApplication(sys.argv) app = QApplication(sys.argv)
if not QSystemTrayIcon.isSystemTrayAvailable(): systemtray_timeout = 0
# Check if DE supports system tray
while not QSystemTrayIcon.isSystemTrayAvailable():
systemtray_timeout += 1
time.sleep (20)
if systemtray_timeout == 5:
QMessageBox.critical(None, "Mail notifier", QMessageBox.critical(None, "Mail notifier",
"I couldn't detect any system tray on this system.") "I couldn't detect any system tray on this system.")
sys.exit(1) sys.exit(1)
QApplication.setQuitOnLastWindowClosed(False) QApplication.setQuitOnLastWindowClosed(False)
window = Window() window = Window()
about = About()
details = Details()
if (GlobalSettingsExist() and AccountExist()):
window.hide() window.hide()
else:
window.show()
# UI started. Starting required functions after UI start # UI started. Starting required functions after UI start
mail_check() mail_check()
thread_instance = Thread() window.start()
thread_instance.start()
sys.exit(app.exec_()) sys.exit(app.exec_())

View File

@ -1,8 +1,16 @@
<!DOCTYPE RCC><RCC version="1.0"> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>icons/details.png</file>
<file>LICENSE.txt</file>
<file>icons/save_account.png</file>
<file>icons/mailbox_empty.png</file> <file>icons/mailbox_empty.png</file>
<file>icons/mailbox_full.png</file> <file>icons/mailbox_full.png</file>
<file>icons/mailbox_error.png</file>
<file>icons/menu_quit.png</file> <file>icons/menu_quit.png</file>
<file>icons/check_now.png</file> <file>icons/check_now.png</file>
<file>icons/settings.png</file>
<file>icons/add_account.png</file>
<file>icons/remove_account.png</file>
<file>icons/rename_account.png</file>
</qresource> </qresource>
</RCC> </RCC>

File diff suppressed because it is too large Load Diff

BIN
screenshots/details-3.0.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

BIN
screenshots/screen2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
screenshots/screen3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

92
ui/about.ui Normal file
View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>about</class>
<widget class="QDialog" name="about">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>511</width>
<height>334</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Mail Notifier</string>
</property>
<property name="windowIcon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/mailbox_empty.png</normaloff>:/icons/mailbox_empty.png</iconset>
</property>
<widget class="QPlainTextEdit" name="txtLicense">
<property name="geometry">
<rect>
<x>50</x>
<y>120</y>
<width>381</width>
<height>201</height>
</rect>
</property>
<property name="plainText">
<string/>
</property>
</widget>
<widget class="QLabel" name="lblLogo">
<property name="geometry">
<rect>
<x>50</x>
<y>0</y>
<width>131</width>
<height>111</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources.qrc">:/icons/mailbox_empty.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="lblNameVersion">
<property name="geometry">
<rect>
<x>200</x>
<y>40</y>
<width>291</width>
<height>31</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>203</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Mail Notifier</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</widget>
<resources>
<include location="../resources.qrc"/>
</resources>
<connections/>
</ui>

82
ui/details.ui Normal file
View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Details</class>
<widget class="QDialog" name="Details">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1048</width>
<height>619</height>
</rect>
</property>
<property name="windowTitle">
<string>Mail Notifier</string>
</property>
<property name="windowIcon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/mailbox_empty.png</normaloff>:/icons/mailbox_empty.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="btnRefresh">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Refresh</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/check_now.png</normaloff>:/icons/check_now.png</iconset>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTableWidget" name="tableWidget"/>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="statusBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../resources.qrc"/>
</resources>
<connections/>
</ui>

444
ui/settings.ui Normal file
View File

@ -0,0 +1,444 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Settings</class>
<widget class="QDialog" name="Settings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>586</width>
<height>332</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Mail Notifier - Settings</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>../icons/mailbox_empty.png</normaloff>../icons/mailbox_empty.png</iconset>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>20</x>
<y>290</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QCheckBox" name="boolifNotify">
<property name="geometry">
<rect>
<x>21</x>
<y>42</y>
<width>231</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Use also pop-up notification</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>541</width>
<height>161</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>IMAP settings</string>
</property>
<widget class="QLineEdit" name="txtboxMailServer">
<property name="geometry">
<rect>
<x>90</x>
<y>30</y>
<width>181</width>
<height>22</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>mail.example.com</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>310</x>
<y>30</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>40</x>
<y>60</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Login</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>280</x>
<y>60</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
<widget class="QLineEdit" name="txtboxPassword">
<property name="geometry">
<rect>
<x>350</x>
<y>60</y>
<width>181</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="txtboxLogin">
<property name="geometry">
<rect>
<x>90</x>
<y>60</y>
<width>181</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>name@example.com</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>11</x>
<y>31</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Mail server</string>
</property>
</widget>
<widget class="QLineEdit" name="txtboxPort">
<property name="geometry">
<rect>
<x>350</x>
<y>30</y>
<width>41</width>
<height>22</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>143</string>
</property>
</widget>
<widget class="QCheckBox" name="boolifSSL">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>161</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Use SSL connection</string>
</property>
</widget>
<widget class="QPushButton" name="btnTestConnection">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>121</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Test connection</string>
</property>
</widget>
<widget class="QLabel" name="lblTestOutput">
<property name="geometry">
<rect>
<x>150</x>
<y>120</y>
<width>371</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>txtboxPort</zorder>
<zorder>txtboxMailServer</zorder>
<zorder>label_4</zorder>
<zorder>label_3</zorder>
<zorder>label_5</zorder>
<zorder>label_6</zorder>
<zorder>txtboxPassword</zorder>
<zorder>txtboxLogin</zorder>
<zorder>boolifSSL</zorder>
<zorder>btnTestConnection</zorder>
<zorder>lblTestOutput</zorder>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>181</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Check for unread mail every</string>
</property>
</widget>
<widget class="QSpinBox" name="checkFreq">
<property name="geometry">
<rect>
<x>200</x>
<y>15</y>
<width>52</width>
<height>23</height>
</rect>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="value">
<number>15</number>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>260</x>
<y>20</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>minutes</string>
</property>
</widget>
<widget class="QComboBox" name="comboAccounts">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>151</width>
<height>23</height>
</rect>
</property>
<property name="insertPolicy">
<enum>QComboBox::InsertAtCurrent</enum>
</property>
</widget>
<widget class="QPushButton" name="btnAddAccount">
<property name="geometry">
<rect>
<x>180</x>
<y>80</y>
<width>31</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>Add account</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/add_account.png</normalon>
</iconset>
</property>
</widget>
<widget class="QPushButton" name="btnRenameAccount">
<property name="geometry">
<rect>
<x>220</x>
<y>80</y>
<width>31</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>Rename account</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/rename_account.png</normalon>
</iconset>
</property>
</widget>
<widget class="QPushButton" name="btnRemoveAccount">
<property name="geometry">
<rect>
<x>300</x>
<y>80</y>
<width>31</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>Remove account</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/remove_account.png</normalon>
</iconset>
</property>
</widget>
<widget class="QPushButton" name="btnSaveAccount">
<property name="geometry">
<rect>
<x>260</x>
<y>80</y>
<width>31</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>Save account</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/save_account.png</normalon>
</iconset>
</property>
</widget>
</widget>
<resources>
<include location="../resources.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Settings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Settings</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

52
ui_about.py Normal file
View File

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/about.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_about(object):
def setupUi(self, about):
about.setObjectName("about")
about.resize(511, 334)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(about.sizePolicy().hasHeightForWidth())
about.setSizePolicy(sizePolicy)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/mailbox_empty.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
about.setWindowIcon(icon)
self.txtLicense = QtWidgets.QPlainTextEdit(about)
self.txtLicense.setGeometry(QtCore.QRect(50, 120, 381, 201))
self.txtLicense.setPlainText("")
self.txtLicense.setObjectName("txtLicense")
self.lblLogo = QtWidgets.QLabel(about)
self.lblLogo.setGeometry(QtCore.QRect(50, 0, 131, 111))
self.lblLogo.setText("")
self.lblLogo.setPixmap(QtGui.QPixmap(":/icons/mailbox_empty.png"))
self.lblLogo.setScaledContents(True)
self.lblLogo.setObjectName("lblLogo")
self.lblNameVersion = QtWidgets.QLabel(about)
self.lblNameVersion.setGeometry(QtCore.QRect(200, 40, 291, 31))
self.lblNameVersion.setMinimumSize(QtCore.QSize(203, 0))
font = QtGui.QFont()
font.setPointSize(20)
font.setBold(True)
font.setWeight(75)
self.lblNameVersion.setFont(font)
self.lblNameVersion.setScaledContents(True)
self.lblNameVersion.setObjectName("lblNameVersion")
self.retranslateUi(about)
QtCore.QMetaObject.connectSlotsByName(about)
def retranslateUi(self, about):
_translate = QtCore.QCoreApplication.translate
about.setWindowTitle(_translate("about", "Mail Notifier"))
self.lblNameVersion.setText(_translate("about", "Mail Notifier"))
import resources_rc

61
ui_details.py Normal file
View File

@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/details.ui'
#
# Created by: PyQt5 UI code generator 5.6.1.dev1604271126
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Details(object):
def setupUi(self, Details):
Details.setObjectName("Details")
Details.resize(1048, 619)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/mailbox_empty.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
Details.setWindowIcon(icon)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Details)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.btnRefresh = QtWidgets.QPushButton(Details)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.btnRefresh.sizePolicy().hasHeightForWidth())
self.btnRefresh.setSizePolicy(sizePolicy)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(":/icons/check_now.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.btnRefresh.setIcon(icon1)
self.btnRefresh.setObjectName("btnRefresh")
self.verticalLayout_2.addWidget(self.btnRefresh)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.tableWidget = QtWidgets.QTableWidget(Details)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(0)
self.tableWidget.setRowCount(0)
self.horizontalLayout.addWidget(self.tableWidget)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.statusBar = QtWidgets.QLabel(Details)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.statusBar.sizePolicy().hasHeightForWidth())
self.statusBar.setSizePolicy(sizePolicy)
self.statusBar.setMinimumSize(QtCore.QSize(0, 0))
self.statusBar.setBaseSize(QtCore.QSize(0, 0))
self.statusBar.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.statusBar.setFrameShadow(QtWidgets.QFrame.Sunken)
self.statusBar.setText("")
self.statusBar.setObjectName("statusBar")
self.verticalLayout_2.addWidget(self.statusBar)
self.retranslateUi(Details)
QtCore.QMetaObject.connectSlotsByName(Details)
def retranslateUi(self, Details):
_translate = QtCore.QCoreApplication.translate
Details.setWindowTitle(_translate("Details", "Mail Notifier"))
self.btnRefresh.setText(_translate("Details", "Refresh"))
import resources_rc

174
ui_settings.py Normal file
View File

@ -0,0 +1,174 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/settings.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Settings(object):
def setupUi(self, Settings):
Settings.setObjectName("Settings")
Settings.resize(586, 332)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Settings.sizePolicy().hasHeightForWidth())
Settings.setSizePolicy(sizePolicy)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("../icons/mailbox_empty.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
Settings.setWindowIcon(icon)
self.buttonBox = QtWidgets.QDialogButtonBox(Settings)
self.buttonBox.setGeometry(QtCore.QRect(20, 290, 341, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.boolifNotify = QtWidgets.QCheckBox(Settings)
self.boolifNotify.setGeometry(QtCore.QRect(21, 42, 231, 20))
self.boolifNotify.setChecked(True)
self.boolifNotify.setObjectName("boolifNotify")
self.groupBox = QtWidgets.QGroupBox(Settings)
self.groupBox.setGeometry(QtCore.QRect(20, 120, 541, 161))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth())
self.groupBox.setSizePolicy(sizePolicy)
self.groupBox.setObjectName("groupBox")
self.txtboxMailServer = QtWidgets.QLineEdit(self.groupBox)
self.txtboxMailServer.setGeometry(QtCore.QRect(90, 30, 181, 22))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.txtboxMailServer.sizePolicy().hasHeightForWidth())
self.txtboxMailServer.setSizePolicy(sizePolicy)
self.txtboxMailServer.setText("")
self.txtboxMailServer.setObjectName("txtboxMailServer")
self.label_4 = QtWidgets.QLabel(self.groupBox)
self.label_4.setGeometry(QtCore.QRect(310, 30, 31, 21))
self.label_4.setObjectName("label_4")
self.label_5 = QtWidgets.QLabel(self.groupBox)
self.label_5.setGeometry(QtCore.QRect(40, 60, 41, 21))
self.label_5.setObjectName("label_5")
self.label_6 = QtWidgets.QLabel(self.groupBox)
self.label_6.setGeometry(QtCore.QRect(280, 60, 61, 21))
self.label_6.setObjectName("label_6")
self.txtboxPassword = QtWidgets.QLineEdit(self.groupBox)
self.txtboxPassword.setGeometry(QtCore.QRect(350, 60, 181, 22))
self.txtboxPassword.setText("")
self.txtboxPassword.setEchoMode(QtWidgets.QLineEdit.Password)
self.txtboxPassword.setPlaceholderText("")
self.txtboxPassword.setObjectName("txtboxPassword")
self.txtboxLogin = QtWidgets.QLineEdit(self.groupBox)
self.txtboxLogin.setGeometry(QtCore.QRect(90, 60, 181, 22))
self.txtboxLogin.setText("")
self.txtboxLogin.setObjectName("txtboxLogin")
self.label_3 = QtWidgets.QLabel(self.groupBox)
self.label_3.setGeometry(QtCore.QRect(11, 31, 71, 21))
self.label_3.setObjectName("label_3")
self.txtboxPort = QtWidgets.QLineEdit(self.groupBox)
self.txtboxPort.setGeometry(QtCore.QRect(350, 30, 41, 22))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.txtboxPort.sizePolicy().hasHeightForWidth())
self.txtboxPort.setSizePolicy(sizePolicy)
self.txtboxPort.setText("")
self.txtboxPort.setObjectName("txtboxPort")
self.boolifSSL = QtWidgets.QCheckBox(self.groupBox)
self.boolifSSL.setGeometry(QtCore.QRect(10, 90, 161, 20))
self.boolifSSL.setObjectName("boolifSSL")
self.btnTestConnection = QtWidgets.QPushButton(self.groupBox)
self.btnTestConnection.setEnabled(True)
self.btnTestConnection.setGeometry(QtCore.QRect(10, 120, 121, 22))
self.btnTestConnection.setToolTip("")
self.btnTestConnection.setObjectName("btnTestConnection")
self.lblTestOutput = QtWidgets.QLabel(self.groupBox)
self.lblTestOutput.setGeometry(QtCore.QRect(150, 120, 371, 21))
self.lblTestOutput.setText("")
self.lblTestOutput.setObjectName("lblTestOutput")
self.txtboxPort.raise_()
self.txtboxMailServer.raise_()
self.label_4.raise_()
self.label_3.raise_()
self.label_5.raise_()
self.label_6.raise_()
self.txtboxPassword.raise_()
self.txtboxLogin.raise_()
self.boolifSSL.raise_()
self.btnTestConnection.raise_()
self.lblTestOutput.raise_()
self.label = QtWidgets.QLabel(Settings)
self.label.setGeometry(QtCore.QRect(20, 20, 181, 16))
self.label.setObjectName("label")
self.checkFreq = QtWidgets.QSpinBox(Settings)
self.checkFreq.setGeometry(QtCore.QRect(200, 15, 52, 23))
self.checkFreq.setMinimum(1)
self.checkFreq.setMaximum(120)
self.checkFreq.setProperty("value", 15)
self.checkFreq.setObjectName("checkFreq")
self.label_2 = QtWidgets.QLabel(Settings)
self.label_2.setGeometry(QtCore.QRect(260, 20, 61, 16))
self.label_2.setObjectName("label_2")
self.comboAccounts = QtWidgets.QComboBox(Settings)
self.comboAccounts.setGeometry(QtCore.QRect(20, 80, 151, 23))
self.comboAccounts.setInsertPolicy(QtWidgets.QComboBox.InsertAtCurrent)
self.comboAccounts.setObjectName("comboAccounts")
self.btnAddAccount = QtWidgets.QPushButton(Settings)
self.btnAddAccount.setGeometry(QtCore.QRect(180, 80, 31, 23))
self.btnAddAccount.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(":/icons/add_account.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btnAddAccount.setIcon(icon1)
self.btnAddAccount.setObjectName("btnAddAccount")
self.btnRenameAccount = QtWidgets.QPushButton(Settings)
self.btnRenameAccount.setGeometry(QtCore.QRect(220, 80, 31, 23))
self.btnRenameAccount.setText("")
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(":/icons/rename_account.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btnRenameAccount.setIcon(icon2)
self.btnRenameAccount.setObjectName("btnRenameAccount")
self.btnRemoveAccount = QtWidgets.QPushButton(Settings)
self.btnRemoveAccount.setGeometry(QtCore.QRect(300, 80, 31, 23))
self.btnRemoveAccount.setText("")
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap(":/icons/remove_account.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btnRemoveAccount.setIcon(icon3)
self.btnRemoveAccount.setObjectName("btnRemoveAccount")
self.btnSaveAccount = QtWidgets.QPushButton(Settings)
self.btnSaveAccount.setGeometry(QtCore.QRect(260, 80, 31, 23))
self.btnSaveAccount.setText("")
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap(":/icons/save_account.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btnSaveAccount.setIcon(icon4)
self.btnSaveAccount.setObjectName("btnSaveAccount")
self.retranslateUi(Settings)
self.buttonBox.accepted.connect(Settings.accept)
self.buttonBox.rejected.connect(Settings.reject)
QtCore.QMetaObject.connectSlotsByName(Settings)
def retranslateUi(self, Settings):
_translate = QtCore.QCoreApplication.translate
Settings.setWindowTitle(_translate("Settings", "Mail Notifier - Settings"))
self.boolifNotify.setText(_translate("Settings", "Use also pop-up notification"))
self.groupBox.setTitle(_translate("Settings", "IMAP settings"))
self.txtboxMailServer.setPlaceholderText(_translate("Settings", "mail.example.com"))
self.label_4.setText(_translate("Settings", "Port"))
self.label_5.setText(_translate("Settings", "Login"))
self.label_6.setText(_translate("Settings", "Password"))
self.txtboxLogin.setPlaceholderText(_translate("Settings", "name@example.com"))
self.label_3.setText(_translate("Settings", "Mail server"))
self.txtboxPort.setPlaceholderText(_translate("Settings", "143"))
self.boolifSSL.setText(_translate("Settings", "Use SSL connection"))
self.btnTestConnection.setText(_translate("Settings", "Test connection"))
self.label.setText(_translate("Settings", "Check for unread mail every"))
self.label_2.setText(_translate("Settings", "minutes"))
self.btnAddAccount.setToolTip(_translate("Settings", "Add account"))
self.btnRenameAccount.setToolTip(_translate("Settings", "Rename account"))
self.btnRemoveAccount.setToolTip(_translate("Settings", "Remove account"))
self.btnSaveAccount.setToolTip(_translate("Settings", "Save account"))
import resources_rc