Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.

Wed, 20 Nov 2013 18:48:39 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 20 Nov 2013 18:48:39 +0100
changeset 3098
02ee75d31584
parent 3096
23856c207f81
child 3100
1c86bf655433

Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.

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.Preferences.ConfigurationPages.EditorAPIsPage.html file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/EditorAPIsPage.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Tue Nov 19 20:00:21 2013 +0100
+++ b/APIs/Python3/eric5.api	Wed Nov 20 18:48:39 2013 +0100
@@ -5758,7 +5758,9 @@
 eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.on_addInstalledApiFileButton_clicked?4()
 eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.on_addPluginApiFileButton_clicked?4()
 eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.on_apiFileButton_clicked?4()
+eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.on_apiFileEdit_textChanged?4(txt)
 eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.on_apiLanguageComboBox_activated?4(language)
+eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.on_apiList_itemSelectionChanged?4()
 eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.on_deleteApiFileButton_clicked?4()
 eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.on_prepareApiButton_clicked?4()
 eric5.Preferences.ConfigurationPages.EditorAPIsPage.EditorAPIsPage.save?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Tue Nov 19 20:00:21 2013 +0100
+++ b/Documentation/Help/source.qhp	Wed Nov 20 18:48:39 2013 +0100
@@ -4550,7 +4550,9 @@
       <keyword name="EditorAPIsPage.on_addInstalledApiFileButton_clicked" id="EditorAPIsPage.on_addInstalledApiFileButton_clicked" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.on_addInstalledApiFileButton_clicked" />
       <keyword name="EditorAPIsPage.on_addPluginApiFileButton_clicked" id="EditorAPIsPage.on_addPluginApiFileButton_clicked" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.on_addPluginApiFileButton_clicked" />
       <keyword name="EditorAPIsPage.on_apiFileButton_clicked" id="EditorAPIsPage.on_apiFileButton_clicked" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.on_apiFileButton_clicked" />
+      <keyword name="EditorAPIsPage.on_apiFileEdit_textChanged" id="EditorAPIsPage.on_apiFileEdit_textChanged" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.on_apiFileEdit_textChanged" />
       <keyword name="EditorAPIsPage.on_apiLanguageComboBox_activated" id="EditorAPIsPage.on_apiLanguageComboBox_activated" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.on_apiLanguageComboBox_activated" />
+      <keyword name="EditorAPIsPage.on_apiList_itemSelectionChanged" id="EditorAPIsPage.on_apiList_itemSelectionChanged" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.on_apiList_itemSelectionChanged" />
       <keyword name="EditorAPIsPage.on_deleteApiFileButton_clicked" id="EditorAPIsPage.on_deleteApiFileButton_clicked" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.on_deleteApiFileButton_clicked" />
       <keyword name="EditorAPIsPage.on_prepareApiButton_clicked" id="EditorAPIsPage.on_prepareApiButton_clicked" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.on_prepareApiButton_clicked" />
       <keyword name="EditorAPIsPage.save" id="EditorAPIsPage.save" ref="eric5.Preferences.ConfigurationPages.EditorAPIsPage.html#EditorAPIsPage.save" />
--- a/Documentation/Source/eric5.Preferences.ConfigurationPages.EditorAPIsPage.html	Tue Nov 19 20:00:21 2013 +0100
+++ b/Documentation/Source/eric5.Preferences.ConfigurationPages.EditorAPIsPage.html	Wed Nov 20 18:48:39 2013 +0100
@@ -87,9 +87,15 @@
 <td><a href="#EditorAPIsPage.on_apiFileButton_clicked">on_apiFileButton_clicked</a></td>
 <td>Private method to select an api file.</td>
 </tr><tr>
+<td><a href="#EditorAPIsPage.on_apiFileEdit_textChanged">on_apiFileEdit_textChanged</a></td>
+<td>Private slot to handle the entering of an API file name.</td>
+</tr><tr>
 <td><a href="#EditorAPIsPage.on_apiLanguageComboBox_activated">on_apiLanguageComboBox_activated</a></td>
 <td>Private slot to fill the api listbox of the api page.</td>
 </tr><tr>
+<td><a href="#EditorAPIsPage.on_apiList_itemSelectionChanged">on_apiList_itemSelectionChanged</a></td>
+<td>Private slot to react on changes of API selections.</td>
+</tr><tr>
 <td><a href="#EditorAPIsPage.on_deleteApiFileButton_clicked">on_deleteApiFileButton_clicked</a></td>
 <td>Private slot to delete the currently selected file of the listbox.</td>
 </tr><tr>
@@ -162,7 +168,17 @@
 <b>on_apiFileButton_clicked</b>(<i></i>)
 <p>
         Private method to select an api file.
-</p><a NAME="EditorAPIsPage.on_apiLanguageComboBox_activated" ID="EditorAPIsPage.on_apiLanguageComboBox_activated"></a>
+</p><a NAME="EditorAPIsPage.on_apiFileEdit_textChanged" ID="EditorAPIsPage.on_apiFileEdit_textChanged"></a>
+<h4>EditorAPIsPage.on_apiFileEdit_textChanged</h4>
+<b>on_apiFileEdit_textChanged</b>(<i>txt</i>)
+<p>
+        Private slot to handle the entering of an API file name.
+</p><dl>
+<dt><i>txt</i></dt>
+<dd>
+text of the line edit (string)
+</dd>
+</dl><a NAME="EditorAPIsPage.on_apiLanguageComboBox_activated" ID="EditorAPIsPage.on_apiLanguageComboBox_activated"></a>
 <h4>EditorAPIsPage.on_apiLanguageComboBox_activated</h4>
 <b>on_apiLanguageComboBox_activated</b>(<i>language</i>)
 <p>
@@ -172,7 +188,12 @@
 <dd>
 selected API language (string)
 </dd>
-</dl><a NAME="EditorAPIsPage.on_deleteApiFileButton_clicked" ID="EditorAPIsPage.on_deleteApiFileButton_clicked"></a>
+</dl><a NAME="EditorAPIsPage.on_apiList_itemSelectionChanged" ID="EditorAPIsPage.on_apiList_itemSelectionChanged"></a>
+<h4>EditorAPIsPage.on_apiList_itemSelectionChanged</h4>
+<b>on_apiList_itemSelectionChanged</b>(<i></i>)
+<p>
+        Private slot to react on changes of API selections.
+</p><a NAME="EditorAPIsPage.on_deleteApiFileButton_clicked" ID="EditorAPIsPage.on_deleteApiFileButton_clicked"></a>
 <h4>EditorAPIsPage.on_deleteApiFileButton_clicked</h4>
 <b>on_deleteApiFileButton_clicked</b>(<i></i>)
 <p>
--- a/Preferences/ConfigurationPages/EditorAPIsPage.py	Tue Nov 19 20:00:21 2013 +0100
+++ b/Preferences/ConfigurationPages/EditorAPIsPage.py	Wed Nov 20 18:48:39 2013 +0100
@@ -90,9 +90,14 @@
             return
             
         self.apiGroup.setEnabled(True)
+        self.deleteApiFileButton.setEnabled(False)
+        self.addApiFileButton.setEnabled(False)
+        self.apiFileEdit.clear()
+        
         for api in self.apis[self.currentApiLanguage]:
             if api:
                 self.apiList.addItem(api)
+        self.prepareApiButton.setEnabled(self.apiList.count() > 0)
         
         from QScintilla.APIsManager import APIsManager
         self.__currentAPI = APIsManager().getAPIs(self.currentApiLanguage)
@@ -104,7 +109,7 @@
             self.__currentAPI.apiPreparationStarted.connect(
                 self.__apiPreparationStarted)
             self.addInstalledApiFileButton.setEnabled(
-                self.__currentAPI.installedAPIFiles() != "")
+                len(self.__currentAPI.installedAPIFiles()) > 0)
         else:
             self.addInstalledApiFileButton.setEnabled(False)
         
@@ -146,6 +151,7 @@
         if file:
             self.apiList.addItem(Utilities.toNativeSeparators(file))
             self.apiFileEdit.clear()
+        self.prepareApiButton.setEnabled(self.apiList.count() > 0)
         
     @pyqtSlot()
     def on_deleteApiFileButton_clicked(self):
@@ -156,6 +162,7 @@
         if crow >= 0:
             itm = self.apiList.takeItem(crow)
             del itm
+        self.prepareApiButton.setEnabled(self.apiList.count() > 0)
         
     @pyqtSlot()
     def on_addInstalledApiFileButton_clicked(self):
@@ -187,6 +194,7 @@
                 self.trUtf8("""There are no APIs installed yet."""
                             """ Selection is not available."""))
             self.addInstalledApiFileButton.setEnabled(False)
+        self.prepareApiButton.setEnabled(self.apiList.count() > 0)
         
     @pyqtSlot()
     def on_addPluginApiFileButton_clicked(self):
@@ -209,6 +217,7 @@
         if ok:
             self.apiList.addItem(Utilities.toNativeSeparators(
                 pluginAPIFilesDict[file]))
+        self.prepareApiButton.setEnabled(self.apiList.count() > 0)
         
     @pyqtSlot()
     def on_prepareApiButton_clicked(self):
@@ -267,6 +276,32 @@
         self.on_apiLanguageComboBox_activated(
             self.apiLanguageComboBox.currentText())
     
+    @pyqtSlot()
+    def on_apiList_itemSelectionChanged(self):
+        """
+        Private slot to react on changes of API selections.
+        """
+        self.deleteApiFileButton.setEnabled(
+            len(self.apiList.selectedItems()) > 0)
+    
+    @pyqtSlot(str)
+    def on_apiFileEdit_textChanged(self, txt):
+        """
+        Private slot to handle the entering of an API file name.
+        
+        @param txt text of the line edit (string)
+        """
+        enable = txt != ""
+        
+        if enable:
+            # check for already added file
+            for row in range(self.apiList.count()):
+                if txt == self.apiList.item(row).text():
+                    enable = False
+                    break
+        
+        self.addApiFileButton.setEnabled(enable)
+    
 
 def create(dlg):
     """

eric ide

mercurial