Fixed an inconvenience in the project and project translations viewer.

Fri, 29 Apr 2011 18:34:40 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 29 Apr 2011 18:34:40 +0200
changeset 1003
b81a77ac656a
parent 1002
1151d1ea562a
child 1005
6986db425aa2

Fixed an inconvenience in the project and project translations viewer.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Project.Project.html file | annotate | diff | comparison | revisions
Project/Project.py file | annotate | diff | comparison | revisions
Project/ProjectTranslationsBrowser.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Wed Apr 27 12:24:50 2011 +0200
+++ b/APIs/Python3/eric5.api	Fri Apr 29 18:34:40 2011 +0200
@@ -4715,6 +4715,7 @@
 eric5.Project.Project.Project.getSources?4(normalized=False)
 eric5.Project.Project.Project.getStatusMonitorAutoUpdate?4()
 eric5.Project.Project.Project.getStatusMonitorInterval?4()
+eric5.Project.Project.Project.getTranslationPattern?4()
 eric5.Project.Project.Project.getVcs?4()
 eric5.Project.Project.Project.handleApplicationDiagram?4()
 eric5.Project.Project.Project.handlePreferencesChanged?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Wed Apr 27 12:24:50 2011 +0200
+++ b/Documentation/Help/source.qhp	Fri Apr 29 18:34:40 2011 +0200
@@ -4787,6 +4787,7 @@
       <keyword name="Project.getSources" id="Project.getSources" ref="eric5.Project.Project.html#Project.getSources" />
       <keyword name="Project.getStatusMonitorAutoUpdate" id="Project.getStatusMonitorAutoUpdate" ref="eric5.Project.Project.html#Project.getStatusMonitorAutoUpdate" />
       <keyword name="Project.getStatusMonitorInterval" id="Project.getStatusMonitorInterval" ref="eric5.Project.Project.html#Project.getStatusMonitorInterval" />
+      <keyword name="Project.getTranslationPattern" id="Project.getTranslationPattern" ref="eric5.Project.Project.html#Project.getTranslationPattern" />
       <keyword name="Project.getVcs" id="Project.getVcs" ref="eric5.Project.Project.html#Project.getVcs" />
       <keyword name="Project.handleApplicationDiagram" id="Project.handleApplicationDiagram" ref="eric5.Project.Project.html#Project.handleApplicationDiagram" />
       <keyword name="Project.handlePreferencesChanged" id="Project.handlePreferencesChanged" ref="eric5.Project.Project.html#Project.handlePreferencesChanged" />
--- a/Documentation/Source/eric5.Project.Project.html	Wed Apr 27 12:24:50 2011 +0200
+++ b/Documentation/Source/eric5.Project.Project.html	Fri Apr 29 18:34:40 2011 +0200
@@ -476,6 +476,9 @@
 <td><a href="#Project.getStatusMonitorInterval">getStatusMonitorInterval</a></td>
 <td>Public method to get the monitor interval.</td>
 </tr><tr>
+<td><a href="#Project.getTranslationPattern">getTranslationPattern</a></td>
+<td>Public method to get the translation pattern.</td>
+</tr><tr>
 <td><a href="#Project.getVcs">getVcs</a></td>
 <td>Public method to get a reference to the VCS object.</td>
 </tr><tr>
@@ -1599,6 +1602,16 @@
 <dd>
 interval in seconds (integer)
 </dd>
+</dl><a NAME="Project.getTranslationPattern" ID="Project.getTranslationPattern"></a>
+<h4>Project.getTranslationPattern</h4>
+<b>getTranslationPattern</b>(<i></i>)
+<p>
+        Public method to get the translation pattern.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+translation pattern (string)
+</dd>
 </dl><a NAME="Project.getVcs" ID="Project.getVcs"></a>
 <h4>Project.getVcs</h4>
 <b>getVcs</b>(<i></i>)
--- a/Project/Project.py	Wed Apr 27 12:24:50 2011 +0200
+++ b/Project/Project.py	Fri Apr 29 18:34:40 2011 +0200
@@ -1031,14 +1031,23 @@
         if autoContinue is not None:
             self.dbgAutoContinue = autoContinue
     
+    def getTranslationPattern(self):
+        """
+        Public method to get the translation pattern.
+        
+        @return translation pattern (string)
+        """
+        if self.pdata["TRANSLATIONPATTERN"]:
+            return self.pdata["TRANSLATIONPATTERN"][0]
+        else:
+            return ""
+    
     def addLanguage(self):
         """
         Public slot used to add a language to the project.
         """
-        if self.pdata["PROJECTTYPE"][0] in \
-                ["Qt4", "Qt4C", "E4Plugin", "PySide", "PySideC"] and \
-           (len(self.pdata["TRANSLATIONPATTERN"]) == 0 or \
-            self.pdata["TRANSLATIONPATTERN"][0] == ''):
+        if len(self.pdata["TRANSLATIONPATTERN"]) == 0 or \
+           self.pdata["TRANSLATIONPATTERN"][0] == '':
             E5MessageBox.critical(self.ui,
                 self.trUtf8("Add Language"),
                 self.trUtf8("You have to specify a translation pattern first."))
@@ -1806,6 +1815,9 @@
             self.menuApidocAct.setEnabled(True)
             self.menuPackagersAct.setEnabled(True)
             self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin")
+            self.addLanguageAct.setEnabled(
+                len(self.pdata["TRANSLATIONPATTERN"]) > 0 and \
+                self.pdata["TRANSLATIONPATTERN"][0] != '')
             
             self.projectAboutToBeCreated.emit()
             
@@ -2310,6 +2322,9 @@
                     self.menuApidocAct.setEnabled(True)
                     self.menuPackagersAct.setEnabled(True)
                     self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin")
+                    self.addLanguageAct.setEnabled(
+                        len(self.pdata["TRANSLATIONPATTERN"]) > 0 and \
+                        self.pdata["TRANSLATIONPATTERN"][0] != '')
                     
                     self.__model.projectOpened()
                     self.projectOpenedHooks.emit()
--- a/Project/ProjectTranslationsBrowser.py	Wed Apr 27 12:24:50 2011 +0200
+++ b/Project/ProjectTranslationsBrowser.py	Fri Apr 29 18:34:40 2011 +0200
@@ -200,7 +200,8 @@
         act = self.menu.addAction(self.trUtf8('Delete'), self.__deleteLanguageFile)
         self.menuActions.append(act)
         self.menu.addSeparator()
-        self.menu.addAction(self.trUtf8('Add translation...'), self.project.addLanguage)
+        self.__addTranslationAct = self.menu.addAction(
+            self.trUtf8('Add translation...'), self.project.addLanguage)
         self.menu.addAction(self.trUtf8('Add translation files...'),
             self.__addTranslationFiles)
         self.menu.addSeparator()
@@ -251,8 +252,8 @@
                     self.__releaseAll)
                 self.qmprocBackMenuActions.append(act)
         self.backMenu.addSeparator()
-        self.backMenu.addAction(self.trUtf8('Add translation...'),
-            self.project.addLanguage)
+        self.__addTranslationBackAct = self.backMenu.addAction(
+            self.trUtf8('Add translation...'), self.project.addLanguage)
         self.backMenu.addAction(self.trUtf8('Add translation files...'),
             self.__addTranslationFiles)
         self.backMenu.addSeparator()
@@ -374,8 +375,8 @@
                     self.__releaseAll)
                 self.qmprocDirMenuActions.append(act)
         self.dirMenu.addSeparator()
-        self.dirMenu.addAction(self.trUtf8('Add translation...'),
-            self.project.addLanguage)
+        self.__addTranslationDirAct = self.dirMenu.addAction(
+            self.trUtf8('Add translation...'), self.project.addLanguage)
         self.dirMenu.addAction(self.trUtf8('Add translation files...'),
             self.__addTranslationFiles)
         self.dirMenu.addSeparator()
@@ -465,6 +466,7 @@
             if self.lreleaseProcRunning:
                 for act in self.qmprocMenuActions:
                     act.setEnabled(True)
+        self.__addTranslationAct.setEnabled(self.project.getTranslationPattern() != "")
         
         ProjectBaseBrowser._showContextMenu(self, self.menu)
         
@@ -521,6 +523,7 @@
             if self.lreleaseProcRunning:
                 for act in self.qmprocDirMenuActions:
                     act.setEnabled(True)
+        self.__addTranslationDirAct.setEnabled(self.project.getTranslationPattern() != "")
         
         ProjectBaseBrowser._showContextMenuDir(self, self.dirMenu)
         
@@ -538,6 +541,8 @@
             if self.lreleaseProcRunning:
                 for act in self.qmprocBackMenuActions:
                     act.setEnabled(True)
+        self.__addTranslationBackAct.setEnabled(
+            self.project.getTranslationPattern() != "")
         
         self.showMenu.emit("MainBack", self.backMenu)
         

eric ide

mercurial