File: DBusService.py

package info (click to toggle)
scribes 0.4~r543-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 6,836 kB
  • ctags: 6,779
  • sloc: python: 32,963; perl: 2,747; xml: 2,233; sh: 847; makefile: 597
file content (26 lines) | stat: -rw-r--r-- 847 bytes parent folder | download
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
from dbus.service import Object, method, BusName, signal

indexer_dbus_service = "org.sourceforge.ScribesWordCompletionIndexer"
indexer_dbus_path = "/org/sourceforge/ScribesWordCompletionIndexer"

class DBusService(Object):

	def __init__(self, manager):
		from SCRIBES.Globals import session_bus
		bus_name = BusName(indexer_dbus_service, bus=session_bus)
		Object.__init__(self, bus_name, indexer_dbus_path)
		self.__manager = manager
		manager.connect("finished", self.__finished_cb)

	@method(indexer_dbus_service, in_signature="sx")
	def process(self, text, id_):
		return self.__manager.process(text, id_)

	@signal(indexer_dbus_service, signature="xa{sx}")
	def finished(self, id_, dictionary):
		return # return

	def __finished_cb(self, manager, data):
		editor_id, dictionary = data
		self.finished(editor_id, dictionary)
		return False