Helpviewer/SpeedDial/SpeedDial.py

Sat, 31 Dec 2016 13:34:21 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 31 Dec 2016 13:34:21 +0100
changeset 5389
9b1c800daff3
parent 5375
c55d7340ef39
child 5587
ea526b78ee6c
permissions
-rw-r--r--

Updated copyright for 2017.

1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
5389
9b1c800daff3 Updated copyright for 2017.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5375
diff changeset
3 # Copyright (c) 2012 - 2017 Detlev Offenbach <detlev@die-offenbachs.de>
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the speed dial.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3058
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 try:
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3190
diff changeset
12 str = unicode
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3190
diff changeset
13 except NameError:
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
14 pass
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2403
diff changeset
15
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import os
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
18 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QCryptographicHash, \
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
19 QByteArray, QUrl, qWarning
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
20 from PyQt5.QtWebKitWidgets import QWebPage
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
22 from E5Gui import E5MessageBox
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
24 from Utilities.AutoSaver import AutoSaver
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
25 import Utilities
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 class SpeedDial(QObject):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Class implementing the speed dial.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @signal pagesChanged() emitted after the list of pages changed
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
33 @signal speedDialSaved() emitted after the speed dial data was saved
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 pagesChanged = pyqtSignal()
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
36 speedDialSaved = pyqtSignal()
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 def __init__(self, parent=None):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 Constructor
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 @param parent reference to the parent object (QObject)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
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
44 super(SpeedDial, self).__init__(parent)
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.__regenerateScript = True
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.__webPages = []
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.__webFrames = []
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.__initialScript = ""
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.__thumbnailsDirectory = ""
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.__thumbnailers = []
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.__initialize()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 self.pagesChanged.connect(self.__pagesChanged)
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
59
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
60 self.__saveTimer = AutoSaver(self, self.save)
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
61 self.pagesChanged.connect(self.__saveTimer.changeOccurred)
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 def addWebFrame(self, frame):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 Public method to add a web frame.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 @param frame reference to the frame to be added (QWebFrame)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 if frame not in self.__webFrames:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.__webFrames.append(frame)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 def addPage(self, url, title):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 Public method to add a page for the given data.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 @param url URL of the page (QUrl)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 @param title title of the page (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 if url.isEmpty():
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 return
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2395
diff changeset
82 from .Page import Page
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 page = Page(url.toString(), title)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self.__webPages.append(page)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.pagesChanged.emit()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 def removePage(self, url):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 Public method to remove a page.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 @param url URL of the page (QUrl)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 page = self.pageForUrl(url)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 if not page.url:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 return
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.removeImageForUrl(page.url)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 self.__webPages.remove(page)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 self.pagesChanged.emit()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 def __imageFileName(self, url):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 Private method to generate the image file name for a URL.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 @param url URL to generate the file name from (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 @return name of the image file (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 """
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
110 return os.path.join(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
111 self.__thumbnailsDirectory,
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 str(QCryptographicHash.hash(QByteArray(url.encode("utf-8")),
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 QCryptographicHash.Md5).toHex(), encoding="utf-8") + ".png")
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 def initialScript(self):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 Public method to get the 'initial' JavaScript script.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 @return initial JavaScript script (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 if self.__regenerateScript:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.__regenerateScript = False
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 self.__initialScript = ""
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 for page in self.__webPages:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 if page.broken:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 imgSource = "qrc:icons/brokenPage.png"
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 else:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 imgSource = self.__imageFileName(page.url)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 if not os.path.exists(imgSource):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 self.loadThumbnail(page.url)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 imgSource = "qrc:icons/loading.gif"
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 if not page.url:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 imgSource = ""
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 else:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 imgSource = QUrl.fromLocalFile(imgSource).toString()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138
3003
cb43c34239b1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3002
diff changeset
139 self.__initialScript += \
cb43c34239b1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3002
diff changeset
140 "addBox('{0}', '{1}', '{2}');\n".format(
3794
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
141 page.url, Utilities.html_uencode(page.title),
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
142 imgSource)
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 return self.__initialScript
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
146 def getFileName(self):
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
147 """
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
148 Public method to get the file name of the user agents file.
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
149
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
150 @return name of the user agents file (string)
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
151 """
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
152 return os.path.join(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
153 Utilities.getConfigDir(), "browser", "speedDial.xml")
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
154
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 def __initialize(self):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 Private method to initialize the speed dial.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 """
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
159 self.__thumbnailsDirectory = os.path.join(
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
160 Utilities.getConfigDir(), "browser", "thumbnails")
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
161 # Create directory if it does not exist yet
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
162 if not os.path.exists(self.__thumbnailsDirectory):
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
163 os.makedirs(self.__thumbnailsDirectory)
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
165 self.__load()
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
166
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1699
diff changeset
167 def reload(self):
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1699
diff changeset
168 """
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1699
diff changeset
169 Public method to reload the speed dial data.
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1699
diff changeset
170 """
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1699
diff changeset
171 self.__load()
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1699
diff changeset
172
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
173 def __load(self):
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
174 """
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
175 Private method to load the speed dial configuration.
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
176 """
1703
796e59fd5b7a Fixed an issue reading Speed Dial data, if the speed dial XML file isn't there yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1700
diff changeset
177 allPages, pagesPerRow, speedDialSize = [], 0, 0
796e59fd5b7a Fixed an issue reading Speed Dial data, if the speed dial XML file isn't there yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1700
diff changeset
178
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
179 speedDialFile = self.getFileName()
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
180 if os.path.exists(speedDialFile):
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2395
diff changeset
181 from .SpeedDialReader import SpeedDialReader
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
182 reader = SpeedDialReader()
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
183 allPages, pagesPerRow, speedDialSize = reader.read(speedDialFile)
1703
796e59fd5b7a Fixed an issue reading Speed Dial data, if the speed dial XML file isn't there yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1700
diff changeset
184
796e59fd5b7a Fixed an issue reading Speed Dial data, if the speed dial XML file isn't there yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1700
diff changeset
185 self.__pagesPerRow = pagesPerRow if pagesPerRow else 4
796e59fd5b7a Fixed an issue reading Speed Dial data, if the speed dial XML file isn't there yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1700
diff changeset
186 self.__speedDialSize = speedDialSize if speedDialSize else 231
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
187
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
188 if allPages:
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
189 self.__webPages = allPages
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
190 self.pagesChanged.emit()
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
191 else:
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 allPages = \
5375
c55d7340ef39 Changed references to the eric web site URL to use the secure protocol https://.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4954
diff changeset
193 'url:"https://eric-ide.python-projects.org/"|'\
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
194 'title:"Eric Web Site";'\
4952
d3559dd4e1bc Updated the default speed dial pages of the QtWebKit browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
195 'url:"https://www.riverbankcomputing.com/"|'\
3871
46d1b3a61177 Changed the URL of the Qt web site in the speeddial.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3794
diff changeset
196 'title:"PyQt Web Site";'\
46d1b3a61177 Changed the URL of the Qt web site in the speeddial.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3794
diff changeset
197 'url:"http://www.qt.io/"|title:"Qt Web Site";'\
4952
d3559dd4e1bc Updated the default speed dial pages of the QtWebKit browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
198 'url:"http://blog.qt.io/"|title:"Qt Blog";'\
d3559dd4e1bc Updated the default speed dial pages of the QtWebKit browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
199 'url:"https://www.python.org"|'\
d3559dd4e1bc Updated the default speed dial pages of the QtWebKit browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
200 'title:"Python Language Website";'\
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 'url:"http://www.google.com"|title:"Google";'
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
202 self.changed(allPages)
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
203
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
204 def save(self):
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
205 """
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
206 Public method to save the speed dial configuration.
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
207 """
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2395
diff changeset
208 from .SpeedDialWriter import SpeedDialWriter
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
209 speedDialFile = self.getFileName()
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
210 writer = SpeedDialWriter()
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
211 if not writer.write(speedDialFile, self.__webPages,
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
212 self.__pagesPerRow, self.__speedDialSize):
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3003
diff changeset
213 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3003
diff changeset
214 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
215 self.tr("Saving Speed Dial data"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
216 self.tr(
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
217 """<p>Speed Dial data could not be saved to"""
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
218 """ <b>{0}</b></p>""").format(speedDialFile))
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
219 else:
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
220 self.speedDialSaved.emit()
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
221
4954
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
222 def resetDials(self):
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
223 """
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
224 Public method to reset the speed dials to the default values.
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
225 """
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
226 ok = E5MessageBox.yesNo(
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
227 None,
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
228 self.tr("Reset Speed Dials"),
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
229 self.tr("""Are you sure you want to reset the speed dials to"""
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
230 """ the default pages?"""))
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
231 if ok:
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
232 speedDialFile = self.getFileName()
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
233 if os.path.exists(speedDialFile):
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
234 os.remove(speedDialFile)
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
235
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
236 self.__load()
36e92a908f3f Improved the web browser Speeddial (both variants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4952
diff changeset
237
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
238 def close(self):
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
239 """
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
240 Public method to close the user agents manager.
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
241 """
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
242 self.__saveTimer.saveIfNeccessary()
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 def pageForUrl(self, url):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 Public method to get the page for the given URL.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 @param url URL to be searched for (QUrl)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 @return page for the URL (Page)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 urlString = url.toString()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 for page in self.__webPages:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 if page.url == urlString:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 return page
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2395
diff changeset
256 from .Page import Page
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 return Page()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 def urlForShortcut(self, key):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 Public method to get the URL for the given shortcut key.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 @param key shortcut key (integer)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 @return URL for the key (QUrl)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 if key < 0 or len(self.__webPages) <= key:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 return QUrl()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 return QUrl.fromEncoded(self.__webPages[key].url.encode("utf-8"))
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 @pyqtSlot(str)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 def changed(self, allPages):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 Public slot to react on changed pages.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 @param allPages string giving all pages (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 if not allPages:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 return
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 entries = allPages.split('";')
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 self.__webPages = []
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2395
diff changeset
284 from .Page import Page
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 for entry in entries:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 if not entry:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 continue
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 tmp = entry.split('"|')
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 if len(tmp) == 2:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 broken = False
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 elif len(tmp) == 3:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 broken = "brokenPage" in tmp[2][5:]
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 else:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 continue
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 page = Page(tmp[0][5:], tmp[1][7:], broken)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 self.__webPages.append(page)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 self.pagesChanged.emit()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 @pyqtSlot(str)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 @pyqtSlot(str, bool)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 def loadThumbnail(self, url, loadTitle=False):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 Public slot to load a thumbnail of the given URL.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 @param url URL of the thumbnail (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 @param loadTitle flag indicating to get the title for the thumbnail
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 from the site (boolean)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 if not url:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 return
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2395
diff changeset
315 from .PageThumbnailer import PageThumbnailer
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 thumbnailer = PageThumbnailer(self)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 thumbnailer.setUrl(QUrl.fromEncoded(url.encode("utf-8")))
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 thumbnailer.setLoadTitle(loadTitle)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 thumbnailer.thumbnailCreated.connect(self.__thumbnailCreated)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 self.__thumbnailers.append(thumbnailer)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 thumbnailer.start()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 @pyqtSlot(str)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 def removeImageForUrl(self, url):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 Public slot to remove the image for a URL.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 @param url URL to remove the image for (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 fileName = self.__imageFileName(url)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 if os.path.exists(fileName):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 os.remove(fileName)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 @pyqtSlot(str, result=str)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 def urlFromUserInput(self, url):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 Public slot to get the URL from user input.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 @param url URL entered by the user (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 @return sanitized URL (string)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 return QUrl.fromUserInput(url).toString()
3794
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
344
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
345 @pyqtSlot(str, result=str)
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
346 def unescapeTitle(self, title):
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
347 """
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
348 Public slot to unescape the titel string.
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
349
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
350 @param title escaped title (string)
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
351 @return un-escaped title (string)
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
352 """
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
353 return Utilities.html_udecode(title)
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 @pyqtSlot(int)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 def setPagesInRow(self, count):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 Public slot to set the number of pages per row.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 @param count number of pages per row (integer)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 """
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
362 self.__pagesPerRow = count
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
363 self.__saveTimer.changeOccurred()
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 def pagesInRow(self):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 Public method to get the number of dials per row.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 @return number of dials per row (integer)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 """
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
371 return self.__pagesPerRow
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 @pyqtSlot(int)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 def setSdSize(self, size):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 Public slot to set the size of the speed dial.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 @param size size of the speed dial (integer)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 """
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
380 self.__speedDialSize = size
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
381 self.__saveTimer.changeOccurred()
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 def sdSize(self):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 Public method to get the speed dial size.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 @return speed dial size (integer)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 """
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
389 return self.__speedDialSize
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 def __thumbnailCreated(self, image):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 Private slot to handle the creation of a thumbnail image.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 @param image thumbnail image (QPixmap)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 """
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2395
diff changeset
397 from .PageThumbnailer import PageThumbnailer
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 thumbnailer = self.sender()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 if not isinstance(thumbnailer, PageThumbnailer) or \
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 thumbnailer not in self.__thumbnailers:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 return
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 loadTitle = thumbnailer.loadTitle()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 title = thumbnailer.title()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 url = thumbnailer.url().toString()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 fileName = self.__imageFileName(url)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 if image.isNull():
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 fileName = "qrc:icons/brokenPage.png"
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
410 title = self.tr("Unable to load")
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 loadTitle = True
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 page = self.pageForUrl(thumbnailer.url())
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 page.broken = True
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 else:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 if not image.save(fileName):
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
416 qWarning(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
417 "SpeedDial.__thumbnailCreated: Cannot save thumbnail"
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
418 " to {0}".format(fileName))
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 fileName = QUrl.fromLocalFile(fileName).toString()
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 self.__regenerateScript = True
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 for frame in self.__cleanFrames():
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 frame.evaluateJavaScript("setImageToUrl('{0}', '{1}');".format(
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 url, fileName))
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 if loadTitle:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 frame.evaluateJavaScript("setTitleToUrl('{0}', '{1}');".format(
3794
b460b30fab8f Enhanced the web browser speed dial page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
429 url, Utilities.html_uencode(title)))
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430
2318
3a3ee7cc2ad6 Changed some signal handlings (disconnect).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
431 thumbnailer.deleteLater()
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 self.__thumbnailers.remove(thumbnailer)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 def __cleanFrames(self):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 Private method to clean all frames.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 @return list of speed dial frames (list of QWebFrame)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 frames = []
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 for frame in self.__webFrames[:]:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 if frame.url().toString() == "eric:speeddial":
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 frames.append(frame)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 else:
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 self.__webFrames.remove(frame)
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 return frames
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 def __pagesChanged(self):
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 """
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 Private slot to react on a change of the pages configuration.
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 """
1699
10706f6ad9d2 Changed the speedial to store the data into an XML file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1670
diff changeset
454 # update all speed dial pages
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 self.__regenerateScript = True
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 for frame in self.__cleanFrames():
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 frame.page().triggerAction(QWebPage.Reload)

eric ide

mercurial