Browse Source

added save account button and account removal warning

master
Rinaldus 6 years ago
parent
commit
6a1dba2aae
  1. BIN
      icons/save_account.png
  2. 18
      mail-notifier.py
  3. 1
      resources.qrc
  4. 5580
      resources_rc.py
  5. 23
      ui/settings.ui
  6. 10
      ui_settings.py

BIN
icons/save_account.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

18
mail-notifier.py

@ -71,6 +71,7 @@ class Window(QDialog): @@ -71,6 +71,7 @@ class Window(QDialog):
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)
# Main timer
@ -173,14 +174,21 @@ class Window(QDialog): @@ -173,14 +174,21 @@ class Window(QDialog):
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("Acount saved")
def btnRemoveAccount_clicked(self):
Index = self.ui.comboAccounts.currentIndex()
GroupName = self.ui.comboAccounts.currentText()
self.ui.comboAccounts.removeItem(Index)
self.SettingsRemove(GroupName)
reply = QMessageBox.critical(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)
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"))
@ -298,5 +306,3 @@ if __name__ == '__main__': @@ -298,5 +306,3 @@ if __name__ == '__main__':
sys.exit(app.exec_())
# TODO:
# Separate mail count for each account
# New save account button
# Account removal warning dialog

1
resources.qrc

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>icons/save_account.png</file>
<file>icons/mailbox_empty.png</file>
<file>icons/mailbox_full.png</file>
<file>icons/mailbox_error.png</file>

5580
resources_rc.py

File diff suppressed because it is too large Load Diff

23
ui/settings.ui

@ -364,7 +364,7 @@ @@ -364,7 +364,7 @@
<widget class="QPushButton" name="btnRemoveAccount">
<property name="geometry">
<rect>
<x>260</x>
<x>300</x>
<y>80</y>
<width>31</width>
<height>23</height>
@ -382,6 +382,27 @@ @@ -382,6 +382,27 @@
</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"/>

10
ui_settings.py

@ -131,12 +131,19 @@ class Ui_Settings(object): @@ -131,12 +131,19 @@ class Ui_Settings(object):
self.btnRenameAccount.setIcon(icon2)
self.btnRenameAccount.setObjectName("btnRenameAccount")
self.btnRemoveAccount = QtWidgets.QPushButton(Settings)
self.btnRemoveAccount.setGeometry(QtCore.QRect(260, 80, 31, 23))
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)
@ -162,5 +169,6 @@ class Ui_Settings(object): @@ -162,5 +169,6 @@ class Ui_Settings(object):
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

Loading…
Cancel
Save