Added code to (hopefully) fix the "Underlying C++ object deleted" issue in the web browser.

Sat, 13 Mar 2010 17:12:22 +0000

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 13 Mar 2010 17:12:22 +0000
changeset 142
94ce651735db
parent 141
c76f1ec28766
child 143
06952f173018

Added code to (hopefully) fix the "Underlying C++ object deleted" issue in the web browser.

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.Helpviewer.HelpBrowserWV.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Helpviewer.HelpWebSearchWidget.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Helpviewer.HelpWindow.html file | annotate | diff | comparison | revisions
Helpviewer/HelpBrowserWV.py file | annotate | diff | comparison | revisions
Helpviewer/HelpWebSearchWidget.py file | annotate | diff | comparison | revisions
Helpviewer/HelpWindow.py file | annotate | diff | comparison | revisions
Helpviewer/OpenSearch/OpenSearchDialog.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Sat Mar 13 15:48:41 2010 +0000
+++ b/APIs/Python3/eric5.api	Sat Mar 13 17:12:22 2010 +0000
@@ -1837,7 +1837,9 @@
 eric5.Helpviewer.HelpBrowserWV.JavaScriptEricObject.searchUrl?4(searchStr)
 eric5.Helpviewer.HelpBrowserWV.JavaScriptEricObject.translate?4(trans)
 eric5.Helpviewer.HelpBrowserWV.JavaScriptEricObject.translations?7
+eric5.Helpviewer.HelpBrowserWV.JavaScriptEricObject?1(mw, parent = None)
 eric5.Helpviewer.HelpBrowserWV.JavaScriptExternalObject.AddSearchProvider?4(url)
+eric5.Helpviewer.HelpBrowserWV.JavaScriptExternalObject?1(mw, parent = None)
 eric5.Helpviewer.HelpBrowserWV.LinkedResource?1()
 eric5.Helpviewer.HelpClearPrivateDataDialog.HelpClearPrivateDataDialog.getData?4()
 eric5.Helpviewer.HelpClearPrivateDataDialog.HelpClearPrivateDataDialog?1(parent = None)
@@ -1870,7 +1872,6 @@
 eric5.Helpviewer.HelpTocWidget.HelpTocWidget?1(engine, mainWindow, parent = None)
 eric5.Helpviewer.HelpTopicDialog.HelpTopicDialog.link?4()
 eric5.Helpviewer.HelpTopicDialog.HelpTopicDialog?1(parent, keyword, links)
-eric5.Helpviewer.HelpWebSearchWidget.HelpWebSearchWidget._openSearchManager?8
 eric5.Helpviewer.HelpWebSearchWidget.HelpWebSearchWidget.clear?4()
 eric5.Helpviewer.HelpWebSearchWidget.HelpWebSearchWidget.openSearchManager?4()
 eric5.Helpviewer.HelpWebSearchWidget.HelpWebSearchWidget.preferencesChanged?4()
@@ -1901,6 +1902,7 @@
 eric5.Helpviewer.HelpWindow.HelpWindow.newBrowser?4(link)
 eric5.Helpviewer.HelpWindow.HelpWindow.newTab?4(link = None)
 eric5.Helpviewer.HelpWindow.HelpWindow.newWindow?4(link = None)
+eric5.Helpviewer.HelpWindow.HelpWindow.openSearchManager?4()
 eric5.Helpviewer.HelpWindow.HelpWindow.passwordManager?4()
 eric5.Helpviewer.HelpWindow.HelpWindow.preferencesChanged?4()
 eric5.Helpviewer.HelpWindow.HelpWindow.progressBar?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sat Mar 13 15:48:41 2010 +0000
+++ b/Documentation/Help/source.qhp	Sat Mar 13 17:12:22 2010 +0000
@@ -2692,9 +2692,11 @@
       <keyword name="HelpWebPage.acceptNavigationRequest" id="HelpWebPage.acceptNavigationRequest" ref="eric5.Helpviewer.HelpBrowserWV.html#HelpWebPage.acceptNavigationRequest" />
       <keyword name="HelpWebPage.pageAttributeId" id="HelpWebPage.pageAttributeId" ref="eric5.Helpviewer.HelpBrowserWV.html#HelpWebPage.pageAttributeId" />
       <keyword name="HelpWebPage.populateNetworkRequest" id="HelpWebPage.populateNetworkRequest" ref="eric5.Helpviewer.HelpBrowserWV.html#HelpWebPage.populateNetworkRequest" />
+      <keyword name="JavaScriptEricObject (Constructor)" id="JavaScriptEricObject (Constructor)" ref="eric5.Helpviewer.HelpBrowserWV.html#JavaScriptEricObject.__init__" />
       <keyword name="JavaScriptEricObject.providerString" id="JavaScriptEricObject.providerString" ref="eric5.Helpviewer.HelpBrowserWV.html#JavaScriptEricObject.providerString" />
       <keyword name="JavaScriptEricObject.searchUrl" id="JavaScriptEricObject.searchUrl" ref="eric5.Helpviewer.HelpBrowserWV.html#JavaScriptEricObject.searchUrl" />
       <keyword name="JavaScriptEricObject.translate" id="JavaScriptEricObject.translate" ref="eric5.Helpviewer.HelpBrowserWV.html#JavaScriptEricObject.translate" />
+      <keyword name="JavaScriptExternalObject (Constructor)" id="JavaScriptExternalObject (Constructor)" ref="eric5.Helpviewer.HelpBrowserWV.html#JavaScriptExternalObject.__init__" />
       <keyword name="JavaScriptExternalObject.AddSearchProvider" id="JavaScriptExternalObject.AddSearchProvider" ref="eric5.Helpviewer.HelpBrowserWV.html#JavaScriptExternalObject.AddSearchProvider" />
       <keyword name="LinkedResource (Constructor)" id="LinkedResource (Constructor)" ref="eric5.Helpviewer.HelpBrowserWV.html#LinkedResource.__init__" />
       <keyword name="HelpWebSearchWidget (Module)" id="HelpWebSearchWidget (Module)" ref="eric5.Helpviewer.HelpWebSearchWidget.html" />
@@ -2848,6 +2850,7 @@
       <keyword name="HelpWindow.newBrowser" id="HelpWindow.newBrowser" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.newBrowser" />
       <keyword name="HelpWindow.newTab" id="HelpWindow.newTab" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.newTab" />
       <keyword name="HelpWindow.newWindow" id="HelpWindow.newWindow" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.newWindow" />
+      <keyword name="HelpWindow.openSearchManager" id="HelpWindow.openSearchManager" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.openSearchManager" />
       <keyword name="HelpWindow.passwordManager" id="HelpWindow.passwordManager" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.passwordManager" />
       <keyword name="HelpWindow.preferencesChanged" id="HelpWindow.preferencesChanged" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.preferencesChanged" />
       <keyword name="HelpWindow.progressBar" id="HelpWindow.progressBar" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.progressBar" />
--- a/Documentation/Source/eric5.Helpviewer.HelpBrowserWV.html	Sat Mar 13 15:48:41 2010 +0000
+++ b/Documentation/Source/eric5.Helpviewer.HelpBrowserWV.html	Sat Mar 13 17:12:22 2010 +0000
@@ -761,6 +761,9 @@
 <h3>Methods</h3>
 <table>
 <tr>
+<td><a href="#JavaScriptEricObject.__init__">JavaScriptEricObject</a></td>
+<td>Constructor</td>
+</tr><tr>
 <td><a href="#JavaScriptEricObject.providerString">providerString</a></td>
 <td>Public method to get a string for the search provider.</td>
 </tr><tr>
@@ -771,7 +774,20 @@
 <td>Public method to translate the given string.</td>
 </tr>
 </table>
-<a NAME="JavaScriptEricObject.providerString" ID="JavaScriptEricObject.providerString"></a>
+<a NAME="JavaScriptEricObject.__init__" ID="JavaScriptEricObject.__init__"></a>
+<h4>JavaScriptEricObject (Constructor)</h4>
+<b>JavaScriptEricObject</b>(<i>mw, parent = None</i>)
+<p>
+        Constructor
+</p><dl>
+<dt><i>mw</i></dt>
+<dd>
+reference to the main window 8HelpWindow)
+</dd><dt><i>parent</i></dt>
+<dd>
+reference to the parent object (QObject)
+</dd>
+</dl><a NAME="JavaScriptEricObject.providerString" ID="JavaScriptEricObject.providerString"></a>
 <h4>JavaScriptEricObject.providerString</h4>
 <b>providerString</b>(<i></i>)
 <p>
@@ -828,11 +844,27 @@
 <h3>Methods</h3>
 <table>
 <tr>
+<td><a href="#JavaScriptExternalObject.__init__">JavaScriptExternalObject</a></td>
+<td>Constructor</td>
+</tr><tr>
 <td><a href="#JavaScriptExternalObject.AddSearchProvider">AddSearchProvider</a></td>
 <td>Public slot to add a search provider.</td>
 </tr>
 </table>
-<a NAME="JavaScriptExternalObject.AddSearchProvider" ID="JavaScriptExternalObject.AddSearchProvider"></a>
+<a NAME="JavaScriptExternalObject.__init__" ID="JavaScriptExternalObject.__init__"></a>
+<h4>JavaScriptExternalObject (Constructor)</h4>
+<b>JavaScriptExternalObject</b>(<i>mw, parent = None</i>)
+<p>
+        Constructor
+</p><dl>
+<dt><i>mw</i></dt>
+<dd>
+reference to the main window 8HelpWindow)
+</dd><dt><i>parent</i></dt>
+<dd>
+reference to the parent object (QObject)
+</dd>
+</dl><a NAME="JavaScriptExternalObject.AddSearchProvider" ID="JavaScriptExternalObject.AddSearchProvider"></a>
 <h4>JavaScriptExternalObject.AddSearchProvider</h4>
 <b>AddSearchProvider</b>(<i>url</i>)
 <p>
--- a/Documentation/Source/eric5.Helpviewer.HelpWebSearchWidget.html	Sat Mar 13 15:48:41 2010 +0000
+++ b/Documentation/Source/eric5.Helpviewer.HelpWebSearchWidget.html	Sat Mar 13 17:12:22 2010 +0000
@@ -55,7 +55,7 @@
 QWidget
 <h3>Class Attributes</h3>
 <table>
-<tr><td>_openSearchManager</td></tr>
+<tr><td>None</td></tr>
 </table>
 <h3>Methods</h3>
 <table>
@@ -109,7 +109,7 @@
 <td>Public method to clear all private data.</td>
 </tr><tr>
 <td><a href="#HelpWebSearchWidget.openSearchManager">openSearchManager</a></td>
-<td>Class method to get a reference to the opensearch manager object.</td>
+<td>Public method to get a reference to the opensearch manager object.</td>
 </tr><tr>
 <td><a href="#HelpWebSearchWidget.preferencesChanged">preferencesChanged</a></td>
 <td>Public method to handle the change of preferences.</td>
@@ -230,7 +230,7 @@
 <h4>HelpWebSearchWidget.openSearchManager</h4>
 <b>openSearchManager</b>(<i></i>)
 <p>
-        Class method to get a reference to the opensearch manager object.
+        Public method to get a reference to the opensearch manager object.
 </p><dl>
 <dt>Returns:</dt>
 <dd>
--- a/Documentation/Source/eric5.Helpviewer.HelpWindow.html	Sat Mar 13 15:48:41 2010 +0000
+++ b/Documentation/Source/eric5.Helpviewer.HelpWindow.html	Sat Mar 13 17:12:22 2010 +0000
@@ -424,6 +424,9 @@
 <td><a href="#HelpWindow.newWindow">newWindow</a></td>
 <td>Public slot called to open a new help browser dialog.</td>
 </tr><tr>
+<td><a href="#HelpWindow.openSearchManager">openSearchManager</a></td>
+<td>Public method to get a reference to the opensearch manager object.</td>
+</tr><tr>
 <td><a href="#HelpWindow.passwordManager">passwordManager</a></td>
 <td>Class method to get a reference to the password manager.</td>
 </tr><tr>
@@ -1347,6 +1350,16 @@
 <dd>
 file to be displayed in the new window (string or QUrl)
 </dd>
+</dl><a NAME="HelpWindow.openSearchManager" ID="HelpWindow.openSearchManager"></a>
+<h4>HelpWindow.openSearchManager</h4>
+<b>openSearchManager</b>(<i></i>)
+<p>
+        Public method to get a reference to the opensearch manager object.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+reference to the opensearch manager object (OpenSearchManager)
+</dd>
 </dl><a NAME="HelpWindow.passwordManager" ID="HelpWindow.passwordManager"></a>
 <h4>HelpWindow.passwordManager</h4>
 <b>passwordManager</b>(<i></i>)
--- a/Helpviewer/HelpBrowserWV.py	Sat Mar 13 15:48:41 2010 +0000
+++ b/Helpviewer/HelpBrowserWV.py	Sat Mar 13 17:12:22 2010 +0000
@@ -16,7 +16,6 @@
 import Preferences
 
 from .DownloadDialog import DownloadDialog
-from .HelpWebSearchWidget import HelpWebSearchWidget
 from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog
 from .JavaScriptResources import fetchLinks_js
 from .HTMLResources import notFoundPage_html
@@ -32,6 +31,17 @@
     """
     Class implementing an external javascript object to add search providers.
     """
+    def __init__(self, mw, parent = None):
+        """
+        Constructor
+        
+        @param mw reference to the main window 8HelpWindow)
+        @param parent reference to the parent object (QObject)
+        """
+        QObject.__init__(self, parent)
+        
+        self.__mw = mw
+    
     @pyqtSlot(str)
     def AddSearchProvider(self, url):
         """
@@ -39,7 +49,7 @@
         
         @param url url of the XML file defining the search provider (string)
         """
-        HelpWebSearchWidget.openSearchManager().addEngine(QUrl(url));
+        self.__mw.openSearchManager().addEngine(QUrl(url));
 
 class LinkedResource(object):
     """
@@ -68,6 +78,17 @@
         QT_TRANSLATE_NOOP("JavaScriptEricObject", "About Eric"), 
     ]
     
+    def __init__(self, mw, parent = None):
+        """
+        Constructor
+        
+        @param mw reference to the main window 8HelpWindow)
+        @param parent reference to the parent object (QObject)
+        """
+        QObject.__init__(self, parent)
+        
+        self.__mw = mw
+    
     @pyqtSlot(str, result = str)
     def translate(self, trans):
         """
@@ -93,7 +114,7 @@
         @return string for the search provider (string)
         """
         return self.trUtf8("Search results provided by {0}")\
-            .format(HelpWebSearchWidget.openSearchManager().currentEngineName())
+            .format(self.__mw.openSearchManager().currentEngineName())
     
     @pyqtSlot(str, result = str)
     def searchUrl(self, searchStr):
@@ -104,7 +125,7 @@
         @return search URL (string)
         """
         return bytes(
-            HelpWebSearchWidget.openSearchManager().currentEngine()\
+            self.__mw.openSearchManager().currentEngine()\
             .searchUrl(searchStr).toEncoded()).decode()
 
 ##########################################################################################
@@ -235,7 +256,7 @@
             self.__addExternalBinding)
         self.__addExternalBinding(self.page().mainFrame())
         
-        self.connect(HelpWebSearchWidget.openSearchManager(), 
+        self.connect(self.mw.openSearchManager(), 
                      SIGNAL("currentEngineChanged()"), 
                      self.__currentEngineChanged)
     
@@ -247,14 +268,14 @@
         """
         self.page().settings().setAttribute(QWebSettings.JavascriptEnabled, True)
         if self.__javaScriptBinding is None:
-            self.__javaScriptBinding = JavaScriptExternalObject(self)
+            self.__javaScriptBinding = JavaScriptExternalObject(self.mw, self)
         
         if frame is None:
             # called from QWebFrame.javaScriptWindowObjectCleared
             frame = self.sender()
             if frame.url().scheme() == "pyrc" and frame.url().path() == "home":
                 if self.__javaScriptEricObject is None:
-                    self.__javaScriptEricObject = JavaScriptEricObject(self)
+                    self.__javaScriptEricObject = JavaScriptEricObject(self.mw, self)
                 frame.addToJavaScriptWindowObject("eric", self.__javaScriptEricObject)
         else:
             # called from QWebPage.frameCreated
@@ -593,9 +614,9 @@
         if self.selectedText():
             self.__searchMenu = menu.addMenu(self.trUtf8("Search with..."))
             
-            engineNames = HelpWebSearchWidget.openSearchManager().allEnginesNames()
+            engineNames = self.mw.openSearchManager().allEnginesNames()
             for engineName in engineNames:
-                engine = HelpWebSearchWidget.openSearchManager().engine(engineName)
+                engine = self.mw.openSearchManager().engine(engineName)
                 act = OpenSearchEngineAction(engine, self.__searchMenu)
                 self.__searchMenu.addAction(act)
                 act.setData(engineName)
@@ -688,7 +709,7 @@
         
         engineName = act.data()
         if engineName:
-            engine = HelpWebSearchWidget.openSearchManager().engine(engineName)
+            engine = self.mw.openSearchManager().engine(engineName)
             self.emit(SIGNAL("search(const QUrl &)"), engine.searchUrl(searchText))
     
     def __webInspector(self):
--- a/Helpviewer/HelpWebSearchWidget.py	Sat Mar 13 15:48:41 2010 +0000
+++ b/Helpviewer/HelpWebSearchWidget.py	Sat Mar 13 17:12:22 2010 +0000
@@ -26,8 +26,6 @@
     
     @signal search(url) emitted when the search should be done
     """
-    _openSearchManager = None
-    
     def __init__(self, parent = None):
         """
         Constructor
@@ -39,7 +37,8 @@
         
         self.mw = parent
         
-        self.connect(HelpWebSearchWidget.openSearchManager(), 
+        self.__openSearchManager = OpenSearchManager(self)
+        self.connect(self.__openSearchManager, 
                      SIGNAL("currentEngineChanged()"), 
                      self.__currentEngineChanged)
         self.__currentEngine = ""
@@ -115,9 +114,7 @@
                 self.__recentSearches = self.__recentSearches[:self.__maxSavedSearches]
             self.__setupCompleterMenu()
         
-        url = HelpWebSearchWidget.openSearchManager()\
-                                 .currentEngine()\
-                                 .searchUrl(searchText)
+        url = self.__openSearchManager.currentEngine().searchUrl(searchText)
         self.emit(SIGNAL("search"), url)
     
     def __setupCompleterMenu(self):
@@ -220,9 +217,7 @@
         """
         searchText = self.__searchEdit.text()
         if searchText:
-            HelpWebSearchWidget.openSearchManager()\
-                               .currentEngine()\
-                               .requestSuggestions(searchText)
+            self.__openSearchManager.currentEngine().requestSuggestions(searchText)
     
     def __newSuggestions(self, suggestions):
         """
@@ -240,16 +235,15 @@
         """
         self.__enginesMenu.clear()
         
-        osm = HelpWebSearchWidget.openSearchManager()
-        engineNames = osm.allEnginesNames()
+        engineNames = self.__openSearchManager.allEnginesNames()
         for engineName in engineNames:
-            engine = osm.engine(engineName)
+            engine = self.__openSearchManager.engine(engineName)
             action = OpenSearchEngineAction(engine, self.__enginesMenu)
             action.setData(engineName)
             self.connect(action, SIGNAL("triggered()"), self.__changeCurrentEngine)
             self.__enginesMenu.addAction(action)
             
-            if osm.currentEngineName() == engineName:
+            if self.__openSearchManager.currentEngineName() == engineName:
                 action.setCheckable(True)
                 action.setChecked(True)
         
@@ -297,7 +291,7 @@
         action = self.sender()
         if action is not None:
             name = action.data()
-            HelpWebSearchWidget.openSearchManager().setCurrentEngineName(name)
+            self.__openSearchManager.setCurrentEngineName(name)
     
     def __addEngineFromUrl(self):
         """
@@ -309,7 +303,7 @@
             if not isinstance(url, QUrl):
                 return 
             
-            HelpWebSearchWidget.openSearchManager().addEngine(url)
+            self.__openSearchManager.addEngine(url)
     
     def __searchButtonClicked(self):
         """
@@ -351,31 +345,27 @@
         if searches is not None:
             self.__recentSearches = searches
     
-    @classmethod
-    def openSearchManager(cls):
+    def openSearchManager(self):
         """
-        Class method to get a reference to the opensearch manager object.
+        Public method to get a reference to the opensearch manager object.
         
         @return reference to the opensearch manager object (OpenSearchManager)
         """
-        if cls._openSearchManager is None:
-            cls._openSearchManager = OpenSearchManager()
-        return cls._openSearchManager
+        return self.__openSearchManager
     
     def __currentEngineChanged(self):
         """
         Private slot to track a change of the current search engine.
         """
-        osm = HelpWebSearchWidget.openSearchManager()
-        if osm.engineExists(self.__currentEngine):
-            oldEngine = osm.engine(self.__currentEngine)
+        if self.__openSearchManager.engineExists(self.__currentEngine):
+            oldEngine = self.__openSearchManager.engine(self.__currentEngine)
             self.disconnect(oldEngine, SIGNAL("imageChanged()"), 
                             self.__engineImageChanged)
             if self.__suggestionsEnabled:
                 self.disconnect(oldEngine, SIGNAL("suggestions(const QStringList&)"), 
                                 self.__newSuggestions)
         
-        newEngine = osm.currentEngine()
+        newEngine = self.__openSearchManager.currentEngine()
         if newEngine.networkAccessManager() is None:
             newEngine.setNetworkAccessManager(self.mw.networkAccessManager())
         self.connect(newEngine, SIGNAL("imageChanged()"), 
@@ -384,10 +374,10 @@
             self.connect(newEngine, SIGNAL("suggestions(const QStringList&)"), 
                          self.__newSuggestions)
         
-        self.__searchEdit.setInactiveText(osm.currentEngineName())
-        self.__currentEngine = osm.currentEngineName()
+        self.__searchEdit.setInactiveText(self.__openSearchManager.currentEngineName())
+        self.__currentEngine = self.__openSearchManager.currentEngineName()
         self.__engineButton.setIcon(
-            QIcon(QPixmap.fromImage(osm.currentEngine().image())))
+            QIcon(QPixmap.fromImage(self.__openSearchManager.currentEngine().image())))
         self.__suggestions = []
         self.__setupCompleterMenu()
     
@@ -395,6 +385,5 @@
         """
         Private slot to handle a change of the current search engine icon.
         """
-        osm = HelpWebSearchWidget.openSearchManager()
         self.__engineButton.setIcon(
-            QIcon(QPixmap.fromImage(osm.currentEngine().image())))
+            QIcon(QPixmap.fromImage(self.__openSearchManager.currentEngine().image())))
--- a/Helpviewer/HelpWindow.py	Sat Mar 13 15:48:41 2010 +0000
+++ b/Helpviewer/HelpWindow.py	Sat Mar 13 17:12:22 2010 +0000
@@ -2820,3 +2820,11 @@
             cls._adblockManager = AdBlockManager()
         
         return cls._adblockManager
+    
+    def openSearchManager(self):
+        """
+        Public method to get a reference to the opensearch manager object.
+        
+        @return reference to the opensearch manager object (OpenSearchManager)
+        """
+        return self.searchEdit.openSearchManager()
--- a/Helpviewer/OpenSearch/OpenSearchDialog.py	Sat Mar 13 15:48:41 2010 +0000
+++ b/Helpviewer/OpenSearch/OpenSearchDialog.py	Sat Mar 13 17:12:22 2010 +0000
@@ -10,8 +10,6 @@
 from PyQt4.QtGui import QDialog, QFileDialog, QMessageBox
 from PyQt4.QtCore import pyqtSlot, SIGNAL
 
-from Helpviewer.HelpWebSearchWidget import HelpWebSearchWidget
-
 from .OpenSearchEngineModel import OpenSearchEngineModel
 from .OpenSearchEditDialog import OpenSearchEditDialog
 
@@ -30,8 +28,10 @@
         
         self.setModal(True)
         
+        self.__mw = parent
+        
         self.__model = \
-            OpenSearchEngineModel(HelpWebSearchWidget.openSearchManager(), self)
+            OpenSearchEngineModel(self.__mw.openSearchManager(), self)
         self.enginesTable.setModel(self.__model)
         self.enginesTable.horizontalHeader().resizeSection(0, 200)
         self.enginesTable.horizontalHeader().setStretchLastSection(True)
@@ -55,7 +55,7 @@
             "",
             self.trUtf8("OpenSearch (*.xml);;All Files (*)"))
         
-        osm = HelpWebSearchWidget.openSearchManager()
+        osm = self.__mw.openSearchManager()
         for fileName in fileNames:
             if not osm.addEngine(fileName):
                 QMessageBox.critical(self,
@@ -80,7 +80,7 @@
         """
         Private slot to restore the default search engines.
         """
-        HelpWebSearchWidget.openSearchManager().restoreDefaults()
+        self.__mw.openSearchManager().restoreDefaults()
     
     @pyqtSlot()
     def on_editButton_clicked(self):
@@ -93,7 +93,7 @@
         else:
             row = rows[0].row()
         
-        osm = HelpWebSearchWidget.openSearchManager()
+        osm = self.__mw.openSearchManager()
         engineName = osm.allEnginesNames()[row]
         engine = osm.engine(engineName)
         dlg = OpenSearchEditDialog(engine, self)

eric ide

mercurial