Hello friends and colleagues,
I am trying to make a function for my program on pyt4 – softphone which should determine the status of the network computer.
If the network has lost connection to the Internet the program should to wait until the network is restored and immediately restart the core of my app which self connects to server
Restarting the core is done by the “reload” method.
But I also would like to do cross-platform
Windows, Linux, Darwin,
I found something similar to this link: http://www.themacaque.com/?p=751
Reload method:
def reload(self):
self.config = ConfigParser.RawConfigParser()
self.config.readfp(getConfig())
self.tray.setIcon(self.inactiveIcon)
self.controller.core.restart_core()
The example you show is trying to use the native implementation because it was written not to depend on Qt4 (I’m the author of the post). If you don’t have a problem in using PyQt4 in all platforms you should consider using the networkAccessibleChanged signals that you can find in the QNetworkAccessManager.
If that is not possible you will have to write different implementations of the same interface to be used according to the platform in which you are working, for example:
If your software is open source and you don’t care/mind that canonical has the copyright of the code you can take a look at the implementations we wrote for Ubuntu One here.