src/eric7/WebBrowser/Sync/SyncCheckPage.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/WebBrowser/Sync/SyncCheckPage.py
--- a/src/eric7/WebBrowser/Sync/SyncCheckPage.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/WebBrowser/Sync/SyncCheckPage.py	Wed Jul 13 14:55:47 2022 +0200
@@ -22,105 +22,93 @@
     """
     Class implementing the synchronization status wizard page.
     """
+
     def __init__(self, parent=None):
         """
         Constructor
-        
+
         @param parent reference to the parent widget (QWidget)
         """
         super().__init__(parent)
         self.setupUi(self)
-    
+
     def initializePage(self):
         """
         Public method to initialize the page.
         """
         self.syncErrorLabel.hide()
-        
+
         forceUpload = self.field("ReencryptData")
-        
+
         from WebBrowser.WebBrowserWindow import WebBrowserWindow
+
         syncMgr = WebBrowserWindow.syncManager()
         syncMgr.syncError.connect(self.__syncError)
         syncMgr.syncStatus.connect(self.__updateMessages)
         syncMgr.syncFinished.connect(self.__updateLabels)
-        
+
         if Preferences.getWebBrowser("SyncType") == SyncGlobals.SyncTypeFtp:
             self.handlerLabel.setText(self.tr("FTP"))
             self.infoLabel.setText(self.tr("Host:"))
-            self.infoDataLabel.setText(
-                Preferences.getWebBrowser("SyncFtpServer"))
-        elif (
-            Preferences.getWebBrowser("SyncType") ==
-                SyncGlobals.SyncTypeDirectory
-        ):
+            self.infoDataLabel.setText(Preferences.getWebBrowser("SyncFtpServer"))
+        elif Preferences.getWebBrowser("SyncType") == SyncGlobals.SyncTypeDirectory:
             self.handlerLabel.setText(self.tr("Shared Directory"))
             self.infoLabel.setText(self.tr("Directory:"))
-            self.infoDataLabel.setText(
-                Preferences.getWebBrowser("SyncDirectoryPath"))
+            self.infoDataLabel.setText(Preferences.getWebBrowser("SyncDirectoryPath"))
         else:
             self.handlerLabel.setText(self.tr("No Synchronization"))
             self.hostLabel.setText("")
-        
+
         self.bookmarkMsgLabel.setText("")
         self.historyMsgLabel.setText("")
         self.passwordsMsgLabel.setText("")
         self.userAgentsMsgLabel.setText("")
         self.speedDialMsgLabel.setText("")
-        
+
         if not syncMgr.syncEnabled():
-            self.bookmarkLabel.setPixmap(
-                UI.PixmapCache.getPixmap("syncNo"))
+            self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
             self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
-            self.passwordsLabel.setPixmap(
-                UI.PixmapCache.getPixmap("syncNo"))
-            self.userAgentsLabel.setPixmap(
-                UI.PixmapCache.getPixmap("syncNo"))
-            self.speedDialLabel.setPixmap(
-                UI.PixmapCache.getPixmap("syncNo"))
+            self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
+            self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
+            self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
             return
-        
+
         # bookmarks
         if Preferences.getWebBrowser("SyncBookmarks"):
             self.__makeAnimatedLabel("loadingAnimation", self.bookmarkLabel)
         else:
-            self.bookmarkLabel.setPixmap(
-                UI.PixmapCache.getPixmap("syncNo"))
-        
+            self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
+
         # history
         if Preferences.getWebBrowser("SyncHistory"):
             self.__makeAnimatedLabel("loadingAnimation", self.historyLabel)
         else:
             self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
-        
+
         # Passwords
         if Preferences.getWebBrowser("SyncPasswords"):
             self.__makeAnimatedLabel("loadingAnimation", self.passwordsLabel)
         else:
-            self.passwordsLabel.setPixmap(
-                UI.PixmapCache.getPixmap("syncNo"))
-        
+            self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
+
         # user agent settings
         if Preferences.getWebBrowser("SyncUserAgents"):
             self.__makeAnimatedLabel("loadingAnimation", self.userAgentsLabel)
         else:
-            self.userAgentsLabel.setPixmap(
-                UI.PixmapCache.getPixmap("syncNo"))
-        
+            self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
+
         # speed dial settings
         if Preferences.getWebBrowser("SyncSpeedDial"):
             self.__makeAnimatedLabel("loadingAnimation", self.speedDialLabel)
         else:
-            self.speedDialLabel.setPixmap(
-                UI.PixmapCache.getPixmap("syncNo"))
-        
-        QTimer.singleShot(
-            0, lambda: syncMgr.loadSettings(forceUpload=forceUpload))
-    
+            self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo"))
+
+        QTimer.singleShot(0, lambda: syncMgr.loadSettings(forceUpload=forceUpload))
+
     def __makeAnimatedLabel(self, fileName, label):
         """
         Private slot to create an animated label.
-        
+
         @param fileName name of the file containing the animation
         @type str
         @param label reference to the label to be animated
@@ -129,11 +117,11 @@
         label.setInterval(40)
         label.setAnimationFile(fileName)
         label.start()
-    
+
     def __updateMessages(self, type_, msg):
         """
         Private slot to update the synchronization status info.
-        
+
         @param type_ type of synchronization data (string)
         @param msg synchronization message (string)
         """
@@ -147,11 +135,11 @@
             self.userAgentsMsgLabel.setText(msg)
         elif type_ == "speeddial":
             self.speedDialMsgLabel.setText(msg)
-    
+
     def __updateLabels(self, type_, status, download):
         """
         Private slot to handle a finished synchronization event.
-        
+
         @param type_ type of the synchronization event (string one
             of "bookmarks", "history", "passwords", "useragents" or
             "speeddial")
@@ -160,46 +148,39 @@
         """
         if type_ == "bookmarks":
             if status:
-                self.bookmarkLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncCompleted"))
+                self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncCompleted"))
             else:
-                self.bookmarkLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncFailed"))
+                self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed"))
         elif type_ == "history":
             if status:
-                self.historyLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncCompleted"))
+                self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncCompleted"))
             else:
-                self.historyLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncFailed"))
+                self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed"))
         elif type_ == "passwords":
             if status:
-                self.passwordsLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncCompleted"))
+                self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncCompleted"))
             else:
-                self.passwordsLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncFailed"))
+                self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed"))
         elif type_ == "useragents":
             if status:
                 self.userAgentsLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncCompleted"))
+                    UI.PixmapCache.getPixmap("syncCompleted")
+                )
             else:
-                self.userAgentsLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncFailed"))
+                self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed"))
         elif type_ == "speeddial":
             if status:
-                self.speedDialLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncCompleted"))
+                self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncCompleted"))
             else:
-                self.speedDialLabel.setPixmap(
-                    UI.PixmapCache.getPixmap("syncFailed"))
-    
+                self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed"))
+
     def __syncError(self, message):
         """
         Private slot to handle general synchronization issues.
-        
+
         @param message error message (string)
         """
         self.syncErrorLabel.show()
-        self.syncErrorLabel.setText(self.tr(
-            '<font color="#FF0000"><b>Error:</b> {0}</font>').format(message))
+        self.syncErrorLabel.setText(
+            self.tr('<font color="#FF0000"><b>Error:</b> {0}</font>').format(message)
+        )

eric ide

mercurial