64 from .data import javascript_rc # __IGNORE_WARNING__ |
64 from .data import javascript_rc # __IGNORE_WARNING__ |
65 |
65 |
66 from E5Gui.E5Action import E5Action |
66 from E5Gui.E5Action import E5Action |
67 from E5Gui import E5MessageBox, E5FileDialog |
67 from E5Gui import E5MessageBox, E5FileDialog |
68 from E5Gui.E5MainWindow import E5MainWindow |
68 from E5Gui.E5MainWindow import E5MainWindow |
|
69 from E5Gui.E5Application import e5App |
69 |
70 |
70 from E5Network.E5NetworkMonitor import E5NetworkMonitor |
71 from E5Network.E5NetworkMonitor import E5NetworkMonitor |
71 |
72 |
72 import Preferences |
73 import Preferences |
73 from Preferences import Shortcuts |
74 from Preferences import Shortcuts |
108 _userAgentsManager = None |
112 _userAgentsManager = None |
109 _syncManager = None |
113 _syncManager = None |
110 _speedDial = None |
114 _speedDial = None |
111 _personalInformationManager = None |
115 _personalInformationManager = None |
112 _greaseMonkeyManager = None |
116 _greaseMonkeyManager = None |
|
117 _notification = None |
113 |
118 |
114 def __init__(self, home, path, parent, name, fromEric=False, |
119 def __init__(self, home, path, parent, name, fromEric=False, |
115 initShortcutsOnly=False, searchWord=None): |
120 initShortcutsOnly=False, searchWord=None): |
116 """ |
121 """ |
117 Constructor |
122 Constructor |
128 super().__init__(parent) |
133 super().__init__(parent) |
129 self.setObjectName(name) |
134 self.setObjectName(name) |
130 self.setWindowTitle(self.trUtf8("eric5 Web Browser")) |
135 self.setWindowTitle(self.trUtf8("eric5 Web Browser")) |
131 |
136 |
132 self.fromEric = fromEric |
137 self.fromEric = fromEric |
|
138 self.__class__._fromEric = fromEric |
133 self.initShortcutsOnly = initShortcutsOnly |
139 self.initShortcutsOnly = initShortcutsOnly |
134 self.setWindowIcon(UI.PixmapCache.getIcon("ericWeb.png")) |
140 self.setWindowIcon(UI.PixmapCache.getIcon("ericWeb.png")) |
135 |
141 |
136 self.mHistory = [] |
142 self.mHistory = [] |
137 self.__lastConfigurationPageName = "" |
143 self.__lastConfigurationPageName = "" |
3293 |
3299 |
3294 encodedStyle = bytes(QByteArray(userStyle).toBase64()).decode() |
3300 encodedStyle = bytes(QByteArray(userStyle).toBase64()).decode() |
3295 dataString = "data:text/css;charset=utf-8;base64,{0}".format(encodedStyle) |
3301 dataString = "data:text/css;charset=utf-8;base64,{0}".format(encodedStyle) |
3296 |
3302 |
3297 return QUrl(dataString) |
3303 return QUrl(dataString) |
|
3304 |
|
3305 ########################################## |
|
3306 ## Support for desktop notifications below |
|
3307 ########################################## |
|
3308 |
|
3309 @classmethod |
|
3310 def showNotification(cls, icon, heading, text): |
|
3311 """ |
|
3312 Clsss method to show a desktop notification. |
|
3313 |
|
3314 @param icon icon to be shown in the notification (QPixmap) |
|
3315 @param heading heading of the notification (string) |
|
3316 @param text text of the notification (string) |
|
3317 """ |
|
3318 if cls._fromEric: |
|
3319 e5App().getObject("UserInterface").showNotification(icon, heading, text) |
|
3320 else: |
|
3321 if Preferences.getUI("NotificationsEnabled"): |
|
3322 if cls._notification is None: |
|
3323 cls._notification = NotificationWidget() |
|
3324 cls._notification.setPixmap(icon) |
|
3325 cls._notification.setHeading(heading) |
|
3326 cls._notification.setText(text) |
|
3327 cls._notification.setTimeout(Preferences.getUI("NotificationTimeout")) |
|
3328 cls._notification.move(Preferences.getUI("NotificationPosition")) |
|
3329 cls._notification.show() |
|
3330 |
|
3331 @classmethod |
|
3332 def notificationsEnabled(cls): |
|
3333 """ |
|
3334 Clsss method to check, if notifications are enabled. |
|
3335 |
|
3336 @return flag indicating, if notifications are enabled (boolean) |
|
3337 """ |
|
3338 if cls._fromEric: |
|
3339 return e5App().getObject("UserInterface").notificationsEnabled |
|
3340 else: |
|
3341 return Preferences.getUI("NotificationsEnabled") |