Sun, 14 Feb 2010 11:28:47 +0000
Implemented a workaround for a Qt/PyQt issue causing the eric web browser to crash, when some entry of the index widget is activated.
--- a/Documentation/Help/source.qhp Sat Feb 13 17:07:34 2010 +0000 +++ b/Documentation/Help/source.qhp Sun Feb 14 11:28:47 2010 +0000 @@ -2917,6 +2917,7 @@ <keyword name="HelpIndexWidget (Module)" id="HelpIndexWidget (Module)" ref="eric5.Helpviewer.HelpIndexWidget.html" /> <keyword name="HelpIndexWidget" id="HelpIndexWidget" ref="eric5.Helpviewer.HelpIndexWidget.html#HelpIndexWidget" /> <keyword name="HelpIndexWidget (Constructor)" id="HelpIndexWidget (Constructor)" ref="eric5.Helpviewer.HelpIndexWidget.html#HelpIndexWidget.__init__" /> + <keyword name="HelpIndexWidget.__activated" id="HelpIndexWidget.__activated" ref="eric5.Helpviewer.HelpIndexWidget.html#HelpIndexWidget.__activated" /> <keyword name="HelpIndexWidget.__disableSearchEdit" id="HelpIndexWidget.__disableSearchEdit" ref="eric5.Helpviewer.HelpIndexWidget.html#HelpIndexWidget.__disableSearchEdit" /> <keyword name="HelpIndexWidget.__enableSearchEdit" id="HelpIndexWidget.__enableSearchEdit" ref="eric5.Helpviewer.HelpIndexWidget.html#HelpIndexWidget.__enableSearchEdit" /> <keyword name="HelpIndexWidget.__filterIndices" id="HelpIndexWidget.__filterIndices" ref="eric5.Helpviewer.HelpIndexWidget.html#HelpIndexWidget.__filterIndices" />
--- a/Documentation/Source/eric5.Helpviewer.HelpIndexWidget.html Sat Feb 13 17:07:34 2010 +0000 +++ b/Documentation/Source/eric5.Helpviewer.HelpIndexWidget.html Sun Feb 14 11:28:47 2010 +0000 @@ -51,7 +51,11 @@ emitted when the ESC key was pressed </dd><dt>linkActivated(const QUrl&)</dt> <dd> -emitted when an index entry is activated +emitted when an index entry is activated +</dd><dt>linksActivated(links, keyword)</dt> +<dd> +emitted when an index entry referencing + multiple targets is activated </dd> </dl> <h3>Derived from</h3> @@ -66,6 +70,9 @@ <td><a href="#HelpIndexWidget.__init__">HelpIndexWidget</a></td> <td>Constructor</td> </tr><tr> +<td><a href="#HelpIndexWidget.__activated">__activated</a></td> +<td>Private slot to handle the activation of a keyword entry.</td> +</tr><tr> <td><a href="#HelpIndexWidget.__disableSearchEdit">__disableSearchEdit</a></td> <td>Private slot to enable the search edit.</td> </tr><tr> @@ -98,6 +105,16 @@ <dd> reference to the parent widget (QWidget) </dd> +</dl><a NAME="HelpIndexWidget.__activated" ID="HelpIndexWidget.__activated"></a> +<h4>HelpIndexWidget.__activated</h4> +<b>__activated</b>(<i>idx</i>) +<p> + Private slot to handle the activation of a keyword entry. +</p><dl> +<dt><i>idx</i></dt> +<dd> +index of the activated entry (QModelIndex) +</dd> </dl><a NAME="HelpIndexWidget.__disableSearchEdit" ID="HelpIndexWidget.__disableSearchEdit"></a> <h4>HelpIndexWidget.__disableSearchEdit</h4> <b>__disableSearchEdit</b>(<i></i>)
--- a/Helpviewer/HelpIndexWidget.py Sat Feb 13 17:07:34 2010 +0000 +++ b/Helpviewer/HelpIndexWidget.py Sun Feb 14 11:28:47 2010 +0000 @@ -16,7 +16,9 @@ """ Class implementing a window for showing the QtHelp index. - @signal linkActivated(const QUrl&) emitted when an index entry is activated + @signal linkActivated(const QUrl&) emitted when an index entry is activated + @signal linksActivated(links, keyword) emitted when an index entry referencing + multiple targets is activated @signal escapePressed() emitted when the ESC key was pressed """ def __init__(self, engine, mainWindow, parent = None): @@ -52,18 +54,30 @@ self.__disableSearchEdit) self.connect(self.__engine.indexModel(), SIGNAL("indexCreated()"), self.__enableSearchEdit) - self.connect(self.__index, SIGNAL("linkActivated(const QUrl&, const QString&)"), - self, SIGNAL("linkActivated(const QUrl&)")) - self.connect(self.__index, - SIGNAL("linksActivated(const QMap<QString, QUrl>&, const QString&)"), - self, - SIGNAL("linksActivated(const QMap<QString, QUrl>&, const QString&)")) + self.connect(self.__index, SIGNAL("activated(const QModelIndex&)"), + self.__activated) self.connect(self.__searchEdit, SIGNAL("returnPressed()"), self.__index, SLOT("activateCurrentItem()")) self.__layout.addWidget(self.__index) self.__index.viewport().installEventFilter(self) + def __activated(self, idx): + """ + Private slot to handle the activation of a keyword entry. + + @param idx index of the activated entry (QModelIndex) + """ + model = self.__index.model() + if model is not None: + keyword = model.data(idx, Qt.DisplayRole) + links = model.linksForKeyword(keyword) + if len(links) == 1: + self.emit(SIGNAL("linkActivated(const QUrl&)"), + QUrl(links[list(links.keys())[0]])) + else: + self.emit(SIGNAL("linksActivated"), links, keyword) + def __filterIndices(self, filter): """ Private slot to filter the indices according to the given filter. @@ -132,7 +146,7 @@ act = menu.exec_() if act == curTab: - self.__index.activateCurrentItem() + self.__activated(idx) elif act == newTab: model = self.__index.model() if model is not None:
--- a/Helpviewer/HelpTopicDialog.py Sat Feb 13 17:07:34 2010 +0000 +++ b/Helpviewer/HelpTopicDialog.py Sun Feb 14 11:28:47 2010 +0000 @@ -32,7 +32,7 @@ .format(keyword)) self.__links = links - for topic in self.__links: + for topic in sorted(self.__links): self.topicsList.addItem(topic) if self.topicsList.count() > 0: self.topicsList.setCurrentRow(0)
--- a/Helpviewer/HelpWindow.py Sat Feb 13 17:07:34 2010 +0000 +++ b/Helpviewer/HelpWindow.py Sun Feb 14 11:28:47 2010 +0000 @@ -245,7 +245,7 @@ self.connect(self.__indexWindow, SIGNAL("linkActivated(const QUrl&)"), self.__linkActivated) self.connect(self.__indexWindow, - SIGNAL("linksActivated(const QMap<QString, QUrl>&, const QString&)"), + SIGNAL("linksActivated"), self.__linksActivated) self.connect(self.__indexWindow, SIGNAL("escapePressed()"), self.__activateCurrentBrowser)