aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--scudcloud-1.0/debian/changelog37
-rwxr-xr-xscudcloud-1.0/lib/scudcloud.py25
-rw-r--r--scudcloud-1.0/lib/systray.py2
-rw-r--r--scudcloud-1.0/lib/wrapper.py12
-rw-r--r--scudcloud-1.0/resources/scudcloud.js2
-rwxr-xr-xscudcloud-1.0/scudcloud16
-rw-r--r--scudcloud-1.0/scudcloud-src.js43
8 files changed, 103 insertions, 40 deletions
diff --git a/README.md b/README.md
index 8afc89e..3b7eae2 100644
--- a/README.md
+++ b/README.md
@@ -76,9 +76,9 @@ First, you'll need to install at least packages for `python3`, `python-qt4` (`qt
Then run the below script: it'll download the code and install it:
```bash
-wget https://github.com/raelgc/scudcloud/archive/v1.0.48.tar.gz
-tar -xvf v1.0.48.tar.gz
-cd scudcloud-1.0.48
+wget https://github.com/raelgc/scudcloud/archive/v1.0.54.tar.gz
+tar -xvf v1.0.54.tar.gz
+cd scudcloud-1.0.54
SOURCE="scudcloud-1.0"
INSTALL="/opt/scudcloud"
sudo mkdir -p $INSTALL/lib
diff --git a/scudcloud-1.0/debian/changelog b/scudcloud-1.0/debian/changelog
index cff5c36..74e3ed1 100644
--- a/scudcloud-1.0/debian/changelog
+++ b/scudcloud-1.0/debian/changelog
@@ -1,3 +1,40 @@
+scudcloud (1.0-54) trusty; urgency=medium
+
+ * Updating notifications to match Slack changes
+
+ -- Rael Gugelmin Cunha <rael.gc@gmail.com> Wed, 05 Aug 2015 11:02:58 -0300
+
+scudcloud (1.0-53) trusty; urgency=medium
+
+ * Fixing notifications count again (#164)
+
+ -- Rael Gugelmin Cunha <rael.gc@gmail.com> Sun, 02 Aug 2015 22:10:56 -0300
+
+scudcloud (1.0-52) trusty; urgency=medium
+
+ * Fixing code format error
+
+ -- Rael Gugelmin Cunha <rael.gc@gmail.com> Sun, 26 Jul 2015 00:14:59 -0300
+
+scudcloud (1.0-51) trusty; urgency=medium
+
+ * Using lambdas for dereferenced callbacks (fixes #170 #177)
+ * Updating unread counter on window focus
+
+ -- Rael Gugelmin Cunha <rael.gc@gmail.com> Sat, 25 Jul 2015 23:58:20 -0300
+
+scudcloud (1.0-50) trusty; urgency=medium
+
+ * Fixing quicklist and direct messages
+
+ -- Rael Gugelmin Cunha <rael.gc@gmail.com> Thu, 25 Jun 2015 14:45:00 -0300
+
+scudcloud (1.0-49) trusty; urgency=medium
+
+ * Update read messages (#164)
+
+ -- Rael Gugelmin Cunha <rael.gc@gmail.com> Wed, 24 Jun 2015 10:56:18 -0300
+
scudcloud (1.0-48) trusty; urgency=medium
* Few changes to avoid loose desktop notifications
diff --git a/scudcloud-1.0/lib/scudcloud.py b/scudcloud-1.0/lib/scudcloud.py
index d5185e5..0dd8fe7 100755
--- a/scudcloud-1.0/lib/scudcloud.py
+++ b/scudcloud-1.0/lib/scudcloud.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-import sys, os
+import sys, os, time
from cookiejar import PersistentCookieJar
from leftpane import LeftPane
from notifier import Notifier
@@ -7,8 +7,9 @@ from resources import Resources
from systray import Systray
from wrapper import Wrapper
from os.path import expanduser
+from threading import Thread
from PyQt4 import QtCore, QtGui, QtWebKit
-from PyQt4.Qt import QApplication, QKeySequence
+from PyQt4.Qt import QApplication, QKeySequence, QTimer
from PyQt4.QtCore import QUrl, QSettings
from PyQt4.QtWebKit import QWebSettings
@@ -61,6 +62,14 @@ class ScudCloud(QtGui.QMainWindow):
else:
webView.load(QtCore.QUrl(self.domain()))
webView.show()
+ # Starting unread msgs counter
+ self.setupTimer()
+
+ def setupTimer(self):
+ timer = QTimer(self)
+ timer.timeout.connect(self.count)
+ timer.setInterval(2000)
+ timer.start()
def webSettings(self):
self.cookiesjar = PersistentCookieJar(self)
@@ -129,10 +138,10 @@ class ScudCloud(QtGui.QMainWindow):
def addMenu(self):
self.menus = {
"file": {
- "preferences": self.createAction("Preferences", self.current().preferences),
+ "preferences": self.createAction("Preferences", lambda : self.current().preferences()),
"systray": self.createAction("Close to Tray", self.systray, None, True),
- "addTeam": self.createAction("Sign in to Another Team", self.current().addTeam),
- "signout": self.createAction("Signout", self.current().logout),
+ "addTeam": self.createAction("Sign in to Another Team", lambda : self.current().addTeam()),
+ "signout": self.createAction("Signout", lambda : self.current().logout()),
"close": self.createAction("Close", self.close, QKeySequence.Close),
"exit": self.createAction("Quit", self.exit, QKeySequence.Quit)
},
@@ -155,7 +164,7 @@ class ScudCloud(QtGui.QMainWindow):
"help": {
"help": self.createAction("Help and Feedback", self.current().help, QKeySequence.HelpContents),
"center": self.createAction("Slack Help Center", self.current().helpCenter),
- "about": self.createAction("About", self.current().about)
+ "about": self.createAction("About", lambda : self.current().about())
}
}
menu = self.menuBar()
@@ -322,11 +331,13 @@ class ScudCloud(QtGui.QMainWindow):
total = 0
for i in range(0, self.stackedWidget.count()):
widget = self.stackedWidget.widget(i)
+ widget.count()
if widget.messages == 0:
self.leftPane.stopAlert(widget.team())
else:
self.leftPane.alert(widget.team())
- total+=widget.messages
+ if widget.messages is not None:
+ total+=widget.messages
if total > self.messages:
self.alert()
if 0 == total:
diff --git a/scudcloud-1.0/lib/systray.py b/scudcloud-1.0/lib/systray.py
index 1cc38bf..dc2ec73 100644
--- a/scudcloud-1.0/lib/systray.py
+++ b/scudcloud-1.0/lib/systray.py
@@ -35,7 +35,7 @@ class Systray(QtGui.QSystemTrayIcon):
else:
self.setIcon(QtGui.QIcon.fromTheme("scudcloud"))
elif i > 0 and i < 10:
- self.setIcon(QtGui.QIcon.fromTheme("scudcloud-attention-"+str(i)))
+ self.setIcon(QtGui.QIcon.fromTheme("scudcloud-attention-"+str(int(i))))
elif i > 9:
self.setIcon(QtGui.QIcon.fromTheme("scudcloud-attention-9-plus"))
diff --git a/scudcloud-1.0/lib/wrapper.py b/scudcloud-1.0/lib/wrapper.py
index e695dbc..ccc8045 100644
--- a/scudcloud-1.0/lib/wrapper.py
+++ b/scudcloud-1.0/lib/wrapper.py
@@ -125,6 +125,12 @@ class Wrapper(QWebView):
self.call("join", menuitem.property_get("id"))
self.window.show()
+ def count(self):
+ try:
+ self.messages = self.call("count")
+ except:
+ self.messages = 0
+
@QtCore.pyqtSlot(bool)
def enableMenus(self, enabled):
self.window.enableMenus(enabled)
@@ -143,11 +149,5 @@ class Wrapper(QWebView):
@QtCore.pyqtSlot(str, str)
def sendMessage(self, title, message):
self.window.notify(str(title).replace("New message from ", "").replace("New message in ", ""), str(message))
- # Update the number of highlight unread messages
- self.call("count")
- @QtCore.pyqtSlot(int)
- def count(self, value):
- self.messages = value;
- self.window.count()
diff --git a/scudcloud-1.0/resources/scudcloud.js b/scudcloud-1.0/resources/scudcloud.js
index 2ab18af..dc5f322 100644
--- a/scudcloud-1.0/resources/scudcloud.js
+++ b/scudcloud-1.0/resources/scudcloud.js
@@ -1 +1 @@
-var ScudCloud={connected:!1,overrideNotifications:function(){TS.ui.growls.no_notifications=!1,TS.ui.growls.checkPermission=function(){return!0},TS.ui.growls.getPermissionLevel=function(){return"granted"},TS.ui.growls.show=function(n,e,o){desktop.sendMessage(n,o)},TS.ui.banner.close()},connect:function(n){ScudCloud.connected=n,desktop.enableMenus(n),ScudCloud.count(),ScudCloud.overrideNotifications()},count:function(){desktop.count(TS.model.all_unread_highlights_cnt.toString())},createSnippet:function(){return TS.ui.snippet_dialog.start()},isConnected:function(){return ScudCloud.connected},listChannels:function(){return TS.channels.getUnarchivedChannelsForUser()},listTeams:function(){var n=TS.getAllTeams();return n[0].team_icon={image_88:TS.model.team.icon.image_88},n},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(n){return TS.channels.join(n)},setClipboard:function(n){TS.client.ui.file_pasted_sig.dispatch(n,TS.model.shift_key_pressed)},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){var n=TS.getAllTeams();if(null!=n)for(var e=0;n.length;e++)if(n[e].team_url==TS.boot_data.team_url)return n[e].id;return""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_dialog.start()},isConnected:function(){return"undefined"!=typeof TS&&"undefined"!=typeof TS.model&&TS.model.ms_connected}},boot_data={};"undefined"!=typeof TS?(document.onpaste=function(){desktop.pasted(!1)},ScudCloud.overrideNotifications(),TS.ms.connected_sig.add(function(){ScudCloud.connect(!0)}),TS.ms.disconnected_sig.add(function(){ScudCloud.connect(!1)}),ScudCloud.onDOMReady=TS.onDOMReady,TS.onDOMReady=function(){ScudCloud.overrideNotifications(),ScudCloud.onDOMReady()},boot_data.channels=ScudCloud.listChannels(),boot_data.teams=ScudCloud.listTeams(),ScudCloud.count()):(boot_data.channels=new Array,boot_data.teams=new Array);boot_data
+var ScudCloud={overrideNotifications:function(){TS.ui.growls.no_notifications=!1,TS.ui.growls.checkPermission=function(){return!0},TS.ui.growls.getPermissionLevel=function(){return"granted"},TS.ui.growls.show=function(n,e){desktop.sendMessage(n,e)},TS.ui.banner.close()},overrideConnect:function(){TS.ms.connected_sig.add(function(){ScudCloud.connect(!0)}),TS.ms.disconnected_sig.add(function(){ScudCloud.connect(!1)})},overrideOnDOMReady:function(){ScudCloud.onDOMReady=TS.onDOMReady,TS.onDOMReady=function(){ScudCloud.overrideNotifications(),ScudCloud.onDOMReady()}},connect:function(n){desktop.enableMenus(n),ScudCloud.overrideNotifications()},count:function(){var n=0;return $("span.unread_highlight").not(".hidden").each(function(){n+=new Number($(this).text().replace("+",""))}),n},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){return TS.channels.getUnarchivedChannelsForUser()},listTeams:function(){var n=TS.getAllTeams();return n[0].team_icon={image_88:TS.model.team.icon.image_88},n},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(n){return TS.channels.join(n)},setClipboard:function(n){TS.client.ui.file_pasted_sig.dispatch(n,TS.model.shift_key_pressed)},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){var n=TS.getAllTeams();if(null!=n)for(var e=0;n.length;e++)if(n[e].team_url==TS.boot_data.team_url)return n[e].id;return""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_dialog.start()},isConnected:function(){return"undefined"!=typeof TS&&"undefined"!=typeof TS.model&&TS.model.ms_connected}},boot_data={};"undefined"!=typeof TS?(document.onpaste=function(){desktop.pasted(!1)},ScudCloud.overrideNotifications(),ScudCloud.overrideConnect(),ScudCloud.overrideOnDOMReady(),boot_data.channels=ScudCloud.listChannels(),boot_data.teams=ScudCloud.listTeams()):(boot_data.channels=new Array,boot_data.teams=new Array);boot_data
diff --git a/scudcloud-1.0/scudcloud b/scudcloud-1.0/scudcloud
index 2712d23..3670613 100755
--- a/scudcloud-1.0/scudcloud
+++ b/scudcloud-1.0/scudcloud
@@ -1,9 +1,19 @@
#!/usr/bin/env python3
import os
import sys
-INSTALL_DIR = "/opt/scudcloud/"
-sys.path.append(INSTALL_DIR+'lib')
from PyQt4 import QtGui
+
+def get_install_dir():
+ """
+ Rather than using an inflexible value of '/opt/scudcloud', we now assume
+ that the 'lib' and 'resources' dir will be in the same directory as the
+ 'scudcloud' executable. This method sets the install dir to always be
+ that directory.
+ """
+ return os.path.dirname(os.path.realpath(__file__))
+
+# Append the lib directory in our installation path to get remaining libraries.
+sys.path.append(os.path.join(get_install_dir(), 'lib'))
from resources import Resources
from scudcloud import ScudCloud
from qsingleapplication import QSingleApplication
@@ -13,7 +23,7 @@ from qsingleapplication import QSingleApplication
CONFDIR = '~/.config/scudcloud'
def main():
- Resources.INSTALL_DIR = INSTALL_DIR
+ Resources.INSTALL_DIR = get_install_dir()
app = QSingleApplication(sys.argv)
app.setApplicationName(Resources.APP_NAME)
app.setWindowIcon(QtGui.QIcon(Resources.get_path('scudcloud.png')))
diff --git a/scudcloud-1.0/scudcloud-src.js b/scudcloud-1.0/scudcloud-src.js
index 636e56e..e73f88f 100644
--- a/scudcloud-1.0/scudcloud-src.js
+++ b/scudcloud-1.0/scudcloud-src.js
@@ -1,29 +1,35 @@
var ScudCloud = {
- connected: false,
overrideNotifications: function(){
TS.ui.growls.no_notifications = false;
- TS.ui.growls.checkPermission = function() { return true; }
- TS.ui.growls.getPermissionLevel = function() { return 'granted'; }
+ TS.ui.growls.checkPermission = function() { return true; };
+ TS.ui.growls.getPermissionLevel = function() { return 'granted'; };
TS.ui.growls.show = function(j,k,g,o,l,b,c,m){
- desktop.sendMessage(j,g);
- }
+ desktop.sendMessage(j,k);
+ };
TS.ui.banner.close();
},
+ overrideConnect: function(){
+ TS.ms.connected_sig.add(function(){ScudCloud.connect(true);});
+ TS.ms.disconnected_sig.add(function(){ScudCloud.connect(false);});
+ },
+ overrideOnDOMReady: function(){
+ ScudCloud.onDOMReady = TS.onDOMReady;
+ TS.onDOMReady = function(){ScudCloud.overrideNotifications();ScudCloud.onDOMReady();};
+ },
connect: function(b){
- ScudCloud.connected = b;
desktop.enableMenus(b);
- ScudCloud.count();
ScudCloud.overrideNotifications();
},
count: function(){
- desktop.count(TS.model.all_unread_highlights_cnt.toString());
+ var total=0;
+ $('span.unread_highlight').not('.hidden').each(function(i){
+ total+= new Number($(this).text().replace('+','')); }
+ );
+ return total;
},
createSnippet: function(){
return TS.ui.snippet_dialog.start();
},
- isConnected: function(){
- return ScudCloud.connected;
- },
listChannels: function(){
return TS.channels.getUnarchivedChannelsForUser();
},
@@ -51,7 +57,9 @@ var ScudCloud = {
getCurrentTeam: function(){
var list = TS.getAllTeams();
if(list!=null) for(var i=0;list.length;i++){
- if(list[i].team_url==TS.boot_data.team_url) return list[i].id;
+ if(list[i].team_url==TS.boot_data.team_url){
+ return list[i].id;
+ }
}
return "";
},
@@ -64,18 +72,15 @@ var ScudCloud = {
isConnected: function(){
return "undefined" != typeof TS && "undefined" != typeof TS.model && TS.model.ms_connected;
}
-}
+};
var boot_data = {};
if("undefined" != typeof TS){
- document.onpaste = function(e){desktop.pasted(false);}
+ document.onpaste = function(e){desktop.pasted(false);};
ScudCloud.overrideNotifications();
- TS.ms.connected_sig.add(function(){ScudCloud.connect(true);});
- TS.ms.disconnected_sig.add(function(){ScudCloud.connect(false);});
- ScudCloud.onDOMReady = TS.onDOMReady;
- TS.onDOMReady = function(){ScudCloud.overrideNotifications();ScudCloud.onDOMReady();};
+ ScudCloud.overrideConnect();
+ ScudCloud.overrideOnDOMReady();
boot_data.channels = ScudCloud.listChannels();
boot_data.teams = ScudCloud.listTeams();
- ScudCloud.count();
} else {
boot_data.channels = new Array();
boot_data.teams = new Array();