File: sample-python.py

package info (click to toggle)
rhythmbox 0.11.6-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 26,232 kB
  • ctags: 11,434
  • sloc: ansic: 97,824; xml: 36,080; sh: 9,341; python: 4,193; makefile: 2,130; cpp: 153
file content (27 lines) | stat: -rw-r--r-- 654 bytes parent folder | download | duplicates (3)
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
import rhythmdb, rb
import gobject, gtk

class SamplePython(rb.Plugin):

	def __init__(self):
		rb.Plugin.__init__(self)
			
	def activate(self, shell):
		print "activating sample python plugin"

		db = shell.get_property("db")
		model = db.query_model_new_empty()
		self.source = gobject.new (PythonSource, shell=shell, name=_("Python Source"), query_model=model)
		shell.append_source(self.source, None)
	
	def deactivate(self, shell):
		print "deactivating sample python plugin"
		self.source.delete_thyself()
		self.source = None


class PythonSource(rb.Source):
	def __init__(self):
		rb.Source.__init__(self)
		
gobject.type_register(PythonSource)