UI/EmailDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3190
a9a94491c4fd
child 3539
0c2dc1446ebf
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
73 super(EmailDialog, self).__init__(parent) 73 super(EmailDialog, self).__init__(parent)
74 self.setupUi(self) 74 self.setupUi(self)
75 75
76 self.__mode = mode 76 self.__mode = mode
77 if self.__mode == "feature": 77 if self.__mode == "feature":
78 self.setWindowTitle(self.trUtf8("Send feature request")) 78 self.setWindowTitle(self.tr("Send feature request"))
79 self.msgLabel.setText(self.trUtf8( 79 self.msgLabel.setText(self.tr(
80 "Enter your &feature request below." 80 "Enter your &feature request below."
81 " Version information is added automatically.")) 81 " Version information is added automatically."))
82 self.__toAddress = FeatureAddress 82 self.__toAddress = FeatureAddress
83 else: 83 else:
84 # default is bug 84 # default is bug
85 self.msgLabel.setText(self.trUtf8( 85 self.msgLabel.setText(self.tr(
86 "Enter your &bug description below." 86 "Enter your &bug description below."
87 " Version information is added automatically.")) 87 " Version information is added automatically."))
88 self.__toAddress = BugAddress 88 self.__toAddress = BugAddress
89 89
90 self.sendButton = self.buttonBox.addButton( 90 self.sendButton = self.buttonBox.addButton(
91 self.trUtf8("Send"), QDialogButtonBox.ActionRole) 91 self.tr("Send"), QDialogButtonBox.ActionRole)
92 self.sendButton.setEnabled(False) 92 self.sendButton.setEnabled(False)
93 self.sendButton.setDefault(True) 93 self.sendButton.setDefault(True)
94 94
95 height = self.height() 95 height = self.height()
96 self.mainSplitter.setSizes([int(0.7 * height), int(0.3 * height)]) 96 self.mainSplitter.setSizes([int(0.7 * height), int(0.3 * height)])
120 @param ev key event (QKeyEvent) 120 @param ev key event (QKeyEvent)
121 """ 121 """
122 if ev.key() == Qt.Key_Escape: 122 if ev.key() == Qt.Key_Escape:
123 res = E5MessageBox.yesNo( 123 res = E5MessageBox.yesNo(
124 self, 124 self,
125 self.trUtf8("Close dialog"), 125 self.tr("Close dialog"),
126 self.trUtf8("""Do you really want to close the dialog?""")) 126 self.tr("""Do you really want to close the dialog?"""))
127 if res: 127 if res:
128 self.reject() 128 self.reject()
129 129
130 def on_buttonBox_clicked(self, button): 130 def on_buttonBox_clicked(self, button):
131 """ 131 """
140 """ 140 """
141 Private slot to handle the rejected signal of the button box. 141 Private slot to handle the rejected signal of the button box.
142 """ 142 """
143 res = E5MessageBox.yesNo( 143 res = E5MessageBox.yesNo(
144 self, 144 self,
145 self.trUtf8("Close dialog"), 145 self.tr("Close dialog"),
146 self.trUtf8("""Do you really want to close the dialog?""")) 146 self.tr("""Do you really want to close the dialog?"""))
147 if res: 147 if res:
148 self.reject() 148 self.reject()
149 149
150 @pyqtSlot() 150 @pyqtSlot()
151 def on_sendButton_clicked(self): 151 def on_sendButton_clicked(self):
287 # mail server needs authentication 287 # mail server needs authentication
288 password = Preferences.getUser("MailServerPassword") 288 password = Preferences.getUser("MailServerPassword")
289 if not password: 289 if not password:
290 password, ok = QInputDialog.getText( 290 password, ok = QInputDialog.getText(
291 self, 291 self,
292 self.trUtf8("Mail Server Password"), 292 self.tr("Mail Server Password"),
293 self.trUtf8("Enter your mail server password"), 293 self.tr("Enter your mail server password"),
294 QLineEdit.Password) 294 QLineEdit.Password)
295 if not ok: 295 if not ok:
296 # abort 296 # abort
297 return False 297 return False
298 try: 298 try:
305 errorStr = e[1] 305 errorStr = e[1]
306 else: 306 else:
307 errorStr = str(e) 307 errorStr = str(e)
308 res = E5MessageBox.retryAbort( 308 res = E5MessageBox.retryAbort(
309 self, 309 self,
310 self.trUtf8("Send bug report"), 310 self.tr("Send bug report"),
311 self.trUtf8( 311 self.tr(
312 """<p>Authentication failed.<br>Reason: {0}</p>""") 312 """<p>Authentication failed.<br>Reason: {0}</p>""")
313 .format(errorStr), 313 .format(errorStr),
314 E5MessageBox.Critical) 314 E5MessageBox.Critical)
315 if res: 315 if res:
316 return self.__sendmail(msg) 316 return self.__sendmail(msg)
331 errorStr = e[1] 331 errorStr = e[1]
332 else: 332 else:
333 errorStr = str(e) 333 errorStr = str(e)
334 res = E5MessageBox.retryAbort( 334 res = E5MessageBox.retryAbort(
335 self, 335 self,
336 self.trUtf8("Send bug report"), 336 self.tr("Send bug report"),
337 self.trUtf8( 337 self.tr(
338 """<p>Message could not be sent.<br>Reason: {0}</p>""") 338 """<p>Message could not be sent.<br>Reason: {0}</p>""")
339 .format(errorStr), 339 .format(errorStr),
340 E5MessageBox.Critical) 340 E5MessageBox.Critical)
341 if res: 341 if res:
342 return self.__sendmail(msg) 342 return self.__sendmail(msg)
349 """ 349 """
350 Private slot to handle the Add... button. 350 Private slot to handle the Add... button.
351 """ 351 """
352 fname = E5FileDialog.getOpenFileName( 352 fname = E5FileDialog.getOpenFileName(
353 self, 353 self,
354 self.trUtf8("Attach file")) 354 self.tr("Attach file"))
355 if fname: 355 if fname:
356 self.attachFile(fname, False) 356 self.attachFile(fname, False)
357 357
358 def attachFile(self, fname, deleteFile): 358 def attachFile(self, fname, deleteFile):
359 """ 359 """

eric ide

mercurial