10 import smtplib |
10 import smtplib |
11 import socket |
11 import socket |
12 |
12 |
13 from PyQt6.QtCore import pyqtSlot |
13 from PyQt6.QtCore import pyqtSlot |
14 |
14 |
|
15 from eric7 import Preferences |
15 from eric7.EricWidgets import EricMessageBox |
16 from eric7.EricWidgets import EricMessageBox |
16 from eric7.EricWidgets.EricApplication import ericApp |
|
17 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
17 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
18 |
|
19 from eric7.EricNetwork.EricGoogleMailHelpers import getInstallCommand, RequiredPackages |
|
20 |
18 |
21 from .ConfigurationPageBase import ConfigurationPageBase |
19 from .ConfigurationPageBase import ConfigurationPageBase |
22 from .Ui_EmailPage import Ui_EmailPage |
20 from .Ui_EmailPage import Ui_EmailPage |
23 |
|
24 from eric7 import Globals, Preferences |
|
25 |
21 |
26 |
22 |
27 class EmailPage(ConfigurationPageBase, Ui_EmailPage): |
23 class EmailPage(ConfigurationPageBase, Ui_EmailPage): |
28 """ |
24 """ |
29 Class implementing the Email configuration page. |
25 Class implementing the Email configuration page. |
231 |
227 |
232 helpStr = GoogleMailHelp() |
228 helpStr = GoogleMailHelp() |
233 except ImportError: |
229 except ImportError: |
234 helpStr = self.tr( |
230 helpStr = self.tr( |
235 "<p>The Google Mail Client API is not installed." |
231 "<p>The Google Mail Client API is not installed." |
236 " Use <code>{0}</code> to install it.</p>" |
232 " Use the <b>{0}</b> button to install it.</p>" |
237 ).format(getInstallCommand()) |
233 ).format(self.googleInstallButton.text()) |
238 |
234 |
239 from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog |
235 from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog |
240 |
236 |
241 self.__helpDialog = EricSimpleHelpDialog( |
237 self.__helpDialog = EricSimpleHelpDialog( |
242 title=self.tr("Gmail API Help"), helpStr=helpStr, parent=self |
238 title=self.tr("Gmail API Help"), helpStr=helpStr, parent=self |
247 @pyqtSlot() |
243 @pyqtSlot() |
248 def on_googleInstallButton_clicked(self): |
244 def on_googleInstallButton_clicked(self): |
249 """ |
245 """ |
250 Private slot to install the required packages for use of Google Mail. |
246 Private slot to install the required packages for use of Google Mail. |
251 """ |
247 """ |
252 pip = ericApp().getObject("Pip") |
248 from eric7.EricNetwork.EricGoogleMailHelpers import installGoogleAPIPackages |
253 pip.installPackages(RequiredPackages, interpreter=Globals.getPythonExecutable()) |
249 |
|
250 installGoogleAPIPackages() |
254 self.__checkGoogleMail() |
251 self.__checkGoogleMail() |
255 |
252 |
256 @pyqtSlot() |
253 @pyqtSlot() |
257 def on_googleCheckAgainButton_clicked(self): |
254 def on_googleCheckAgainButton_clicked(self): |
258 """ |
255 """ |
301 self.googleMailCheckBox.setChecked(False) |
298 self.googleMailCheckBox.setChecked(False) |
302 self.googleMailCheckBox.setEnabled(False) |
299 self.googleMailCheckBox.setEnabled(False) |
303 self.googleMailInfoLabel.setText( |
300 self.googleMailInfoLabel.setText( |
304 self.tr( |
301 self.tr( |
305 "<p>The Google Mail Client API is not installed." |
302 "<p>The Google Mail Client API is not installed." |
306 " Use <code>{0}</code> to install it.</p>" |
303 " Use the <b>{0}</b> button to install it.</p>" |
307 ).format(getInstallCommand()) |
304 ).format(self.googleInstallButton.text()) |
308 ) |
305 ) |
309 self.googleMailInfoLabel.show() |
306 self.googleMailInfoLabel.show() |
310 self.googleHelpButton.setEnabled(False) |
307 self.googleHelpButton.setEnabled(False) |
311 Preferences.setUser("UseGoogleMailOAuth2", False) |
308 Preferences.setUser("UseGoogleMailOAuth2", False) |
312 |
309 |