~muelnet/heybuddy/pulltimes

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
'''
this is a part of the heybuddy project
copyright 2010 jezra lickter http://www.jezra.net
'''
try:
	import pynotify
	has_pynotify = True
except:
	has_pynotify = False



class Notify():
	def __init__(self):
		pynotify.init('Heybuddy')

	def notify_send(self,summary,content):
		summary=summary
		content=content
		notify=pynotify.Notification(summary,content)
		if not notify.show():
			print _("Failed to show notification")

	def notify_updates(self,num_updates):
		summary=_("New updates in timeline")
		content=_("%d new dents in timeline") % (num_updates)
		self.notify_send(summary,content)

	def notify_reply(self,name,message):
		summary=_("%s wrote:") % (name)
		content=message
		self.notify_send(summary,content)
		
	def notify(self,updates,replies):
		summary=_("New updates in timeline")
		content=_("%d new dents in timeline, %d new @replies") % (updates,replies)
		self.notify_send(summary,content)