aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRael <rael.gc@gmail.com>2015-09-25 08:12:18 -0300
committerRael <rael.gc@gmail.com>2015-09-25 08:12:18 -0300
commit196cb44d2c66c373838c082525af254baafefc01 (patch)
tree947ea2405a56826f3a1a1dbcea535761be416512
parente07d9c294e72eb211c882ec72d982cc493a10334 (diff)
downloadscudcloud-196cb44d2c66c373838c082525af254baafefc01.zip
scudcloud-196cb44d2c66c373838c082525af254baafefc01.tar.gz
scudcloud-196cb44d2c66c373838c082525af254baafefc01.tar.bz2
Adding a timer to check server side reloads
-rw-r--r--scudcloud-1.0/lib/wrapper.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/scudcloud-1.0/lib/wrapper.py b/scudcloud-1.0/lib/wrapper.py
index 44a8cda..f21ed69 100644
--- a/scudcloud-1.0/lib/wrapper.py
+++ b/scudcloud-1.0/lib/wrapper.py
@@ -3,7 +3,7 @@ from urllib import request
from urllib.parse import urlparse
from resources import Resources
from PyQt4 import QtWebKit, QtGui, QtCore
-from PyQt4.Qt import QApplication, QKeySequence
+from PyQt4.Qt import QApplication, QKeySequence, QTimer
from PyQt4.QtCore import QBuffer, QByteArray, QUrl, SIGNAL
from PyQt4.QtWebKit import QWebView, QWebPage, QWebSettings
from PyQt4.QtNetwork import QNetworkProxy
@@ -25,6 +25,15 @@ class Wrapper(QWebView):
self.connect(self, SIGNAL("loadFinished(bool)"), self.loadFinished)
self.connect(self, SIGNAL("linkClicked(const QUrl&)"), self.linkClicked)
self.addActions()
+ self.setupTimer()
+
+ # Starting a timer that will check by server side reloads (which drops ScudCloud JS)
+ def setupTimer(self):
+ timer = QTimer(self)
+ timer.timeout.connect(self.loadFinished)
+ # Hope each 10 minutes will not be produce high CPU usage
+ timer.setInterval(600000)
+ timer.start()
def configure_proxy(self):
proxy = urlparse(os.environ.get('http_proxy') or os.environ.get('HTTP_PROXY'))
@@ -84,7 +93,7 @@ class Wrapper(QWebView):
self.systemOpen(url)
self.load(QUrl("https://"+qUrl.host()+"/messages/general"))
- def loadFinished(self, ok):
+ def loadFinished(self, ok=True):
self.page().currentFrame().addToJavaScriptWindowObject("desktop", self)
self.page().currentFrame().evaluateJavaScript(self.js)
self.window.enableMenus(self.isConnected())