5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog for the configuration of eric6. |
7 Module implementing a dialog for the configuration of eric6. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
|
11 |
10 |
12 import os |
11 import os |
13 import types |
12 import types |
14 |
13 |
15 from PyQt5.QtCore import pyqtSignal, pyqtSlot, PYQT_VERSION, Qt, QMetaObject, \ |
14 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QMetaObject, QRect |
16 QRect |
|
17 from PyQt5.QtGui import QPixmap |
15 from PyQt5.QtGui import QPixmap |
18 from PyQt5.QtWidgets import QSizePolicy, QSpacerItem, QWidget, QTreeWidget, \ |
16 from PyQt5.QtWidgets import ( |
19 QStackedWidget, QDialog, QSplitter, QScrollArea, QApplication, \ |
17 QSizePolicy, QSpacerItem, QWidget, QTreeWidget, QStackedWidget, QDialog, |
20 QDialogButtonBox, QFrame, QVBoxLayout, QTreeWidgetItem, QLabel |
18 QSplitter, QScrollArea, QApplication, QDialogButtonBox, QFrame, |
|
19 QVBoxLayout, QTreeWidgetItem, QLabel |
|
20 ) |
21 |
21 |
22 from E5Gui.E5Application import e5App |
22 from E5Gui.E5Application import e5App |
23 from E5Gui.E5LineEdit import E5ClearableLineEdit |
23 from E5Gui.E5LineEdit import E5ClearableLineEdit |
24 from E5Gui import E5MessageBox |
24 from E5Gui import E5MessageBox |
25 from E5Gui.E5MainWindow import E5MainWindow |
25 from E5Gui.E5MainWindow import E5MainWindow |
26 |
26 |
27 from Globals import isMacPlatform, qVersionTuple, getWebBrowserSupport |
27 from Globals import isMacPlatform, getWebBrowserSupport |
28 |
28 |
29 import Preferences |
29 import Preferences |
30 |
30 |
31 import UI.PixmapCache |
31 import UI.PixmapCache |
32 |
32 |
356 [self.tr("Appearance"), "preferences-styles.png", |
356 [self.tr("Appearance"), "preferences-styles.png", |
357 "WebBrowserAppearancePage", "0webBrowserPage", None], |
357 "WebBrowserAppearancePage", "0webBrowserPage", None], |
358 "webBrowserPage": |
358 "webBrowserPage": |
359 [self.tr("eric6 Web Browser"), "ericWeb.png", |
359 [self.tr("eric6 Web Browser"), "ericWeb.png", |
360 "WebBrowserPage", "0webBrowserPage", None], |
360 "WebBrowserPage", "0webBrowserPage", None], |
361 "helpFlashCookieManagerPage": |
361 "webBrowserFlashCookieManagerPage": |
362 [self.tr("Flash Cookie Manager"), |
362 [self.tr("Flash Cookie Manager"), |
363 "flashCookie16.png", |
363 "flashCookie16.png", |
364 "HelpFlashCookieManagerPage", "0webBrowserPage", None], |
364 "WebBrowserFlashCookieManagerPage", "0webBrowserPage", |
|
365 None], |
365 "webBrowserVirusTotalPage": |
366 "webBrowserVirusTotalPage": |
366 [self.tr("VirusTotal Interface"), "virustotal.png", |
367 [self.tr("VirusTotal Interface"), "virustotal.png", |
367 "WebBrowserVirusTotalPage", "0webBrowserPage", None], |
368 "WebBrowserVirusTotalPage", "0webBrowserPage", None], |
|
369 "webBrowserSpellCheckingPage": |
|
370 [self.tr("Spell checking"), |
|
371 "preferences-spellchecking.png", |
|
372 "WebBrowserSpellCheckingPage", "0webBrowserPage", |
|
373 None], |
368 }) |
374 }) |
369 if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800: |
|
370 self.configItems.update({ |
|
371 "webBrowserSpellCheckingPage": |
|
372 [self.tr("Spell checking"), |
|
373 "preferences-spellchecking.png", |
|
374 "WebBrowserSpellCheckingPage", "0webBrowserPage", |
|
375 None], |
|
376 }) |
|
377 else: |
|
378 try: |
|
379 from PyQt5 import QtWebKit # __IGNORE_WARNING__ |
|
380 self.configItems.update({ |
|
381 "0helpBrowserPage": |
|
382 [self.tr("Web Browser"), "ericWeb.png", |
|
383 None, None, None], |
|
384 "helpAppearancePage": |
|
385 [self.tr("Appearance"), "preferences-styles.png", |
|
386 "HelpAppearancePage", "0helpBrowserPage", None], |
|
387 "helpWebBrowserPage": |
|
388 [self.tr("eric6 Web Browser"), "ericWeb.png", |
|
389 "HelpWebBrowserPage", "0helpBrowserPage", None], |
|
390 "helpFlashCookieManagerPage": |
|
391 [self.tr("Flash Cookie Manager"), |
|
392 "flashCookie16.png", |
|
393 "HelpFlashCookieManagerPage", "0helpBrowserPage", |
|
394 None], |
|
395 "helpVirusTotalPage": |
|
396 [self.tr("VirusTotal Interface"), "virustotal.png", |
|
397 "HelpVirusTotalPage", "0helpBrowserPage", None], |
|
398 }) |
|
399 except ImportError: |
|
400 pass |
|
401 |
375 |
402 self.configItems.update( |
376 self.configItems.update( |
403 e5App().getObject("PluginManager").getPluginConfigData()) |
377 e5App().getObject("PluginManager").getPluginConfigData()) |
404 |
|
405 elif displayMode == ConfigurationWidget.HelpBrowserMode: |
|
406 self.configItems = { |
|
407 # key : [display string, pixmap name, dialog module name or |
|
408 # page creation function, parent key, |
|
409 # reference to configuration page (must always be last)] |
|
410 # The dialog module must have the module function 'create' to |
|
411 # create the configuration page. This must have the method |
|
412 # 'save' to save the settings. |
|
413 "interfacePage": |
|
414 [self.tr("Interface"), "preferences-interface.png", |
|
415 "HelpInterfacePage", None, None], |
|
416 "networkPage": |
|
417 [self.tr("Network"), "preferences-network.png", |
|
418 "NetworkPage", None, None], |
|
419 "printerPage": |
|
420 [self.tr("Printer"), "preferences-printer.png", |
|
421 "PrinterPage", None, None], |
|
422 "securityPage": |
|
423 [self.tr("Security"), "preferences-security.png", |
|
424 "SecurityPage", None, None], |
|
425 |
|
426 "helpDocumentationPage": |
|
427 [self.tr("Help Documentation"), |
|
428 "preferences-helpdocumentation.png", |
|
429 "HelpDocumentationPage", None, None], |
|
430 } |
|
431 try: |
|
432 from PyQt5 import QtWebKit # __IGNORE_WARNING__ |
|
433 self.configItems.update({ |
|
434 "helpAppearancePage": |
|
435 [self.tr("Appearance"), "preferences-styles.png", |
|
436 "HelpAppearancePage", None, None], |
|
437 "helpFlashCookieManagerPage": |
|
438 [self.tr("Flash Cookie Manager"), |
|
439 "flashCookie16.png", |
|
440 "HelpFlashCookieManagerPage", None, None], |
|
441 "helpVirusTotalPage": |
|
442 [self.tr("VirusTotal Interface"), "virustotal.png", |
|
443 "HelpVirusTotalPage", None, None], |
|
444 "helpWebBrowserPage": |
|
445 [self.tr("eric6 Web Browser"), "ericWeb.png", |
|
446 "HelpWebBrowserPage", None, None], |
|
447 }) |
|
448 except ImportError: |
|
449 pass |
|
450 |
378 |
451 elif displayMode == ConfigurationWidget.WebBrowserMode: |
379 elif displayMode == ConfigurationWidget.WebBrowserMode: |
452 self.configItems = { |
380 self.configItems = { |
453 # key : [display string, pixmap name, dialog module name or |
381 # key : [display string, pixmap name, dialog module name or |
454 # page creation function, parent key, |
382 # page creation function, parent key, |
479 "WebBrowserAppearancePage", None, None], |
407 "WebBrowserAppearancePage", None, None], |
480 "webBrowserPage": |
408 "webBrowserPage": |
481 [self.tr("eric6 Web Browser"), "ericWeb.png", |
409 [self.tr("eric6 Web Browser"), "ericWeb.png", |
482 "WebBrowserPage", None, None], |
410 "WebBrowserPage", None, None], |
483 |
411 |
484 "helpFlashCookieManagerPage": |
412 "webBrowserFlashCookieManagerPage": |
485 [self.tr("Flash Cookie Manager"), |
413 [self.tr("Flash Cookie Manager"), |
486 "flashCookie16.png", |
414 "flashCookie16.png", |
487 "HelpFlashCookieManagerPage", None, None], |
415 "WebBrowserFlashCookieManagerPage", None, None], |
488 "webBrowserVirusTotalPage": |
416 "webBrowserVirusTotalPage": |
489 [self.tr("VirusTotal Interface"), "virustotal.png", |
417 [self.tr("VirusTotal Interface"), "virustotal.png", |
490 "WebBrowserVirusTotalPage", None, None], |
418 "WebBrowserVirusTotalPage", None, None], |
|
419 |
|
420 "webBrowserSpellCheckingPage": |
|
421 [self.tr("Spell checking"), |
|
422 "preferences-spellchecking.png", |
|
423 "WebBrowserSpellCheckingPage", None, None], |
491 } |
424 } |
492 |
|
493 if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800: |
|
494 self.configItems.update({ |
|
495 "webBrowserSpellCheckingPage": |
|
496 [self.tr("Spell checking"), |
|
497 "preferences-spellchecking.png", |
|
498 "WebBrowserSpellCheckingPage", None, None], |
|
499 }) |
|
500 |
425 |
501 elif displayMode == ConfigurationWidget.TrayStarterMode: |
426 elif displayMode == ConfigurationWidget.TrayStarterMode: |
502 self.configItems = { |
427 self.configItems = { |
503 # key : [display string, pixmap name, dialog module name or |
428 # key : [display string, pixmap name, dialog module name or |
504 # page creation function, parent key, |
429 # page creation function, parent key, |