UI/EmailDialog.py

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

eric ide

mercurial