WebBrowser/Navigation/NavigationBar.py

Mon, 01 May 2017 16:44:28 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 01 May 2017 16:44:28 +0200
changeset 5722
433187e73c0f
child 5734
d8b99b5fa673
permissions
-rw-r--r--

Further improvements to the full screen handling of the web browser NG.

5722
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2017 Detlev Offenbach <detlev@die-offenbachs.de>
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the navigation bar widget.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from __future__ import unicode_literals
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import Qt
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStyle, QToolButton, \
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 QSplitter, QSizePolicy, QMenu, QAction
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from WebBrowser.WebBrowserWindow import WebBrowserWindow
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import UI.PixmapCache
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 class NavigationBar(QWidget):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Class implementing the navigation bar.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 def __init__(self, mainWindow, parent=None):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Constructor
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param mainWindow reference to the browser main window
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type WebBrowserWindow
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @param parent reference to the parent widget
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @type QWidget
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 super(NavigationBar, self).__init__(parent)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.setObjectName("navigationbar")
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.__mw = mainWindow
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.__layout = QHBoxLayout(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 margin = self.style().pixelMetric(QStyle.PM_ToolBarItemMargin, None,
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.__layout.setContentsMargins(margin, margin, margin, margin)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.__layout.setSpacing(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.style().pixelMetric(QStyle.PM_ToolBarItemSpacing, None, self))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.setLayout(self.__layout)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.__backButton = QToolButton(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.__backButton.setObjectName("navigation_back_button")
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.__backButton.setToolTip(self.tr("Move one screen backward"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.__backButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.__backButton.setFocusPolicy(Qt.NoFocus)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.__backButton.setAutoRaise(True)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.__backButton.setIcon(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 UI.PixmapCache.getIcon("back.png"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.__backButton.setEnabled(False)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.__forwardButton = QToolButton(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 self.__forwardButton.setObjectName("navigation_forward_button")
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.__forwardButton.setToolTip(self.tr("Move one screen forward"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.__forwardButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.__forwardButton.setFocusPolicy(Qt.NoFocus)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.__forwardButton.setAutoRaise(True)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.__forwardButton.setIcon(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 UI.PixmapCache.getIcon("forward.png"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.__forwardButton.setEnabled(False)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.__backNextLayout = QHBoxLayout()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.__backNextLayout.setContentsMargins(0, 0, 0, 0)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__backNextLayout.setSpacing(0)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.__backNextLayout.addWidget(self.__backButton)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.__backNextLayout.addWidget(self.__forwardButton)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.__reloadButton = QToolButton(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.__reloadButton.setObjectName("navigation_reload_button")
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.__reloadButton.setToolTip(self.tr("Reload the current screen"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.__reloadButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.__reloadButton.setFocusPolicy(Qt.NoFocus)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.__reloadButton.setAutoRaise(True)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.__reloadButton.setIcon(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 UI.PixmapCache.getIcon("reload.png"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 self.__stopButton = QToolButton(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.__stopButton.setObjectName("navigation_stop_button")
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self.__stopButton.setToolTip(self.tr("Stop loading"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 self.__stopButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.__stopButton.setFocusPolicy(Qt.NoFocus)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self.__stopButton.setAutoRaise(True)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.__stopButton.setIcon(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 UI.PixmapCache.getIcon("stopLoading.png"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.__homeButton = QToolButton(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.__homeButton.setObjectName("navigation_home_button")
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.__homeButton.setToolTip(self.tr("Move to the initial screen"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.__homeButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 self.__homeButton.setFocusPolicy(Qt.NoFocus)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.__homeButton.setAutoRaise(True)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.__homeButton.setIcon(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 UI.PixmapCache.getIcon("home.png"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 self.__exitFullScreenButton = QToolButton(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 self.__exitFullScreenButton.setObjectName(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 "navigation_exitfullscreen_button")
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 self.__exitFullScreenButton.setToolTip(self.tr("Exit Fullscreen"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 self.__exitFullScreenButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.__exitFullScreenButton.setFocusPolicy(Qt.NoFocus)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.__exitFullScreenButton.setAutoRaise(True)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 self.__exitFullScreenButton.setIcon(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 UI.PixmapCache.getIcon("windowRestore.png"))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 self.__exitFullScreenButton.clicked.connect(self.__mw.toggleFullScreen)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 self.__exitFullScreenButton.setVisible(False)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 self.__navigationSplitter = QSplitter(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 urlBar = self.__mw.tabWidget().stackedUrlBar()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 self.__navigationSplitter.addWidget(urlBar)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 from WebBrowser.WebBrowserWebSearchWidget import \
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 WebBrowserWebSearchWidget
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 self.__searchEdit = WebBrowserWebSearchWidget(self.__mw, self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 sizePolicy.setHorizontalStretch(2)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 sizePolicy.setVerticalStretch(0)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.__searchEdit.setSizePolicy(sizePolicy)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 self.__searchEdit.search.connect(self.__mw.openUrl)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 self.__navigationSplitter.addWidget(self.__searchEdit)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self.__navigationSplitter.setSizePolicy(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 QSizePolicy.Expanding, QSizePolicy.Maximum)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 self.__navigationSplitter.setCollapsible(0, False)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 self.__layout.addLayout(self.__backNextLayout)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 self.__layout.addWidget(self.__reloadButton)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 self.__layout.addWidget(self.__stopButton)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 self.__layout.addWidget(self.__homeButton)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 self.__layout.addWidget(self.__navigationSplitter)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 self.__layout.addWidget(self.__exitFullScreenButton)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 self.__backMenu = QMenu(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 self.__backMenu.aboutToShow.connect(self.__showBackMenu)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 self.__backMenu.triggered.connect(self.__navigationMenuActionTriggered)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 self.__backButton.setMenu(self.__backMenu)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 self.__backButton.setPopupMode(QToolButton.MenuButtonPopup)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 self.__forwardMenu = QMenu(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 self.__forwardMenu.aboutToShow.connect(self.__showForwardMenu)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 self.__forwardMenu.triggered.connect(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 self.__navigationMenuActionTriggered)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 self.__forwardButton.setMenu(self.__forwardMenu)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 self.__forwardButton.setPopupMode(QToolButton.MenuButtonPopup)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 self.__backButton.clicked.connect(self.__goBack)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 self.__forwardButton.clicked.connect(self.__goForward)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 self.__reloadButton.clicked.connect(self.__reload)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 self.__stopButton.clicked.connect(self.__stopLoad)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 self.__homeButton.clicked.connect(self.__goHome)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 def backButton(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 Public method to get a reference to the back button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 @return reference to the back button
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 @rtype QToolButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 return self.__backButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 def forwardButton(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 Public method to get a reference to the forward button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 @return reference to the forward button
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 @rtype QToolButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 return self.__forwardButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 def reloadButton(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 Public method to get a reference to the reload button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 @return reference to the reload button
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 @rtype QToolButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 return self.__reloadButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 def stopButton(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 Public method to get a reference to the stop button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 @return reference to the stop button
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 @rtype QToolButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 return self.__stopButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 def exitFullScreenButton(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 Public method to get a reference to the exit full screen button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 @return reference to the exit full screen button
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 @rtype QToolButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 return self.__exitFullScreenButton
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 def searchEdit(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 Public method to get a reference to the web search edit.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 @return reference to the web search edit
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 @rtype WebBrowserWebSearchWidget
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 return self.__searchEdit
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 def __showBackMenu(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 Private slot showing the backwards navigation menu.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 self.__backMenu.clear()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 history = self.__mw.currentBrowser().history()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 historyCount = history.count()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 backItems = history.backItems(historyCount)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 count = 0
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 for index in range(len(backItems) - 1, -1, -1):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 item = backItems[index]
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 act = QAction(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 act.setData(-1 * (index + 1))
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 icon = WebBrowserWindow.icon(item.url())
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 act.setIcon(icon)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 act.setText(item.title())
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 self.__backMenu.addAction(act)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 count += 1
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 if count == 20:
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 break
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 self.__backMenu.addSeparator()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 self.__backMenu.addAction(self.tr("Clear History"),
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 self.__clearHistory)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 def __showForwardMenu(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 Private slot showing the forwards navigation menu.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 self.__forwardMenu.clear()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 history = self.__mw.currentBrowser().history()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 historyCount = history.count()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 forwardItems = history.forwardItems(historyCount)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 count = 0
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 for index in range(len(forwardItems)):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 item = forwardItems[index]
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 act = QAction(self)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 act.setData(index + 1)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 icon = WebBrowserWindow.icon(item.url())
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 act.setIcon(icon)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 act.setText(item.title())
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 self.__forwardMenu.addAction(act)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 count += 1
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 if count == 20:
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 break
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 self.__forwardMenu.addSeparator()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 self.__forwardMenu.addAction(self.tr("Clear History"),
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 self.__clearHistory)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 def __navigationMenuActionTriggered(self, act):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 Private slot to go to the selected page.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 @param act reference to the action selected in the navigation menu
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 (QAction)
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 offset = act.data()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 if offset is not None:
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 history = self.__mw.currentBrowser().history()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 historyCount = history.count()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 if offset < 0:
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 # go back
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 history.goToItem(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 history.backItems(historyCount)[-1 * offset - 1])
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 else:
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 # go forward
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 history.goToItem(
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 history.forwardItems(historyCount)[offset - 1])
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 def __goBack(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 Private slot called to handle the backward button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 self.__mw.currentBrowser().backward()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 def __goForward(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 Private slot called to handle the forward button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 self.__mw.currentBrowser().forward()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 def __goHome(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 Private slot called to handle the home button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 self.__mw.currentBrowser().home()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 def __reload(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 Private slot called to handle the reload button.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 self.__mw.currentBrowser().reloadBypassingCache()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 def __stopLoad(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 Private slot called to handle loading of the current page.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 self.__mw.currentBrowser().stop()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 def __clearHistory(self):
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 Private slot to clear the history of the current web browser tab.
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 """
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 cb = self.__mw.currentBrowser()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 if cb is not None:
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 cb.history().clear()
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 self.__mw.setForwardAvailable(cb.isForwardAvailable())
433187e73c0f Further improvements to the full screen handling of the web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 self.__mw.setBackwardAvailable(cb.isBackwardAvailable())

eric ide

mercurial