eric6/WebBrowser/Sync/SyncCheckPage.py

Wed, 01 Jan 2020 11:57:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 01 Jan 2020 11:57:23 +0100
changeset 7360
9190402e4505
parent 7269
0c63ea7f94bd
child 7514
0960c7c1f497
permissions
-rw-r--r--

Updated copyright for 2020.

1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7269
diff changeset
3 # Copyright (c) 2012 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the synchronization status wizard page.
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
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
10
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import os
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
13 from PyQt5.QtCore import QByteArray, QTimer
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
14 from PyQt5.QtGui import QMovie
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
15 from PyQt5.QtWidgets import QWizardPage
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
1695
7b115f986d48 Added capability to synchronize bookmarks, history, passwords and user agent settings via a shared directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1680
diff changeset
17 from . import SyncGlobals
7b115f986d48 Added capability to synchronize bookmarks, history, passwords and user agent settings via a shared directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1680
diff changeset
18
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from .Ui_SyncCheckPage import Ui_SyncCheckPage
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 import Preferences
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 import UI.PixmapCache
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
24 from eric6config import getConfig
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 class SyncCheckPage(QWizardPage, Ui_SyncCheckPage):
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 Class implementing the synchronization status wizard page.
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 def __init__(self, parent=None):
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 Constructor
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 @param parent reference to the parent widget (QWidget)
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
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
37 super(SyncCheckPage, self).__init__(parent)
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.setupUi(self)
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 def initializePage(self):
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 Public method to initialize the page.
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.syncErrorLabel.hide()
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
1680
28e57079dab5 Added capability to encrypt the synchronized data (web browser).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1673
diff changeset
46 forceUpload = self.field("ReencryptData")
28e57079dab5 Added capability to encrypt the synchronized data (web browser).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1673
diff changeset
47
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
48 from WebBrowser.WebBrowserWindow import WebBrowserWindow
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
49 syncMgr = WebBrowserWindow.syncManager()
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 syncMgr.syncError.connect(self.__syncError)
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
51 syncMgr.syncStatus.connect(self.__updateMessages)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
52 syncMgr.syncFinished.connect(self.__updateLabels)
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
54 if Preferences.getWebBrowser("SyncType") == SyncGlobals.SyncTypeFtp:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
55 self.handlerLabel.setText(self.tr("FTP"))
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
56 self.infoLabel.setText(self.tr("Host:"))
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
57 self.infoDataLabel.setText(
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
58 Preferences.getWebBrowser("SyncFtpServer"))
7269
0c63ea7f94bd Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
59 elif (
0c63ea7f94bd Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
60 Preferences.getWebBrowser("SyncType") ==
0c63ea7f94bd Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
61 SyncGlobals.SyncTypeDirectory
0c63ea7f94bd Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
62 ):
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
63 self.handlerLabel.setText(self.tr("Shared Directory"))
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
64 self.infoLabel.setText(self.tr("Directory:"))
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
65 self.infoDataLabel.setText(
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
66 Preferences.getWebBrowser("SyncDirectoryPath"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
68 self.handlerLabel.setText(self.tr("No Synchronization"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.hostLabel.setText("")
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.bookmarkMsgLabel.setText("")
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.historyMsgLabel.setText("")
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.passwordsMsgLabel.setText("")
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.userAgentsMsgLabel.setText("")
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
75 self.speedDialMsgLabel.setText("")
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 if not syncMgr.syncEnabled():
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
78 self.bookmarkLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
79 UI.PixmapCache.getPixmap("syncNo.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png"))
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
81 self.passwordsLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
82 UI.PixmapCache.getPixmap("syncNo.png"))
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
83 self.userAgentsLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
84 UI.PixmapCache.getPixmap("syncNo.png"))
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
85 self.speedDialLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
86 UI.PixmapCache.getPixmap("syncNo.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 return
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 animationFile = os.path.join(getConfig("ericPixDir"), "loading.gif")
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 # bookmarks
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
92 if Preferences.getWebBrowser("SyncBookmarks"):
1673
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
93 self.__makeAnimatedLabel(animationFile, self.bookmarkLabel)
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
95 self.bookmarkLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
96 UI.PixmapCache.getPixmap("syncNo.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 # history
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
99 if Preferences.getWebBrowser("SyncHistory"):
1673
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
100 self.__makeAnimatedLabel(animationFile, self.historyLabel)
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 else:
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png"))
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 # Passwords
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
105 if Preferences.getWebBrowser("SyncPasswords"):
1673
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
106 self.__makeAnimatedLabel(animationFile, self.passwordsLabel)
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
108 self.passwordsLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
109 UI.PixmapCache.getPixmap("syncNo.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 # user agent settings
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
112 if Preferences.getWebBrowser("SyncUserAgents"):
1673
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
113 self.__makeAnimatedLabel(animationFile, self.userAgentsLabel)
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
115 self.userAgentsLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
116 UI.PixmapCache.getPixmap("syncNo.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
118 # speed dial settings
4774
2c6ffa778c3b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
119 if Preferences.getWebBrowser("SyncSpeedDial"):
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
120 self.__makeAnimatedLabel(animationFile, self.speedDialLabel)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
121 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
122 self.speedDialLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
123 UI.PixmapCache.getPixmap("syncNo.png"))
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
124
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
125 QTimer.singleShot(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
126 0, lambda: syncMgr.loadSettings(forceUpload=forceUpload))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
1673
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
128 def __makeAnimatedLabel(self, fileName, label):
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
129 """
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
130 Private slot to create an animated label.
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
131
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
132 @param fileName name of the file containing the animation (string)
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
133 @param label reference to the label to be animated (QLabel)
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
134 """
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
135 movie = QMovie(fileName, QByteArray(), label)
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
136 movie.setSpeed(100)
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
137 label.setMovie(movie)
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
138 movie.start()
06eeffc8c97d Fine tuned the label animations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1626
diff changeset
139
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
140 def __updateMessages(self, type_, msg):
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 Private slot to update the synchronization status info.
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 @param type_ type of synchronization data (string)
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 @param msg synchronization message (string)
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 if type_ == "bookmarks":
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
148 self.bookmarkMsgLabel.setText(msg)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
149 elif type_ == "history":
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
150 self.historyMsgLabel.setText(msg)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
151 elif type_ == "passwords":
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
152 self.passwordsMsgLabel.setText(msg)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
153 elif type_ == "useragents":
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
154 self.userAgentsMsgLabel.setText(msg)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
155 elif type_ == "speeddial":
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
156 self.speedDialMsgLabel.setText(msg)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
157
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
158 def __updateLabels(self, type_, status, download):
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
159 """
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
160 Private slot to handle a finished synchronization event.
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
161
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
162 @param type_ type of the synchronization event (string one
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
163 of "bookmarks", "history", "passwords", "useragents" or
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
164 "speeddial")
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
165 @param status flag indicating success (boolean)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
166 @param download flag indicating a download of a file (boolean)
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
167 """
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
168 if type_ == "bookmarks":
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
169 if status:
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 self.bookmarkLabel.setPixmap(
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 UI.PixmapCache.getPixmap("syncCompleted.png"))
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
173 self.bookmarkLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
174 UI.PixmapCache.getPixmap("syncFailed.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 elif type_ == "history":
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
176 if status:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
177 self.historyLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
178 UI.PixmapCache.getPixmap("syncCompleted.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
180 self.historyLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
181 UI.PixmapCache.getPixmap("syncFailed.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 elif type_ == "passwords":
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
183 if status:
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 self.passwordsLabel.setPixmap(
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 UI.PixmapCache.getPixmap("syncCompleted.png"))
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
187 self.passwordsLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
188 UI.PixmapCache.getPixmap("syncFailed.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 elif type_ == "useragents":
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
190 if status:
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 self.userAgentsLabel.setPixmap(
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 UI.PixmapCache.getPixmap("syncCompleted.png"))
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
194 self.userAgentsLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
195 UI.PixmapCache.getPixmap("syncFailed.png"))
1700
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
196 elif type_ == "speeddial":
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
197 if status:
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
198 self.speedDialLabel.setPixmap(
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
199 UI.PixmapCache.getPixmap("syncCompleted.png"))
40c911b8c0dd Made the speed dial settings synchronizable via the sync manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1695
diff changeset
200 else:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
201 self.speedDialLabel.setPixmap(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
202 UI.PixmapCache.getPixmap("syncFailed.png"))
1626
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 def __syncError(self, message):
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 Private slot to handle general synchronization issues.
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 @param message error message (string)
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 """
a77c8ea8582c Added capability to synchronise bookmarks, history, passwords and user agent settings via an FTP server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 self.syncErrorLabel.show()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
211 self.syncErrorLabel.setText(self.tr(
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
212 '<font color="#FF0000"><b>Error:</b> {0}</font>').format(message))

eric ide

mercurial