ProjectDjango/DjangoSendTestEmailDataDialog.py

changeset 125
d280acf98fb5
child 142
ecadd7fd0963
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ProjectDjango/DjangoSendTestEmailDataDialog.py	Sat Mar 24 19:11:39 2018 +0100
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2018 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to enter the data for the 'sendtestemail' command.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt5.QtWidgets import QDialog
+
+from .Ui_DjangoSendTestEmailDataDialog import Ui_DjangoSendTestEmailDataDialog
+
+
+class DjangoSendTestEmailDataDialog(QDialog, Ui_DjangoSendTestEmailDataDialog):
+    """
+    Class implementing a dialog to enter the data for the 'sendtestemail'
+    command.
+    """
+    def __init__(self, parent=None):
+        """
+        Constructor
+        
+        @param parent reference to the parent widget
+        @type QWidget
+        """
+        super(DjangoSendTestEmailDataDialog, self).__init__(parent)
+        self.setupUi(self)
+    
+    def getData(self):
+        """
+        Public method to get the dialog data.
+        
+        @return tuple containing a flag indicating to send to the defined
+            managers, a flag indicating to send to the defined administrators
+            and a list of recipients
+        @rtype tuple of (bool, bool, list of str)
+        """
+        recipientsStr = self.recipientsEdit.toPlainText()
+        recipients = [r.strip()
+                      for r in recipientsStr.splitlines()
+                      if r.strip()]
+        
+        return (
+            self.managersCheckBox.isChecked(),
+            self.adminsCheckBox.isChecked(),
+            recipients,
+        )

eric ide

mercurial