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 |
27 from Globals import isMacPlatform, qVersionTuple, getWebBrowserSupport |
28 |
28 |
29 import Preferences |
29 import Preferences |
30 |
30 |
31 import UI.PixmapCache |
31 import UI.PixmapCache |
32 |
32 |
81 TrayStarterMode = 2 |
81 TrayStarterMode = 2 |
82 HexEditorMode = 3 |
82 HexEditorMode = 3 |
83 WebBrowserMode = 4 |
83 WebBrowserMode = 4 |
84 |
84 |
85 def __init__(self, parent=None, fromEric=True, displayMode=DefaultMode, |
85 def __init__(self, parent=None, fromEric=True, displayMode=DefaultMode, |
86 expandedEntries=None, webEngine=False): |
86 expandedEntries=None): |
87 """ |
87 """ |
88 Constructor |
88 Constructor |
89 |
89 |
90 @param parent The parent widget of this dialog. (QWidget) |
90 @param parent The parent widget of this dialog. (QWidget) |
91 @keyparam fromEric flag indicating a dialog generation from within the |
91 @keyparam fromEric flag indicating a dialog generation from within the |
94 (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode, |
94 (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode, |
95 WebBrowserMode) |
95 WebBrowserMode) |
96 @exception RuntimeError raised to indicate an invalid dialog mode |
96 @exception RuntimeError raised to indicate an invalid dialog mode |
97 @keyparam expandedEntries list of entries to be shown expanded |
97 @keyparam expandedEntries list of entries to be shown expanded |
98 (list of strings) |
98 (list of strings) |
99 @keyparam webEngine flag indicating QtWebEngine is used (bool) |
|
100 """ |
99 """ |
101 assert displayMode in ( |
100 assert displayMode in ( |
102 ConfigurationWidget.DefaultMode, |
101 ConfigurationWidget.DefaultMode, |
103 ConfigurationWidget.HelpBrowserMode, |
102 ConfigurationWidget.HelpBrowserMode, |
104 ConfigurationWidget.TrayStarterMode, |
103 ConfigurationWidget.TrayStarterMode, |
107 ) |
106 ) |
108 |
107 |
109 super(ConfigurationWidget, self).__init__(parent) |
108 super(ConfigurationWidget, self).__init__(parent) |
110 self.fromEric = fromEric |
109 self.fromEric = fromEric |
111 self.displayMode = displayMode |
110 self.displayMode = displayMode |
112 self.__webEngine = webEngine |
111 self.__webEngine = getWebBrowserSupport() == "QtWebEngine" |
113 expandedEntries = [] if expandedEntries is None else expandedEntries[:] |
112 expandedEntries = [] if expandedEntries is None else expandedEntries[:] |
114 |
113 |
115 self.__setupUi() |
114 self.__setupUi() |
116 |
115 |
117 self.itmDict = {} |
116 self.itmDict = {} |
337 "InterfacePage", "0interfacePage", None], |
336 "InterfacePage", "0interfacePage", None], |
338 "viewmanagerPage": |
337 "viewmanagerPage": |
339 [self.tr("Viewmanager"), "preferences-viewmanager.png", |
338 [self.tr("Viewmanager"), "preferences-viewmanager.png", |
340 "ViewmanagerPage", "0interfacePage", None], |
339 "ViewmanagerPage", "0interfacePage", None], |
341 } |
340 } |
342 if webEngine: |
341 if self.__webEngine: |
343 self.configItems.update({ |
342 self.configItems.update({ |
344 "0webBrowserPage": |
343 "0webBrowserPage": |
345 [self.tr("Web Browser"), "ericWeb.png", |
344 [self.tr("Web Browser"), "ericWeb.png", |
346 None, None, None], |
345 None, None, None], |
347 "webBrowserAppearancePage": |
346 "webBrowserAppearancePage": |
970 HexEditorMode = ConfigurationWidget.HexEditorMode |
969 HexEditorMode = ConfigurationWidget.HexEditorMode |
971 WebBrowserMode = ConfigurationWidget.WebBrowserMode |
970 WebBrowserMode = ConfigurationWidget.WebBrowserMode |
972 |
971 |
973 def __init__(self, parent=None, name=None, modal=False, |
972 def __init__(self, parent=None, name=None, modal=False, |
974 fromEric=True, displayMode=ConfigurationWidget.DefaultMode, |
973 fromEric=True, displayMode=ConfigurationWidget.DefaultMode, |
975 expandedEntries=None, webEngine=False): |
974 expandedEntries=None): |
976 """ |
975 """ |
977 Constructor |
976 Constructor |
978 |
977 |
979 @param parent The parent widget of this dialog. (QWidget) |
978 @param parent The parent widget of this dialog. (QWidget) |
980 @param name The name of this dialog. string |
979 @param name The name of this dialog. string |
984 @keyparam displayMode mode of the configuration dialog |
983 @keyparam displayMode mode of the configuration dialog |
985 (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode, |
984 (DefaultMode, HelpBrowserMode, TrayStarterMode, HexEditorMode, |
986 WebBrowserMode) |
985 WebBrowserMode) |
987 @keyparam expandedEntries list of entries to be shown expanded |
986 @keyparam expandedEntries list of entries to be shown expanded |
988 (list of strings) |
987 (list of strings) |
989 @keyparam webEngine flag indicating QtWebEngine is used (bool) |
|
990 """ |
988 """ |
991 super(ConfigurationDialog, self).__init__(parent) |
989 super(ConfigurationDialog, self).__init__(parent) |
992 if name: |
990 if name: |
993 self.setObjectName(name) |
991 self.setObjectName(name) |
994 self.setModal(modal) |
992 self.setModal(modal) |
998 self.layout.setContentsMargins(0, 0, 0, 0) |
996 self.layout.setContentsMargins(0, 0, 0, 0) |
999 self.layout.setSpacing(0) |
997 self.layout.setSpacing(0) |
1000 |
998 |
1001 self.cw = ConfigurationWidget(self, fromEric=fromEric, |
999 self.cw = ConfigurationWidget(self, fromEric=fromEric, |
1002 displayMode=displayMode, |
1000 displayMode=displayMode, |
1003 expandedEntries=expandedEntries, |
1001 expandedEntries=expandedEntries) |
1004 webEngine=webEngine) |
|
1005 size = self.cw.size() |
1002 size = self.cw.size() |
1006 self.layout.addWidget(self.cw) |
1003 self.layout.addWidget(self.cw) |
1007 self.resize(size) |
1004 self.resize(size) |
1008 self.setWindowTitle(self.cw.windowTitle()) |
1005 self.setWindowTitle(self.cw.windowTitle()) |
1009 |
1006 |
1067 |
1064 |
1068 class ConfigurationWindow(E5MainWindow): |
1065 class ConfigurationWindow(E5MainWindow): |
1069 """ |
1066 """ |
1070 Main window class for the standalone dialog. |
1067 Main window class for the standalone dialog. |
1071 """ |
1068 """ |
1072 def __init__(self, parent=None, webEngine=False): |
1069 def __init__(self, parent=None): |
1073 """ |
1070 """ |
1074 Constructor |
1071 Constructor |
1075 |
1072 |
1076 @param parent reference to the parent widget (QWidget) |
1073 @param parent reference to the parent widget (QWidget) |
1077 @keyparam webEngine flag indicating QtWebEngine is used (bool) |
|
1078 """ |
1074 """ |
1079 super(ConfigurationWindow, self).__init__(parent) |
1075 super(ConfigurationWindow, self).__init__(parent) |
1080 |
1076 |
1081 self.cw = ConfigurationWidget(self, fromEric=False, |
1077 self.cw = ConfigurationWidget(self, fromEric=False) |
1082 webEngine=webEngine) |
|
1083 size = self.cw.size() |
1078 size = self.cw.size() |
1084 self.setCentralWidget(self.cw) |
1079 self.setCentralWidget(self.cw) |
1085 self.resize(size) |
1080 self.resize(size) |
1086 self.setWindowTitle(self.cw.windowTitle()) |
1081 self.setWindowTitle(self.cw.windowTitle()) |
1087 |
1082 |