Helpviewer/Sync/SyncCheckPage.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3002
6ffc581f00f1
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
56 self.infoLabel.setText(self.trUtf8("Host:")) 56 self.infoLabel.setText(self.trUtf8("Host:"))
57 self.infoDataLabel.setText(Preferences.getHelp("SyncFtpServer")) 57 self.infoDataLabel.setText(Preferences.getHelp("SyncFtpServer"))
58 elif Preferences.getHelp("SyncType") == SyncGlobals.SyncTypeDirectory: 58 elif Preferences.getHelp("SyncType") == SyncGlobals.SyncTypeDirectory:
59 self.handlerLabel.setText(self.trUtf8("Shared Directory")) 59 self.handlerLabel.setText(self.trUtf8("Shared Directory"))
60 self.infoLabel.setText(self.trUtf8("Directory:")) 60 self.infoLabel.setText(self.trUtf8("Directory:"))
61 self.infoDataLabel.setText(Preferences.getHelp("SyncDirectoryPath")) 61 self.infoDataLabel.setText(
62 Preferences.getHelp("SyncDirectoryPath"))
62 else: 63 else:
63 self.handlerLabel.setText(self.trUtf8("No Synchronization")) 64 self.handlerLabel.setText(self.trUtf8("No Synchronization"))
64 self.hostLabel.setText("") 65 self.hostLabel.setText("")
65 66
66 self.bookmarkMsgLabel.setText("") 67 self.bookmarkMsgLabel.setText("")
68 self.passwordsMsgLabel.setText("") 69 self.passwordsMsgLabel.setText("")
69 self.userAgentsMsgLabel.setText("") 70 self.userAgentsMsgLabel.setText("")
70 self.speedDialMsgLabel.setText("") 71 self.speedDialMsgLabel.setText("")
71 72
72 if not syncMgr.syncEnabled(): 73 if not syncMgr.syncEnabled():
73 self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 74 self.bookmarkLabel.setPixmap(
75 UI.PixmapCache.getPixmap("syncNo.png"))
74 self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 76 self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png"))
75 self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 77 self.passwordsLabel.setPixmap(
76 self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 78 UI.PixmapCache.getPixmap("syncNo.png"))
77 self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 79 self.userAgentsLabel.setPixmap(
80 UI.PixmapCache.getPixmap("syncNo.png"))
81 self.speedDialLabel.setPixmap(
82 UI.PixmapCache.getPixmap("syncNo.png"))
78 return 83 return
79 84
80 animationFile = os.path.join(getConfig("ericPixDir"), "loading.gif") 85 animationFile = os.path.join(getConfig("ericPixDir"), "loading.gif")
81 86
82 # bookmarks 87 # bookmarks
83 if Preferences.getHelp("SyncBookmarks"): 88 if Preferences.getHelp("SyncBookmarks"):
84 self.__makeAnimatedLabel(animationFile, self.bookmarkLabel) 89 self.__makeAnimatedLabel(animationFile, self.bookmarkLabel)
85 else: 90 else:
86 self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 91 self.bookmarkLabel.setPixmap(
92 UI.PixmapCache.getPixmap("syncNo.png"))
87 93
88 # history 94 # history
89 if Preferences.getHelp("SyncHistory"): 95 if Preferences.getHelp("SyncHistory"):
90 self.__makeAnimatedLabel(animationFile, self.historyLabel) 96 self.__makeAnimatedLabel(animationFile, self.historyLabel)
91 else: 97 else:
93 99
94 # Passwords 100 # Passwords
95 if Preferences.getHelp("SyncPasswords"): 101 if Preferences.getHelp("SyncPasswords"):
96 self.__makeAnimatedLabel(animationFile, self.passwordsLabel) 102 self.__makeAnimatedLabel(animationFile, self.passwordsLabel)
97 else: 103 else:
98 self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 104 self.passwordsLabel.setPixmap(
105 UI.PixmapCache.getPixmap("syncNo.png"))
99 106
100 # user agent settings 107 # user agent settings
101 if Preferences.getHelp("SyncUserAgents"): 108 if Preferences.getHelp("SyncUserAgents"):
102 self.__makeAnimatedLabel(animationFile, self.userAgentsLabel) 109 self.__makeAnimatedLabel(animationFile, self.userAgentsLabel)
103 else: 110 else:
104 self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 111 self.userAgentsLabel.setPixmap(
112 UI.PixmapCache.getPixmap("syncNo.png"))
105 113
106 # speed dial settings 114 # speed dial settings
107 if Preferences.getHelp("SyncSpeedDial"): 115 if Preferences.getHelp("SyncSpeedDial"):
108 self.__makeAnimatedLabel(animationFile, self.speedDialLabel) 116 self.__makeAnimatedLabel(animationFile, self.speedDialLabel)
109 else: 117 else:
110 self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) 118 self.speedDialLabel.setPixmap(
111 119 UI.PixmapCache.getPixmap("syncNo.png"))
112 QTimer.singleShot(0, lambda: syncMgr.loadSettings(forceUpload=forceUpload)) 120
121 QTimer.singleShot(
122 0, lambda: syncMgr.loadSettings(forceUpload=forceUpload))
113 123
114 def __makeAnimatedLabel(self, fileName, label): 124 def __makeAnimatedLabel(self, fileName, label):
115 """ 125 """
116 Private slot to create an animated label. 126 Private slot to create an animated label.
117 127
144 def __updateLabels(self, type_, status, download): 154 def __updateLabels(self, type_, status, download):
145 """ 155 """
146 Private slot to handle a finished synchronization event. 156 Private slot to handle a finished synchronization event.
147 157
148 @param type_ type of the synchronization event (string one 158 @param type_ type of the synchronization event (string one
149 of "bookmarks", "history", "passwords", "useragents" or "speeddial") 159 of "bookmarks", "history", "passwords", "useragents" or
160 "speeddial")
150 @param status flag indicating success (boolean) 161 @param status flag indicating success (boolean)
151 @param download flag indicating a download of a file (boolean) 162 @param download flag indicating a download of a file (boolean)
152 """ 163 """
153 if type_ == "bookmarks": 164 if type_ == "bookmarks":
154 if status: 165 if status:
155 self.bookmarkLabel.setPixmap( 166 self.bookmarkLabel.setPixmap(
156 UI.PixmapCache.getPixmap("syncCompleted.png")) 167 UI.PixmapCache.getPixmap("syncCompleted.png"))
157 else: 168 else:
158 self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) 169 self.bookmarkLabel.setPixmap(
170 UI.PixmapCache.getPixmap("syncFailed.png"))
159 elif type_ == "history": 171 elif type_ == "history":
160 if status: 172 if status:
161 self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncCompleted.png")) 173 self.historyLabel.setPixmap(
162 else: 174 UI.PixmapCache.getPixmap("syncCompleted.png"))
163 self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) 175 else:
176 self.historyLabel.setPixmap(
177 UI.PixmapCache.getPixmap("syncFailed.png"))
164 elif type_ == "passwords": 178 elif type_ == "passwords":
165 if status: 179 if status:
166 self.passwordsLabel.setPixmap( 180 self.passwordsLabel.setPixmap(
167 UI.PixmapCache.getPixmap("syncCompleted.png")) 181 UI.PixmapCache.getPixmap("syncCompleted.png"))
168 else: 182 else:
169 self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) 183 self.passwordsLabel.setPixmap(
184 UI.PixmapCache.getPixmap("syncFailed.png"))
170 elif type_ == "useragents": 185 elif type_ == "useragents":
171 if status: 186 if status:
172 self.userAgentsLabel.setPixmap( 187 self.userAgentsLabel.setPixmap(
173 UI.PixmapCache.getPixmap("syncCompleted.png")) 188 UI.PixmapCache.getPixmap("syncCompleted.png"))
174 else: 189 else:
175 self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) 190 self.userAgentsLabel.setPixmap(
191 UI.PixmapCache.getPixmap("syncFailed.png"))
176 elif type_ == "speeddial": 192 elif type_ == "speeddial":
177 if status: 193 if status:
178 self.speedDialLabel.setPixmap( 194 self.speedDialLabel.setPixmap(
179 UI.PixmapCache.getPixmap("syncCompleted.png")) 195 UI.PixmapCache.getPixmap("syncCompleted.png"))
180 else: 196 else:
181 self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) 197 self.speedDialLabel.setPixmap(
198 UI.PixmapCache.getPixmap("syncFailed.png"))
182 199
183 def __syncError(self, message): 200 def __syncError(self, message):
184 """ 201 """
185 Private slot to handle general synchronization issues. 202 Private slot to handle general synchronization issues.
186 203
187 @param message error message (string) 204 @param message error message (string)
188 """ 205 """
189 self.syncErrorLabel.show() 206 self.syncErrorLabel.show()
190 self.syncErrorLabel.setText( 207 self.syncErrorLabel.setText(self.trUtf8(
191 self.trUtf8('<font color="#FF0000"><b>Error:</b> {0}</font>').format(message)) 208 '<font color="#FF0000"><b>Error:</b> {0}</font>').format(message))

eric ide

mercurial