VCS/ProjectHelper.py

changeset 5669
63295be38bc6
parent 5452
9f89364d9ffd
child 6046
a291657f7bbd
--- a/VCS/ProjectHelper.py	Thu Mar 30 18:58:51 2017 +0200
+++ b/VCS/ProjectHelper.py	Thu Mar 30 19:04:57 2017 +0200
@@ -13,7 +13,7 @@
 import shutil
 import copy
 
-from PyQt5.QtCore import pyqtSlot, QDir, QFileInfo, QObject
+from PyQt5.QtCore import pyqtSlot, QDir, QFileInfo, QObject, QCoreApplication
 from PyQt5.QtWidgets import QDialog, QInputDialog, QToolBar
 
 from E5Gui.E5Action import E5Action
@@ -66,14 +66,18 @@
         Public method to generate the action objects.
         """
         self.vcsNewAct = E5Action(
-            self.tr('New from repository'),
+            QCoreApplication.translate(
+                "VcsProjectHelper", 'New from repository'),
             UI.PixmapCache.getIcon("vcsCheckout.png"),
-            self.tr('&New from repository...'),
+            QCoreApplication.translate(
+                "VcsProjectHelper", '&New from repository...'),
             0, 0, self, 'vcs_new')
-        self.vcsNewAct.setStatusTip(self.tr(
+        self.vcsNewAct.setStatusTip(QCoreApplication.translate(
+            "VcsProjectHelper",
             'Create a new project from the VCS repository'
         ))
-        self.vcsNewAct.setWhatsThis(self.tr(
+        self.vcsNewAct.setWhatsThis(QCoreApplication.translate(
+            "VcsProjectHelper",
             """<b>New from repository</b>"""
             """<p>This creates a new local project from the VCS"""
             """ repository.</p>"""
@@ -82,14 +86,18 @@
         self.actions.append(self.vcsNewAct)
         
         self.vcsExportAct = E5Action(
-            self.tr('Export from repository'),
+            QCoreApplication.translate(
+                "VcsProjectHelper", 'Export from repository'),
             UI.PixmapCache.getIcon("vcsExport.png"),
-            self.tr('&Export from repository...'),
+            QCoreApplication.translate(
+                "VcsProjectHelper", '&Export from repository...'),
             0, 0, self, 'vcs_export')
-        self.vcsExportAct.setStatusTip(self.tr(
+        self.vcsExportAct.setStatusTip(QCoreApplication.translate(
+            "VcsProjectHelper",
             'Export a project from the repository'
         ))
-        self.vcsExportAct.setWhatsThis(self.tr(
+        self.vcsExportAct.setWhatsThis(QCoreApplication.translate(
+            "VcsProjectHelper",
             """<b>Export from repository</b>"""
             """<p>This exports a project from the repository.</p>"""
         ))
@@ -97,14 +105,18 @@
         self.actions.append(self.vcsExportAct)
         
         self.vcsAddAct = E5Action(
-            self.tr('Add to repository'),
+            QCoreApplication.translate(
+                "VcsProjectHelper", 'Add to repository'),
             UI.PixmapCache.getIcon("vcsCommit.png"),
-            self.tr('&Add to repository...'),
+            QCoreApplication.translate(
+                "VcsProjectHelper", '&Add to repository...'),
             0, 0, self, 'vcs_add')
-        self.vcsAddAct.setStatusTip(self.tr(
+        self.vcsAddAct.setStatusTip(QCoreApplication.translate(
+            "VcsProjectHelper",
             'Add the local project to the VCS repository'
         ))
-        self.vcsAddAct.setWhatsThis(self.tr(
+        self.vcsAddAct.setWhatsThis(QCoreApplication.translate(
+            "VcsProjectHelper",
             """<b>Add to repository</b>"""
             """<p>This adds (imports) the local project to the VCS"""
             """ repository.</p>"""
@@ -146,10 +158,11 @@
             (E5ToolBarManager)
         @return the toolbar generated (QToolBar)
         """
-        tb = QToolBar(self.tr("VCS"), ui)
+        tb = QToolBar(QCoreApplication.translate("VcsProjectHelper", "VCS"),
+                      ui)
         tb.setIconSize(UI.Config.ToolBarIconSize)
         tb.setObjectName("VersionControlToolbar")
-        tb.setToolTip(self.tr('VCS'))
+        tb.setToolTip(QCoreApplication.translate("VcsProjectHelper", 'VCS'))
         
         tb.addAction(self.vcsNewAct)
         tb.addAction(self.vcsExportAct)
@@ -190,8 +203,10 @@
             vcsSystemsDisplay.append(vcsSystemsDict[key])
         vcsSelected, ok = QInputDialog.getItem(
             None,
-            self.tr("New Project"),
-            self.tr("Select version control system for the project"),
+            QCoreApplication.translate("VcsProjectHelper", "New Project"),
+            QCoreApplication.translate(
+                "VcsProjectHelper",
+                "Select version control system for the project"),
             vcsSystemsDisplay,
             0, False)
         if not ok:
@@ -215,8 +230,10 @@
                 if self.project.vcs.vcsSupportCommandOptions():
                     vcores = E5MessageBox.yesNo(
                         self.parent(),
-                        self.tr("New Project"),
-                        self.tr(
+                        QCoreApplication.translate(
+                            "VcsProjectHelper", "New Project"),
+                        QCoreApplication.translate(
+                            "VcsProjectHelper",
                             """Would you like to edit the VCS command"""
                             """ options?"""))
                 else:
@@ -234,8 +251,11 @@
                     except EnvironmentError:
                         E5MessageBox.critical(
                             self.parent(),
-                            self.tr("Create project directory"),
-                            self.tr(
+                            QCoreApplication.translate(
+                                "VcsProjectHelper",
+                                "Create project directory"),
+                            QCoreApplication.translate(
+                                "VcsProjectHelper",
                                 "<p>The project directory <b>{0}</b> could not"
                                 " be created.</p>").format(projectdir))
                         self.project.pdata["VCS"] = 'None'
@@ -263,8 +283,12 @@
                             pfilenamelist = d.entryList(filters)
                             pfilename, ok = QInputDialog.getItem(
                                 None,
-                                self.tr("New project from repository"),
-                                self.tr("Select a project file to open."),
+                                QCoreApplication.translate(
+                                    "VcsProjectHelper",
+                                    "New project from repository"),
+                                QCoreApplication.translate(
+                                    "VcsProjectHelper",
+                                    "Select a project file to open."),
                                 pfilenamelist, 0, False)
                             if ok:
                                 self.project.openProject(
@@ -278,8 +302,11 @@
                     else:
                         res = E5MessageBox.yesNo(
                             self.parent(),
-                            self.tr("New project from repository"),
-                            self.tr(
+                            QCoreApplication.translate(
+                                "VcsProjectHelper",
+                                "New project from repository"),
+                            QCoreApplication.translate(
+                                "VcsProjectHelper",
                                 "The project retrieved from the repository"
                                 " does not contain an eric project file"
                                 " (*.e4p). Create it?"),
@@ -310,9 +337,11 @@
                                 if not export:
                                     res = E5MessageBox.yesNo(
                                         self.parent(),
-                                        self.tr(
+                                        QCoreApplication.translate(
+                                            "VcsProjectHelper",
                                             "New project from repository"),
-                                        self.tr(
+                                        QCoreApplication.translate(
+                                            "VcsProjectHelper",
                                             "Shall the project file be added"
                                             " to the repository?"),
                                         yesDefault=True)
@@ -322,8 +351,10 @@
                 else:
                     E5MessageBox.critical(
                         self.parent(),
-                        self.tr("New project from repository"),
-                        self.tr(
+                        QCoreApplication.translate(
+                            "VcsProjectHelper", "New project from repository"),
+                        QCoreApplication.translate(
+                            "VcsProjectHelper",
                             """The project could not be retrieved from"""
                             """ the repository."""))
                     self.project.pdata["VCS"] = 'None'
@@ -378,8 +409,10 @@
             vcsSystemsDisplay.append(vcsSystemsDict[key])
         vcsSelected, ok = QInputDialog.getItem(
             None,
-            self.tr("Import Project"),
-            self.tr("Select version control system for the project"),
+            QCoreApplication.translate("VcsProjectHelper", "Import Project"),
+            QCoreApplication.translate(
+                "VcsProjectHelper",
+                "Select version control system for the project"),
             vcsSystemsDisplay,
             0, False)
         if not ok:
@@ -399,8 +432,10 @@
                 if self.project.vcs.vcsSupportCommandOptions():
                     vcores = E5MessageBox.yesNo(
                         self.parent(),
-                        self.tr("Import Project"),
-                        self.tr(
+                        QCoreApplication.translate(
+                            "VcsProjectHelper", "Import Project"),
+                        QCoreApplication.translate(
+                            "VcsProjectHelper",
                             """Would you like to edit the VCS command"""
                             """ options?"""))
                 else:
@@ -434,8 +469,10 @@
         if shouldReopen:
             res = E5MessageBox.yesNo(
                 self.parent(),
-                self.tr("Update"),
-                self.tr("""The project should be reread. Do this now?"""),
+                QCoreApplication.translate("VcsProjectHelper", "Update"),
+                QCoreApplication.translate(
+                    "VcsProjectHelper",
+                    """The project should be reread. Do this now?"""),
                 yesDefault=True)
             if res:
                 self.project.reopenProject()
@@ -460,8 +497,11 @@
         """
         res = E5MessageBox.yesNo(
             self.parent(),
-            self.tr("Remove project from repository"),
-            self.tr(
+            QCoreApplication.translate(
+                "VcsProjectHelper",
+                "Remove project from repository"),
+            QCoreApplication.translate(
+                "VcsProjectHelper",
                 "Dou you really want to remove this project from"
                 " the repository (and disk)?"))
         if res:
@@ -531,8 +571,10 @@
         if shouldReopen:
             res = E5MessageBox.yesNo(
                 self.parent(),
-                self.tr("Switch"),
-                self.tr("""The project should be reread. Do this now?"""),
+                QCoreApplication.translate("VcsProjectHelper", "Switch"),
+                QCoreApplication.translate(
+                    "VcsProjectHelper",
+                    """The project should be reread. Do this now?"""),
                 yesDefault=True)
             if res:
                 self.project.reopenProject()

eric ide

mercurial