aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRael <rael.gc@gmail.com>2015-09-16 18:37:37 -0300
committerRael <rael.gc@gmail.com>2015-09-16 18:37:37 -0300
commit0cad5a9e4e1f915170212b7486223c449b5690ca (patch)
tree99d6a1223aa4c429c3796a2f871ab4defed3bbb6
parent622f4857f9e18d0be5b8eea3cf152ae99193c76e (diff)
downloadscudcloud-0cad5a9e4e1f915170212b7486223c449b5690ca.zip
scudcloud-0cad5a9e4e1f915170212b7486223c449b5690ca.tar.gz
scudcloud-0cad5a9e4e1f915170212b7486223c449b5690ca.tar.bz2
Adding team icon in notifications
-rwxr-xr-xscudcloud-1.0/lib/scudcloud.py4
-rw-r--r--scudcloud-1.0/lib/wrapper.py7
-rw-r--r--scudcloud-1.0/resources/scudcloud.js2
-rw-r--r--scudcloud-1.0/scudcloud-src.js2
4 files changed, 10 insertions, 5 deletions
diff --git a/scudcloud-1.0/lib/scudcloud.py b/scudcloud-1.0/lib/scudcloud.py
index f12c5b6..e194ddb 100755
--- a/scudcloud-1.0/lib/scudcloud.py
+++ b/scudcloud-1.0/lib/scudcloud.py
@@ -326,8 +326,8 @@ class ScudCloud(QtGui.QMainWindow):
ql.child_append(item)
self.launcher.set_property("quicklist", ql)
- def notify(self, title, message):
- self.notifier.notify(title, message)
+ def notify(self, title, message, icon=None):
+ self.notifier.notify(title, message, icon)
self.alert()
def alert(self):
diff --git a/scudcloud-1.0/lib/wrapper.py b/scudcloud-1.0/lib/wrapper.py
index 8a2f3aa..46e5c64 100644
--- a/scudcloud-1.0/lib/wrapper.py
+++ b/scudcloud-1.0/lib/wrapper.py
@@ -1,4 +1,5 @@
import sys, subprocess, os, json
+from urllib import request
from urllib.parse import urlparse
from resources import Resources
from PyQt4 import QtWebKit, QtGui, QtCore
@@ -9,6 +10,8 @@ from PyQt4.QtNetwork import QNetworkProxy
class Wrapper(QWebView):
+ icon = None
+
def __init__(self, window):
self.configure_proxy()
QWebView.__init__(self)
@@ -132,6 +135,8 @@ class Wrapper(QWebView):
data = json.loads(serialized)
self.window.quicklist(data['channels'])
self.window.teams(data['teams'])
+ filename, headers = request.urlretrieve(data['icon'])
+ self.icon = filename
@QtCore.pyqtSlot(bool)
def enableMenus(self, enabled):
@@ -150,6 +155,6 @@ 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))
+ self.window.notify(str(title).replace("New message from ", "").replace("New message in ", ""), str(message), self.icon)
diff --git a/scudcloud-1.0/resources/scudcloud.js b/scudcloud-1.0/resources/scudcloud.js
index c03d516..effd6e3 100644
--- a/scudcloud-1.0/resources/scudcloud.js
+++ b/scudcloud-1.0/resources/scudcloud.js
@@ -1 +1 @@
-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)})},connect:function(n){desktop.enableMenus(n),n&&desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams()}))},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}};"undefined"!=typeof TS&&(document.onpaste=function(){desktop.pasted(!1)},ScudCloud.overrideNotifications(),ScudCloud.overrideConnect());
+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)})},connect:function(n){desktop.enableMenus(n),n&&desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_88}))},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}};"undefined"!=typeof TS&&(document.onpaste=function(){desktop.pasted(!1)},ScudCloud.overrideNotifications(),ScudCloud.overrideConnect());
diff --git a/scudcloud-1.0/scudcloud-src.js b/scudcloud-1.0/scudcloud-src.js
index 9d5c869..e394b58 100644
--- a/scudcloud-1.0/scudcloud-src.js
+++ b/scudcloud-1.0/scudcloud-src.js
@@ -12,7 +12,7 @@ var ScudCloud = {
},
connect: function(b){
desktop.enableMenus(b);
- if(b) desktop.populate(JSON.stringify({'channels': ScudCloud.listChannels(), 'teams': ScudCloud.listTeams()}));
+ if(b) desktop.populate(JSON.stringify({'channels': ScudCloud.listChannels(), 'teams': ScudCloud.listTeams(), 'icon': TS.model.team.icon.image_88}));
},
count: function(){
var total=0;