PluginManager/PluginInstallDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3345
071afe8be2a1
child 3532
86ac124f322c
--- a/PluginManager/PluginInstallDialog.py	Sun Mar 30 22:00:14 2014 +0200
+++ b/PluginManager/PluginInstallDialog.py	Thu Apr 03 23:05:31 2014 +0200
@@ -61,11 +61,11 @@
             self.__external = False
         
         self.__backButton = self.buttonBox.addButton(
-            self.trUtf8("< Back"), QDialogButtonBox.ActionRole)
+            self.tr("< Back"), QDialogButtonBox.ActionRole)
         self.__nextButton = self.buttonBox.addButton(
-            self.trUtf8("Next >"), QDialogButtonBox.ActionRole)
+            self.tr("Next >"), QDialogButtonBox.ActionRole)
         self.__finishButton = self.buttonBox.addButton(
-            self.trUtf8("Install"), QDialogButtonBox.ActionRole)
+            self.tr("Install"), QDialogButtonBox.ActionRole)
         
         self.__closeButton = self.buttonBox.button(QDialogButtonBox.Close)
         self.__cancelButton = self.buttonBox.button(QDialogButtonBox.Cancel)
@@ -73,13 +73,13 @@
         userDir = self.__pluginManager.getPluginDir("user")
         if userDir is not None:
             self.destinationCombo.addItem(
-                self.trUtf8("User plugins directory"),
+                self.tr("User plugins directory"),
                 userDir)
         
         globalDir = self.__pluginManager.getPluginDir("global")
         if globalDir is not None and os.access(globalDir, os.W_OK):
             self.destinationCombo.addItem(
-                self.trUtf8("Global plugins directory"),
+                self.tr("Global plugins directory"),
                 globalDir)
         
         self.__installedDirs = []
@@ -142,7 +142,7 @@
             self.__closeButton.hide()
             self.__cancelButton.show()
             
-            msg = self.trUtf8(
+            msg = self.tr(
                 "Plugin ZIP-Archives:\n{0}\n\nDestination:\n{1} ({2})")\
                 .format("\n".join(self.__createArchivesList()),
                         self.destinationCombo.currentText(),
@@ -159,9 +159,9 @@
         dn = Preferences.getPluginManager("DownloadPath")
         archives = E5FileDialog.getOpenFileNames(
             self,
-            self.trUtf8("Select plugin ZIP-archives"),
+            self.tr("Select plugin ZIP-archives"),
             dn,
-            self.trUtf8("Plugin archive (*.zip)"))
+            self.tr("Plugin archive (*.zip)"))
         
         if archives:
             matchflags = Qt.MatchFixedString
@@ -224,21 +224,21 @@
         self.summaryEdit.clear()
         for archive in self.__createArchivesList():
             self.summaryEdit.append(
-                self.trUtf8("Installing {0} ...").format(archive))
+                self.tr("Installing {0} ...").format(archive))
             ok, msg, restart = self.__installPlugin(archive)
             res = res and ok
             if ok:
-                self.summaryEdit.append(self.trUtf8("  ok"))
+                self.summaryEdit.append(self.tr("  ok"))
             else:
                 self.summaryEdit.append(msg)
             if restart:
                 self.__restartNeeded = True
         self.summaryEdit.append("\n")
         if res:
-            self.summaryEdit.append(self.trUtf8(
+            self.summaryEdit.append(self.tr(
                 """The plugins were installed successfully."""))
         else:
-            self.summaryEdit.append(self.trUtf8(
+            self.summaryEdit.append(self.tr(
                 """Some plugins could not be installed."""))
         
         return res
@@ -267,7 +267,7 @@
         # check, if the archive exists
         if not os.path.exists(archive):
             return False, \
-                self.trUtf8(
+                self.tr(
                     """<p>The archive file <b>{0}</b> does not exist. """
                     """Aborting...</p>""").format(archive), \
                 False
@@ -275,7 +275,7 @@
         # check, if the archive is a valid zip file
         if not zipfile.is_zipfile(archive):
             return False, \
-                self.trUtf8(
+                self.tr(
                     """<p>The file <b>{0}</b> is not a valid plugin """
                     """ZIP-archive. Aborting...</p>""").format(archive), \
                 False
@@ -283,7 +283,7 @@
         # check, if the destination is writeable
         if not os.access(destination, os.W_OK):
             return False, \
-                self.trUtf8(
+                self.tr(
                     """<p>The destination directory <b>{0}</b> is not """
                     """writeable. Aborting...</p>""").format(destination), \
                 False
@@ -302,7 +302,7 @@
         
         if not pluginFound:
             return False, \
-                self.trUtf8(
+                self.tr(
                     """<p>The file <b>{0}</b> is not a valid plugin """
                     """ZIP-archive. Aborting...</p>""").format(archive), \
                 False
@@ -347,7 +347,7 @@
         
         if not packageName:
             return False, \
-                self.trUtf8(
+                self.tr(
                     """<p>The plugin module <b>{0}</b> does not contain """
                     """a 'packageName' attribute. Aborting...</p>""")\
                 .format(pluginFileName), \
@@ -355,7 +355,7 @@
         
         if pyqtApi < 2:
             return False, \
-                self.trUtf8(
+                self.tr(
                     """<p>The plugin module <b>{0}</b> does not conform"""
                     """ with the PyQt v2 API. Aborting...</p>""")\
                 .format(pluginFileName), \
@@ -366,8 +366,8 @@
            packageName != "None" and \
            os.path.exists(os.path.join(destination, packageName)):
             return False, \
-                self.trUtf8("""<p>The plugin package <b>{0}</b> exists. """
-                            """Aborting...</p>""")\
+                self.tr("""<p>The plugin package <b>{0}</b> exists. """
+                        """Aborting...</p>""")\
                     .format(os.path.join(destination, packageName)), \
                 False
         
@@ -375,8 +375,8 @@
            packageName != "None" and \
            not os.path.exists(os.path.join(destination, packageName)):
             return False, \
-                self.trUtf8("""<p>The plugin module <b>{0}</b> exists. """
-                            """Aborting...</p>""")\
+                self.tr("""<p>The plugin module <b>{0}</b> exists. """
+                        """Aborting...</p>""")\
                     .format(os.path.join(destination, pluginFileName)), \
                 False
         
@@ -442,26 +442,26 @@
         except os.error as why:
             self.__rollback()
             return False, \
-                self.trUtf8(
+                self.tr(
                     "Error installing plugin. Reason: {0}").format(str(why)), \
                 False
         except IOError as why:
             self.__rollback()
             return False, \
-                self.trUtf8(
+                self.tr(
                     "Error installing plugin. Reason: {0}").format(str(why)), \
                 False
         except OSError as why:
             self.__rollback()
             return False, \
-                self.trUtf8(
+                self.tr(
                     "Error installing plugin. Reason: {0}").format(str(why)), \
                 False
         except:
             sys.stderr.write("Unspecific exception installing plugin.\n")
             self.__rollback()
             return False, \
-                self.trUtf8("Unspecific exception installing plugin."), \
+                self.tr("Unspecific exception installing plugin."), \
                 False
         
         # now compile the plugins
@@ -583,9 +583,10 @@
         size = self.cw.size()
         self.__layout.addWidget(self.cw)
         self.resize(size)
+        self.setWindowTitle(self.cw.windowTitle())
         
-        self.cw.buttonBox.accepted[()].connect(self.accept)
-        self.cw.buttonBox.rejected[()].connect(self.reject)
+        self.cw.buttonBox.accepted.connect(self.accept)
+        self.cw.buttonBox.rejected.connect(self.reject)
     
     def restartNeeded(self):
         """
@@ -613,9 +614,10 @@
         size = self.cw.size()
         self.setCentralWidget(self.cw)
         self.resize(size)
+        self.setWindowTitle(self.cw.windowTitle())
         
         self.setStyle(Preferences.getUI("Style"),
                       Preferences.getUI("StyleSheet"))
         
-        self.cw.buttonBox.accepted[()].connect(self.close)
-        self.cw.buttonBox.rejected[()].connect(self.close)
+        self.cw.buttonBox.accepted.connect(self.close)
+        self.cw.buttonBox.rejected.connect(self.close)

eric ide

mercurial