Tue, 29 Dec 2015 18:59:46 +0100
Refined the online state change behaviour.
--- a/APIs/Python3/eric6.api Tue Dec 29 15:13:23 2015 +0100 +++ b/APIs/Python3/eric6.api Tue Dec 29 18:59:46 2015 +0100 @@ -1680,6 +1680,7 @@ eric6.E5Network.E5NetworkHeaderDetailsDialog.E5NetworkHeaderDetailsDialog.setData?4(name, value) eric6.E5Network.E5NetworkHeaderDetailsDialog.E5NetworkHeaderDetailsDialog?1(parent=None) eric6.E5Network.E5NetworkIcon.E5NetworkIcon.isOnline?4() +eric6.E5Network.E5NetworkIcon.E5NetworkIcon.onlineStateChanged?7 eric6.E5Network.E5NetworkIcon.E5NetworkIcon?1(parent=None) eric6.E5Network.E5NetworkMonitor.E5NetworkMonitor._monitor?8 eric6.E5Network.E5NetworkMonitor.E5NetworkMonitor.closeEvent?4(evt) @@ -8642,6 +8643,7 @@ eric6.UI.UserInterface.UserInterface.maxFilePathLen?7 eric6.UI.UserInterface.UserInterface.maxMenuFilePathLen?7 eric6.UI.UserInterface.UserInterface.notificationsEnabled?4() +eric6.UI.UserInterface.UserInterface.onlineStateChanged?7 eric6.UI.UserInterface.UserInterface.performVersionCheck?4(manual=True, alternative=0, showVersions=False) eric6.UI.UserInterface.UserInterface.preferencesChanged?7 eric6.UI.UserInterface.UserInterface.processArgs?4(args)
--- a/Documentation/Help/source.qhp Tue Dec 29 15:13:23 2015 +0100 +++ b/Documentation/Help/source.qhp Tue Dec 29 18:59:46 2015 +0100 @@ -7308,11 +7308,13 @@ <keyword name="IrcNetworkWidget" id="IrcNetworkWidget" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget" /> <keyword name="IrcNetworkWidget (Constructor)" id="IrcNetworkWidget (Constructor)" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__init__" /> <keyword name="IrcNetworkWidget (Module)" id="IrcNetworkWidget (Module)" ref="eric6.Network.IRC.IrcNetworkWidget.html" /> + <keyword name="IrcNetworkWidget.__autoConnect" id="IrcNetworkWidget.__autoConnect" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__autoConnect" /> <keyword name="IrcNetworkWidget.__clearMessages" id="IrcNetworkWidget.__clearMessages" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__clearMessages" /> <keyword name="IrcNetworkWidget.__copyAllMessages" id="IrcNetworkWidget.__copyAllMessages" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__copyAllMessages" /> <keyword name="IrcNetworkWidget.__copyMessages" id="IrcNetworkWidget.__copyMessages" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__copyMessages" /> <keyword name="IrcNetworkWidget.__cutAllMessages" id="IrcNetworkWidget.__cutAllMessages" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__cutAllMessages" /> <keyword name="IrcNetworkWidget.__initMessagesMenu" id="IrcNetworkWidget.__initMessagesMenu" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__initMessagesMenu" /> + <keyword name="IrcNetworkWidget.__onlineStateChanged" id="IrcNetworkWidget.__onlineStateChanged" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__onlineStateChanged" /> <keyword name="IrcNetworkWidget.__refreshNetworks" id="IrcNetworkWidget.__refreshNetworks" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__refreshNetworks" /> <keyword name="IrcNetworkWidget.__saveMessages" id="IrcNetworkWidget.__saveMessages" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.__saveMessages" /> <keyword name="IrcNetworkWidget.addErrorMessage" id="IrcNetworkWidget.addErrorMessage" ref="eric6.Network.IRC.IrcNetworkWidget.html#IrcNetworkWidget.addErrorMessage" /> @@ -8708,6 +8710,7 @@ <keyword name="PluginManager.__getShortInfo" id="PluginManager.__getShortInfo" ref="eric6.PluginManager.PluginManager.html#PluginManager.__getShortInfo" /> <keyword name="PluginManager.__insertPluginsPaths" id="PluginManager.__insertPluginsPaths" ref="eric6.PluginManager.PluginManager.html#PluginManager.__insertPluginsPaths" /> <keyword name="PluginManager.__loadPlugins" id="PluginManager.__loadPlugins" ref="eric6.PluginManager.PluginManager.html#PluginManager.__loadPlugins" /> + <keyword name="PluginManager.__onlineStateChanged" id="PluginManager.__onlineStateChanged" ref="eric6.PluginManager.PluginManager.html#PluginManager.__onlineStateChanged" /> <keyword name="PluginManager.__pluginDirectoriesExist" id="PluginManager.__pluginDirectoriesExist" ref="eric6.PluginManager.PluginManager.html#PluginManager.__pluginDirectoriesExist" /> <keyword name="PluginManager.__pluginModulesExist" id="PluginManager.__pluginModulesExist" ref="eric6.PluginManager.PluginManager.html#PluginManager.__pluginModulesExist" /> <keyword name="PluginManager.__sslErrors" id="PluginManager.__sslErrors" ref="eric6.PluginManager.PluginManager.html#PluginManager.__sslErrors" /> @@ -12360,6 +12363,7 @@ <keyword name="UserInterface.__masterPasswordChanged" id="UserInterface.__masterPasswordChanged" ref="eric6.UI.UserInterface.html#UserInterface.__masterPasswordChanged" /> <keyword name="UserInterface.__newProject" id="UserInterface.__newProject" ref="eric6.UI.UserInterface.html#UserInterface.__newProject" /> <keyword name="UserInterface.__newWindow" id="UserInterface.__newWindow" ref="eric6.UI.UserInterface.html#UserInterface.__newWindow" /> + <keyword name="UserInterface.__onlineStateChanged" id="UserInterface.__onlineStateChanged" ref="eric6.UI.UserInterface.html#UserInterface.__onlineStateChanged" /> <keyword name="UserInterface.__openMiniEditor" id="UserInterface.__openMiniEditor" ref="eric6.UI.UserInterface.html#UserInterface.__openMiniEditor" /> <keyword name="UserInterface.__openOnStartup" id="UserInterface.__openOnStartup" ref="eric6.UI.UserInterface.html#UserInterface.__openOnStartup" /> <keyword name="UserInterface.__pluginsConfigure" id="UserInterface.__pluginsConfigure" ref="eric6.UI.UserInterface.html#UserInterface.__pluginsConfigure" />
--- a/Documentation/Source/eric6.E5Network.E5NetworkIcon.html Tue Dec 29 15:13:23 2015 +0100 +++ b/Documentation/Source/eric6.E5Network.E5NetworkIcon.html Tue Dec 29 18:59:46 2015 +0100 @@ -43,7 +43,14 @@ <h2>E5NetworkIcon</h2> <p> Class implementing a statusbar icon tracking the network status. -</p> +</p><h3>Signals</h3> +<dl> +<dt>onlineStateChanged(online)</dt> +<dd> +emitted to indicate a change of the + network state +</dd> +</dl> <h3>Derived from</h3> E5ClickableLabel <h3>Class Attributes</h3>
--- a/Documentation/Source/eric6.Network.IRC.IrcNetworkWidget.html Tue Dec 29 15:13:23 2015 +0100 +++ b/Documentation/Source/eric6.Network.IRC.IrcNetworkWidget.html Tue Dec 29 18:59:46 2015 +0100 @@ -51,7 +51,7 @@ </dd><dt>away(bool)</dt> <dd> emitted to indicate the away status -</dd><dt>connectNetwork(str,bool)</dt> +</dd><dt>connectNetwork(str,bool,bool)</dt> <dd> emitted to connect or disconnect from a network @@ -85,6 +85,9 @@ <td><a href="#IrcNetworkWidget.__init__">IrcNetworkWidget</a></td> <td>Constructor</td> </tr><tr> +<td><a href="#IrcNetworkWidget.__autoConnect">__autoConnect</a></td> +<td>Public method to perform the IRC auto connection.</td> +</tr><tr> <td><a href="#IrcNetworkWidget.__clearMessages">__clearMessages</a></td> <td>Private slot to clear the contents of the messages display.</td> </tr><tr> @@ -100,6 +103,9 @@ <td><a href="#IrcNetworkWidget.__initMessagesMenu">__initMessagesMenu</a></td> <td>Private slot to initialize the context menu of the messages pane.</td> </tr><tr> +<td><a href="#IrcNetworkWidget.__onlineStateChanged">__onlineStateChanged</a></td> +<td>Private slot handling online state changes.</td> +</tr><tr> <td><a href="#IrcNetworkWidget.__refreshNetworks">__refreshNetworks</a></td> <td>Private slot to refresh all network related widgets.</td> </tr><tr> @@ -184,7 +190,12 @@ <dd> reference to the parent widget (QWidget) </dd> -</dl><a NAME="IrcNetworkWidget.__clearMessages" ID="IrcNetworkWidget.__clearMessages"></a> +</dl><a NAME="IrcNetworkWidget.__autoConnect" ID="IrcNetworkWidget.__autoConnect"></a> +<h4>IrcNetworkWidget.__autoConnect</h4> +<b>__autoConnect</b>(<i></i>) +<p> + Public method to perform the IRC auto connection. +</p><a NAME="IrcNetworkWidget.__clearMessages" ID="IrcNetworkWidget.__clearMessages"></a> <h4>IrcNetworkWidget.__clearMessages</h4> <b>__clearMessages</b>(<i></i>) <p> @@ -212,7 +223,17 @@ <b>__initMessagesMenu</b>(<i></i>) <p> Private slot to initialize the context menu of the messages pane. -</p><a NAME="IrcNetworkWidget.__refreshNetworks" ID="IrcNetworkWidget.__refreshNetworks"></a> +</p><a NAME="IrcNetworkWidget.__onlineStateChanged" ID="IrcNetworkWidget.__onlineStateChanged"></a> +<h4>IrcNetworkWidget.__onlineStateChanged</h4> +<b>__onlineStateChanged</b>(<i>online</i>) +<p> + Private slot handling online state changes. +</p><dl> +<dt><i>online</i> (bool)</dt> +<dd> +online state +</dd> +</dl><a NAME="IrcNetworkWidget.__refreshNetworks" ID="IrcNetworkWidget.__refreshNetworks"></a> <h4>IrcNetworkWidget.__refreshNetworks</h4> <b>__refreshNetworks</b>(<i></i>) <p>
--- a/Documentation/Source/eric6.Network.IRC.IrcWidget.html Tue Dec 29 15:13:23 2015 +0100 +++ b/Documentation/Source/eric6.Network.IRC.IrcWidget.html Tue Dec 29 18:59:46 2015 +0100 @@ -232,7 +232,7 @@ </dd> </dl><a NAME="IrcWidget.__connectNetwork" ID="IrcWidget.__connectNetwork"></a> <h4>IrcWidget.__connectNetwork</h4> -<b>__connectNetwork</b>(<i>name, connect, silent=False</i>) +<b>__connectNetwork</b>(<i>name, connect, silent</i>) <p> Private slot to connect to or disconnect from the given network. </p><dl> @@ -242,7 +242,7 @@ </dd><dt><i>connect</i></dt> <dd> flag indicating to connect (boolean) -</dd><dt><i>silent=</i></dt> +</dd><dt><i>silent</i></dt> <dd> flag indicating a silent connect/disconnect (boolean) </dd>
--- a/Documentation/Source/eric6.PluginManager.PluginManager.html Tue Dec 29 15:13:23 2015 +0100 +++ b/Documentation/Source/eric6.PluginManager.PluginManager.html Tue Dec 29 18:59:46 2015 +0100 @@ -107,6 +107,9 @@ <td><a href="#PluginManager.__loadPlugins">__loadPlugins</a></td> <td>Private method to load the plugins found.</td> </tr><tr> +<td><a href="#PluginManager.__onlineStateChanged">__onlineStateChanged</a></td> +<td>Private slot handling changes in online state.</td> +</tr><tr> <td><a href="#PluginManager.__pluginDirectoriesExist">__pluginDirectoriesExist</a></td> <td>Private method to check, if the plugin folders exist.</td> </tr><tr> @@ -318,7 +321,17 @@ <b>__loadPlugins</b>(<i></i>) <p> Private method to load the plugins found. -</p><a NAME="PluginManager.__pluginDirectoriesExist" ID="PluginManager.__pluginDirectoriesExist"></a> +</p><a NAME="PluginManager.__onlineStateChanged" ID="PluginManager.__onlineStateChanged"></a> +<h4>PluginManager.__onlineStateChanged</h4> +<b>__onlineStateChanged</b>(<i>online</i>) +<p> + Private slot handling changes in online state. +</p><dl> +<dt><i>online</i> (bool)</dt> +<dd> +flag indicating the online state +</dd> +</dl><a NAME="PluginManager.__pluginDirectoriesExist" ID="PluginManager.__pluginDirectoriesExist"></a> <h4>PluginManager.__pluginDirectoriesExist</h4> <b>__pluginDirectoriesExist</b>(<i></i>) <p>
--- a/Documentation/Source/eric6.UI.UserInterface.html Tue Dec 29 15:13:23 2015 +0100 +++ b/Documentation/Source/eric6.UI.UserInterface.html Tue Dec 29 18:59:46 2015 +0100 @@ -154,6 +154,10 @@ <dd> emitted after the master password has been changed with the old and the new password +</dd><dt>onlineStateChanged(online)</dt> +<dd> +emitted to indicate a change of the + network state </dd><dt>preferencesChanged()</dt> <dd> emitted after the preferences were changed @@ -383,6 +387,9 @@ <td><a href="#UserInterface.__newWindow">__newWindow</a></td> <td>Private slot to start a new instance of eric6.</td> </tr><tr> +<td><a href="#UserInterface.__onlineStateChanged">__onlineStateChanged</a></td> +<td>Private slot handling changes in online state.</td> +</tr><tr> <td><a href="#UserInterface.__openMiniEditor">__openMiniEditor</a></td> <td>Private slot to show a mini editor window.</td> </tr><tr> @@ -1309,7 +1316,17 @@ <b>__newWindow</b>(<i></i>) <p> Private slot to start a new instance of eric6. -</p><a NAME="UserInterface.__openMiniEditor" ID="UserInterface.__openMiniEditor"></a> +</p><a NAME="UserInterface.__onlineStateChanged" ID="UserInterface.__onlineStateChanged"></a> +<h4>UserInterface.__onlineStateChanged</h4> +<b>__onlineStateChanged</b>(<i>online</i>) +<p> + Private slot handling changes in online state. +</p><dl> +<dt><i>online</i> (bool)</dt> +<dd> +flag indicating the online state +</dd> +</dl><a NAME="UserInterface.__openMiniEditor" ID="UserInterface.__openMiniEditor"></a> <h4>UserInterface.__openMiniEditor</h4> <b>__openMiniEditor</b>(<i></i>) <p>
--- a/E5Network/E5NetworkIcon.py Tue Dec 29 15:13:23 2015 +0100 +++ b/E5Network/E5NetworkIcon.py Tue Dec 29 18:59:46 2015 +0100 @@ -9,7 +9,7 @@ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSlot +from PyQt5.QtCore import pyqtSlot, pyqtSignal from PyQt5.QtNetwork import QNetworkConfigurationManager from E5Gui.E5ClickableLabel import E5ClickableLabel @@ -20,7 +20,12 @@ class E5NetworkIcon(E5ClickableLabel): """ Class implementing a statusbar icon tracking the network status. + + @signal onlineStateChanged(online) emitted to indicate a change of the + network state """ + onlineStateChanged = pyqtSignal(bool) + def __init__(self, parent=None): """ Constructor @@ -31,7 +36,8 @@ super(E5NetworkIcon, self).__init__(parent) self.__networkManager = QNetworkConfigurationManager(self) - self.__onlineStateChanged(self.__networkManager.isOnline()) + self.__online = self.__networkManager.isOnline() + self.__onlineStateChanged(self.__online) self.__networkManager.onlineStateChanged.connect( self.__onlineStateChanged) @@ -58,6 +64,10 @@ tooltip = tooltip.format(self.tr("Offline")) self.setToolTip(tooltip) + + if online != self.__online: + self.__online = online + self.onlineStateChanged.emit(online) def isOnline(self): """
--- a/Network/IRC/IrcNetworkWidget.py Tue Dec 29 15:13:23 2015 +0100 +++ b/Network/IRC/IrcNetworkWidget.py Tue Dec 29 18:59:46 2015 +0100 @@ -9,11 +9,12 @@ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSlot, pyqtSignal, QPoint, QFileInfo, QUrl +from PyQt5.QtCore import pyqtSlot, pyqtSignal, QPoint, QFileInfo, QUrl, QThread from PyQt5.QtGui import QDesktopServices from PyQt5.QtWidgets import QWidget, QApplication, QMenu from E5Gui import E5MessageBox, E5FileDialog +from E5Gui.E5Application import e5App from .Ui_IrcNetworkWidget import Ui_IrcNetworkWidget @@ -28,7 +29,7 @@ """ Class implementing the network part of the IRC widget. - @signal connectNetwork(str,bool) emitted to connect or disconnect from + @signal connectNetwork(str,bool,bool) emitted to connect or disconnect from a network @signal editNetwork(str) emitted to edit a network configuration @signal joinChannel(str) emitted to join a channel @@ -37,7 +38,7 @@ @signal away(bool) emitted to indicate the away status @signal autoConnected() emitted after an automatic connection was initiated """ - connectNetwork = pyqtSignal(str, bool) + connectNetwork = pyqtSignal(str, bool, bool) editNetwork = pyqtSignal(str) joinChannel = pyqtSignal(str) nickChanged = pyqtSignal(str) @@ -94,6 +95,17 @@ """ Public method to perform the IRC auto connection. """ + userInterface = e5App().getObject("UserInterface") + online = userInterface.isOnline() + self.connectButton.setEnabled(online) + userInterface.onlineStateChanged.connect(self.__onlineStateChanged) + if online: + self.__autoConnect() + + def __autoConnect(self): + """ + Public method to perform the IRC auto connection. + """ for networkName in self.__manager.getNetworkNames(): if self.__manager.getNetwork(networkName).autoConnect(): row = self.networkCombo.findText(networkName) @@ -102,6 +114,24 @@ self.autoConnected.emit() break + @pyqtSlot(bool) + def __onlineStateChanged(self, online): + """ + Private slot handling online state changes. + + @param online online state + @type bool + """ + self.connectButton.setEnabled(online) + if online: + # delay a bit because the signal seems to be sent before the + # network interface is fully up + QThread.msleep(200) + self.__autoConnect() + else: + network = self.networkCombo.currentText() + self.connectNetwork.emit(network, online, True) + @pyqtSlot() def __refreshNetworks(self): """ @@ -129,7 +159,7 @@ Private slot to connect to a network. """ network = self.networkCombo.currentText() - self.connectNetwork.emit(network, not self.__connected) + self.connectNetwork.emit(network, not self.__connected, False) @pyqtSlot() def on_awayButton_clicked(self):
--- a/Network/IRC/IrcWidget.py Tue Dec 29 15:13:23 2015 +0100 +++ b/Network/IRC/IrcWidget.py Tue Dec 29 18:59:46 2015 +0100 @@ -171,13 +171,13 @@ """ self.networkWidget.autoConnect() - def __connectNetwork(self, name, connect, silent=False): + def __connectNetwork(self, name, connect, silent): """ Private slot to connect to or disconnect from the given network. @param name name of the network to connect to (string) @param connect flag indicating to connect (boolean) - @keyparam silent flag indicating a silent connect/disconnect (boolean) + @param silent flag indicating a silent connect/disconnect (boolean) """ if connect: network = self.__ircNetworkManager.getNetwork(name) @@ -927,7 +927,7 @@ " for <b>{0}</b>. Disconnecting...") .format(self.__userName), filterMsg=False) - self.__connectNetwork("", False, silent=True) + self.__connectNetwork("", False, True) self.__nickName = "" self.__nickIndex = -1 return
--- a/PluginManager/PluginManager.py Tue Dec 29 15:13:23 2015 +0100 +++ b/PluginManager/PluginManager.py Tue Dec 29 18:59:46 2015 +0100 @@ -143,6 +143,8 @@ self.__sslErrorHandler = E5SslErrorHandler(self) self.__networkManager.sslErrors.connect(self.__sslErrors) self.__replies = [] + + self.__ui.onlineStateChanged.connect(self.__onlineStateChanged) def finalizeSetup(self): """ @@ -1052,7 +1054,7 @@ self.deactivatePlugin(name, True) ######################################################################## - ## Methods creation of the plug-ins download directory + ## Methods for the creation of the plug-ins download directory ######################################################################## def __checkPluginsDownloadDirectory(self): @@ -1097,6 +1099,16 @@ ## Methods for automatic plug-in update check below ######################################################################## + def __onlineStateChanged(self, online): + """ + Private slot handling changes in online state. + + @param online flag indicating the online state + @type bool + """ + if online: + self.checkPluginUpdatesAvailable() + def checkPluginUpdatesAvailable(self): """ Public method to check the availability of updates of plug-ins.
--- a/UI/UserInterface.py Tue Dec 29 15:13:23 2015 +0100 +++ b/UI/UserInterface.py Tue Dec 29 18:59:46 2015 +0100 @@ -134,6 +134,8 @@ name of the menu and a reference to the menu are given. @signal masterPasswordChanged(str, str) emitted after the master password has been changed with the old and the new password + @signal onlineStateChanged(online) emitted to indicate a change of the + network state """ appendStderr = pyqtSignal(str) appendStdout = pyqtSignal(str) @@ -141,6 +143,7 @@ reloadAPIs = pyqtSignal() showMenu = pyqtSignal(str, QMenu) masterPasswordChanged = pyqtSignal(str, str) + onlineStateChanged = pyqtSignal(bool) maxFilePathLen = 100 maxMenuFilePathLen = 75 @@ -2822,6 +2825,8 @@ self.networkIcon = E5NetworkIcon(self.__statusBar) self.__statusBar.addPermanentWidget(self.networkIcon) + self.networkIcon.onlineStateChanged.connect(self.onlineStateChanged) + self.networkIcon.onlineStateChanged.connect(self.__onlineStateChanged) def __initExternalToolsActions(self): """ @@ -5794,7 +5799,8 @@ """ Public method to check the availability of updates of plug-ins. """ - self.pluginManager.checkPluginUpdatesAvailable() + if self.isOnline(): + self.pluginManager.checkPluginUpdatesAvailable() ################################################################# ## Drag and Drop Support @@ -5944,6 +5950,16 @@ @rtype bool """ return self.networkIcon.isOnline() + + def __onlineStateChanged(self, online): + """ + Private slot handling changes in online state. + + @param online flag indicating the online state + @type bool + """ + if online: + self.performVersionCheck(False) ############################################## ## Below are methods to check for new versions