9 class panucciInterface(dbus
.service
.Object
):
10 """ Panucci's d-bus interface """
12 def __init__(self
, bus_name
, path
='/panucciInterface'):
13 self
.__log
= logging
.getLogger('panucci.dbusinterface.panucciInterface')
14 dbus
.service
.Object
.__init
__(self
, object_path
=path
, bus_name
=bus_name
)
18 self
.headset_device
= None
20 if util
.platform
== util
.MAEMO
:
21 headset_button
= dbus
.SystemBus().get_object(
22 'org.freedesktop.Hal', '/org/freedesktop/Hal/devices/'
23 'platform_retu_headset_logicaldev_input' )
24 self
.headset_device
= dbus
.Interface(
25 headset_button
, 'org.freedesktop.Hal.Device')
27 def register_player(self
, player
):
28 self
.__log
.debug('Registered player.')
31 def register_gui(self
, gui
):
32 self
.__log
.debug('Registered GUI.')
35 @dbus.service
.method('org.panucci.panucciInterface')
37 if self
.player
is not None: self
.player
.play()
39 @dbus.service
.method('org.panucci.panucciInterface')
41 if self
.player
is not None: self
.player
.pause()
43 @dbus.service
.method('org.panucci.panucciInterface')
45 if self
.player
is not None: self
.player
.stop()
47 @dbus.service
.method('org.panucci.panucciInterface')
49 if self
.player
is not None: self
.player
.play_pause_toggle()
51 @dbus.service
.method('org.panucci.panucciInterface', in_signature
='s')
52 def play_file(self
, filepath
):
53 if self
.player
is not None: self
.player
.play_file(filepath
)
55 @dbus.service
.method('org.panucci.panucciInterface', in_signature
='s')
56 def queue_file(self
, filepath
):
57 if self
.player
is not None: self
.player
.playlist
.append(filepath
)
59 @dbus.service
.method('org.panucci.panucciInterface', in_signature
='su')
60 def insert_file(self
, pos
, filepath
):
61 if self
.player
is not None: self
.player
.playlist
.insert(pos
, filepath
)
63 @dbus.service
.method('org.panucci.panucciInterface')
64 def show_main_window(self
):
65 if self
.gui
is not None: self
.gui
.show_main_window()
67 interface
= panucciInterface(
68 dbus
.service
.BusName('org.panucci.panucciInterface', dbus
.SessionBus()) )