-
Notifications
You must be signed in to change notification settings - Fork 19
/
notify.py
41 lines (36 loc) · 996 Bytes
/
notify.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import pynotify
import pkg_resources
def show(link):
if not pynotify.init ("summary-body"):
return False
icons = gtk.IconTheme()
app_icon = "dewdrop"
try:
assert icons.has_icon(app_icon)
except AssertionError:
app_icon = "/tmp/dewdrop.png"
icon = pkg_resources.resource_string(__name__, 'windows/resources/tray/white.png')
f = open(app_icon, "w")
f.write(icon)
f.close()
n = pynotify.Notification ("DewDrop", "Upload Complete: %s" % link, app_icon)
n.show()
def update(link):
if not pynotify.init ("summary-body"):
return False
icons = gtk.IconTheme()
app_icon = "dewdrop"
try:
assert icons.has_icon(app_icon)
except AssertionError:
app_icon = "/tmp/dewdrop.png"
icon = pkg_resources.resource_string(__name__, 'windows/resources/tray/white.png')
f = open(app_icon, "w")
f.write(icon)
f.close()
n = pynotify.Notification ("DewDrop", "Update Available: %s" % link, app_icon)
n.show()