aboutsummaryrefslogtreecommitdiffstats
path: root/scudcloud-1.0/lib
diff options
context:
space:
mode:
Diffstat (limited to 'scudcloud-1.0/lib')
-rwxr-xr-xscudcloud-1.0/lib/scudcloud.py11
-rw-r--r--scudcloud-1.0/lib/wrapper.py29
2 files changed, 6 insertions, 34 deletions
diff --git a/scudcloud-1.0/lib/scudcloud.py b/scudcloud-1.0/lib/scudcloud.py
index 3fb3b2c..abcc8ca 100755
--- a/scudcloud-1.0/lib/scudcloud.py
+++ b/scudcloud-1.0/lib/scudcloud.py
@@ -61,8 +61,6 @@ class ScudCloud(QtGui.QMainWindow):
self.systray(ScudCloud.minimized)
self.installEventFilter(self)
self.statusBar().showMessage('Loading Slack...')
- # Starting unread msgs counter
- self.setupTimer()
def addWrapper(self, url):
webView = Wrapper(self)
@@ -73,12 +71,6 @@ class ScudCloud(QtGui.QMainWindow):
self.stackedWidget.addWidget(webView)
self.stackedWidget.setCurrentWidget(webView)
- def setupTimer(self):
- self.timer = QTimer(self)
- self.timer.timeout.connect(self.count)
- self.timer.setInterval(2000)
- self.timer.start()
-
def webSettings(self):
self.cookiesjar = PersistentCookieJar(self)
self.zoom = self.readZoom()
@@ -281,7 +273,6 @@ class ScudCloud(QtGui.QMainWindow):
break
if not exists:
self.addWrapper(url)
- self.enableMenus(self.current().isConnected())
self.updateEditMenu()
def eventFilter(self, obj, event):
@@ -367,7 +358,7 @@ class ScudCloud(QtGui.QMainWindow):
total = 0
for i in range(0, self.stackedWidget.count()):
widget = self.stackedWidget.widget(i)
- messages = widget.count()
+ messages = widget.highlights
if messages == 0:
self.leftPane.stopAlert(widget.team())
else:
diff --git a/scudcloud-1.0/lib/wrapper.py b/scudcloud-1.0/lib/wrapper.py
index 084c631..115cbe9 100644
--- a/scudcloud-1.0/lib/wrapper.py
+++ b/scudcloud-1.0/lib/wrapper.py
@@ -10,6 +10,7 @@ from PyQt4.QtNetwork import QNetworkProxy
class Wrapper(QWebView):
+ highlights = 0
icon = None
def __init__(self, window):
@@ -26,18 +27,6 @@ class Wrapper(QWebView):
self.linkClicked.connect(self._linkClicked)
self.page().featurePermissionRequested.connect(self.permissionRequested)
self.addActions()
- self.setupTimer()
-
- # Starting a timer that will check by server side reloads (which drops ScudCloud notification)
- def setupTimer(self):
- timer = QTimer(self)
- timer.timeout.connect(self.overrideNotifications)
- # Hope each 10 minutes will not be produce high CPU usage
- timer.setInterval(600000)
- timer.start()
-
- def overrideNotifications(self):
- self.call("overrideNotifications")
def permissionRequested(self, frame, feature):
self.page().setFeaturePermission(frame, feature, QWebPage.PermissionGrantedByUser)
@@ -104,7 +93,6 @@ class Wrapper(QWebView):
def _loadFinished(self, ok=True):
self.page().currentFrame().addToJavaScriptWindowObject("desktop", self)
self.page().currentFrame().evaluateJavaScript(self.js)
- self.window.enableMenus(self.isConnected())
self.window.statusBar().hide()
def systemOpen(self, url):
@@ -127,9 +115,6 @@ class Wrapper(QWebView):
self.window.show()
self.call("preferences")
- def isConnected(self):
- return self.call("isConnected")
-
def createSnippet(self):
self.call("createSnippet")
@@ -148,9 +133,6 @@ class Wrapper(QWebView):
def about(self):
subprocess.call(('xdg-open', "https://github.com/raelgc/scudcloud"))
- def isConnected(self):
- return self.call("isConnected")
-
def listChannels(self):
return self.call("listChannels")
@@ -158,11 +140,10 @@ class Wrapper(QWebView):
self.call("join", menuitem.property_get("id"))
self.window.show()
- def count(self):
- try:
- return self.call("count")
- except:
- return 0
+ @QtCore.pyqtSlot(int, int)
+ def setBadgeCount(self, highlight, unread):
+ self.highlights = highlight
+ self.window.count()
@QtCore.pyqtSlot(str)
def populate(self, serialized):