def __init__(self): print ('The dolphin reaches the surface!') SOCKET_NAME = '/tmp/bluemindo' self.classes = [] def handle_connection(source, condition): """This is the UNIX socket server.""" datagram = server.recv(1024) argv = loads(datagram) usercommand = argv[1] # PlayPause, Play or Pause if usercommand in ('--playpause', '--play', '--pause'): idle_add(extensions.load_event, 'OnPlayPressed') # Stop elif usercommand == '--stop': idle_add(extensions.load_event, 'OnStopPressed') # Next elif usercommand == '--next': idle_add(extensions.load_event, 'OnNextPressed') # Previous elif usercommand == '--previous': idle_add(extensions.load_event, 'OnPreviousPressed') # Quit Bluemindo elif usercommand in ('--quit', '--plunge'): functions.close_bluemindo(None) # The command isn't handled by any action else: print ('Received unknown event `%s`!' % usercommand) return True # Create the UNIX socket server server = socket(AF_UNIX, SOCK_DGRAM) server.bind(SOCKET_NAME) io_add_watch(server, IO_IN, handle_connection) # Store current process identifier (PID) bluemindo_pid = getpid() pid_filename = join(config.datadir, 'pid') pid_file = open(pid_filename, 'w') pid_file.write(str(bluemindo_pid)) pid_file.close() # Create the DBUS socket (MPRIS support) if OBJECT_NAME: bus = dbus_service.BusName(OBJECT_NAME, bus=SessionBus()) MPRIS(self, bus) # Start user interface extensions.load() gui = MainWindow(extensions) # Nothing can be done after that gui.start_thread()
def __init__(self, manager): bus = dbus.SessionBus() bus.request_name(BUS_NAME) bus_name = service.BusName(BUS_NAME, bus=bus) service.Object.__init__(self, bus_name, SERVICE_PATH) self.manager = manager self._capabilities = {'body'}
def __init__(self, set_as_default=True): DBusGMainLoop(set_as_default=set_as_default) self.session_bus = SessionBus() # WARNING, NO BORRAR la asignación a la variable name aunque ésta no se # use, sino Dbus restartea el servicio N veces una por cada reintento # del cliente. name = service.BusName(self.bus_name, self.session_bus) self._service_init() service.Object.__init__(self, self.session_bus, self.object_path) self._loop = MainLoop() try: self._loop.run() except KeyboardInterrupt: pass
def __init__(self, queue: NotificationQueue) -> None: super().__init__(object_path=NOTIFICATIONS_DBUS_OBJECT_PATH, bus_name=service.BusName( name=NOTIFICATIONS_DBUS_INTERFACE, bus=SessionBus(mainloop=DBusGMainLoop()))) self._queue: NotificationQueue = queue def notification_seen(notification): if 'default' in notification.actions: self.ActionInvoked(notification.id, 'default') self._queue.notification_seen += notification_seen def notification_closed(notification, reason): self.NotificationClosed(notification.id, reason) self._queue.notification_closed += notification_closed
def __init__(self): bus_name = service.BusName("org.jade.Desktop", dbus.SessionBus()) service.Object.__init__(self, bus_name, "/org/jade/Desktop")
def __init__(self): bus_name = service.BusName("io.jde.Desktop", dbus.SessionBus()) service.Object.__init__(self, bus_name, "/io/jde/Desktop")
def __init__(self, manager): bus_name = service.BusName(BUS_NAME, bus=dbus.SessionBus()) service.Object.__init__(self, bus_name, SERVICE_PATH) self.manager = manager