Helpviewer/Sync/SyncCheckPage.py

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

eric ide

mercurial