WebBrowser/WebBrowserTabBar.py

Wed, 03 Feb 2016 20:05:29 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 03 Feb 2016 20:05:29 +0100
branch
QtWebEngine
changeset 4713
8dca047daf4b
parent 4631
Helpviewer/HelpTabBar.py@5c1a96925da4
child 4715
79009bc4acd5
permissions
-rw-r--r--

Continued with the web view.

634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
4631
5c1a96925da4 Updated copyright for 2016.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
3 # Copyright (c) 2010 - 2016 Detlev Offenbach <detlev@die-offenbachs.de>
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a specialized tab bar for the web browser.
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2403
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
12 from PyQt5.QtCore import Qt, QPoint, QTimer, QEvent
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
13 from PyQt5.QtWidgets import QFrame, QLabel
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from E5Gui.E5TabWidget import E5WheelTabBar
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from E5Gui.E5PassivePopup import E5PassivePopup
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import Preferences
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
20
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
21 class WebBrowserTabBar(E5WheelTabBar):
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Class implementing the tab bar of the web browser.
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
25 def __init__(self, parent=None):
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Constructor
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
29 @param parent reference to the parent widget (WebBrowserTabWidget)
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
31 super(WebBrowserTabBar, self).__init__(parent)
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
638
265c31231d9d Did some refactoring of the web browser code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 634
diff changeset
33 self.__tabWidget = parent
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.__previewPopup = None
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.__currentTabPreviewIndex = -1
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.setMouseTracking(True)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 def __showTabPreview(self):
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 Private slot to show the tab preview.
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
44 pass
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
45 # TODO: page preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
46 ## indexedBrowser = self.__tabWidget.browserAt(
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
47 ## self.__currentTabPreviewIndex)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
48 ## currentBrowser = self.__tabWidget.currentBrowser()
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
49 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
50 ## if indexedBrowser is None or currentBrowser is None:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
51 ## return
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
52 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
53 ## # no previews during load
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
54 ## if indexedBrowser.progress() != 0:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
55 ## return
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
56 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
57 ## w = self.tabSizeHint(self.__currentTabPreviewIndex).width()
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
58 ## h = int(w * currentBrowser.height() / currentBrowser.width())
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
59 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
60 ## self.__previewPopup = E5PassivePopup(self)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
61 ## self.__previewPopup.setFrameShape(QFrame.StyledPanel)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
62 ## self.__previewPopup.setFrameShadow(QFrame.Plain)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
63 ## self.__previewPopup.setFixedSize(w, h)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
64 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
65 ## from .HelpSnap import renderTabPreview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
66 ## label = QLabel()
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
67 ## label.setPixmap(renderTabPreview(indexedBrowser.page(), w, h))
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
68 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
69 ## self.__previewPopup.setView(label)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
70 ## self.__previewPopup.layout().setAlignment(Qt.AlignTop)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
71 ## self.__previewPopup.layout().setContentsMargins(0, 0, 0, 0)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
72 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
73 ## tr = self.tabRect(self.__currentTabPreviewIndex)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
74 ## pos = QPoint(tr.x(), tr.y() + tr.height())
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
75 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
76 ## self.__previewPopup.show(self.mapToGlobal(pos))
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 def mouseMoveEvent(self, evt):
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 Protected method to handle mouse move events.
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
2954
bf0215fe12d1 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2824
diff changeset
82 @param evt reference to the mouse move event (QMouseEvent)
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 if self.count() == 1:
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 return
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 E5WheelTabBar.mouseMoveEvent(self, evt)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
89 # TODO: page preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
90 ## if Preferences.getHelp("ShowPreview"):
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
91 ## # Find the tab under the mouse
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
92 ## i = 0
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
93 ## tabIndex = -1
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
94 ## while i < self.count() and tabIndex == -1:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
95 ## if self.tabRect(i).contains(evt.pos()):
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
96 ## tabIndex = i
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
97 ## i += 1
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
98 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
99 ## # If found and not the current tab then show tab preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
100 ## if tabIndex != -1 and \
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
101 ## tabIndex != self.currentIndex() and \
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
102 ## self.__currentTabPreviewIndex != tabIndex and \
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
103 ## evt.buttons() == Qt.NoButton:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
104 ## self.__currentTabPreviewIndex = tabIndex
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
105 ## QTimer.singleShot(200, self.__showTabPreview)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
106 ##
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
107 ## # If current tab or not found then hide previous tab preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
108 ## if tabIndex == self.currentIndex() or \
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
109 ## tabIndex == -1:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
110 ## if self.__previewPopup is not None:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
111 ## self.__previewPopup.hide()
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
112 ## self.__currentTabPreviewIndex = -1
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 def leaveEvent(self, evt):
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 Protected method to handle leave events.
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 @param evt reference to the leave event (QEvent)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 """
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
120 # TODO: page preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
121 ## if Preferences.getHelp("ShowPreview"):
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
122 ## # If leave tabwidget then hide previous tab preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
123 ## if self.__previewPopup is not None:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
124 ## self.__previewPopup.hide()
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
125 ## self.__currentTabPreviewIndex = -1
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 E5WheelTabBar.leaveEvent(self, evt)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 def mousePressEvent(self, evt):
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 """
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 Protected method to handle mouse press events.
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 @param evt reference to the mouse press event (QMouseEvent)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 """
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
135 # TODO: page preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
136 ## if Preferences.getHelp("ShowPreview"):
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
137 ## if self.__previewPopup is not None:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
138 ## self.__previewPopup.hide()
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
139 ## self.__currentTabPreviewIndex = -1
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 E5WheelTabBar.mousePressEvent(self, evt)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 def event(self, evt):
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
145 Public method to handle event.
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
147 This event handler just handles the tooltip event and passes the
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 handling of all others to the superclass.
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 @param evt reference to the event to be handled (QEvent)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 @return flag indicating, if the event was handled (boolean)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 """
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
153 # TODO: page preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
154 ## if evt.type() == QEvent.ToolTip and \
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
155 ## Preferences.getHelp("ShowPreview"):
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
156 ## # suppress tool tips if we are showing previews
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
157 ## evt.setAccepted(True)
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
158 ## return True
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 return E5WheelTabBar.event(self, evt)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 def tabRemoved(self, index):
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
164 Public slot to handle the removal of a tab.
634
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 @param index index of the removed tab (integer)
7b84cbd2f752 Added tab previews to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 """
4713
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
168 pass
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
169 # TODO: page preview
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
170 ## if Preferences.getHelp("ShowPreview"):
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
171 ## if self.__previewPopup is not None:
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
172 ## self.__previewPopup.hide()
8dca047daf4b Continued with the web view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
173 ## self.__currentTabPreviewIndex = -1

eric ide

mercurial