Python pydbus.SessionBus() Examples

The following are 7 code examples of pydbus.SessionBus(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pydbus , or try the search function .
Example #1
Source File: panctl.py    From pantalaimon with Apache License 2.0 6 votes vote down vote up
def __attrs_post_init__(self):
        self.bus = SessionBus()
        self.pan_bus = self.bus.get("org.pantalaimon1")

        self.ctl = self.pan_bus["org.pantalaimon1.control"]
        self.devices = self.pan_bus["org.pantalaimon1.devices"]

        self.own_message_ids = []

        self.ctl.Response.connect(self.show_response)
        self.ctl.UnverifiedDevices.connect(self.unverified_devices)

        self.completer = PanCompleter(self.commands, self.ctl, self.devices)

        self.devices.VerificationInvite.connect(self.show_sas_invite)
        self.devices.VerificationString.connect(self.show_sas)
        self.devices.VerificationDone.connect(self.sas_done)

        self.devices.KeyRequest.connect(self.show_key_request)
        self.devices.KeyRequestCancel.connect(self.show_key_request_cancel) 
Example #2
Source File: ui.py    From pantalaimon with Apache License 2.0 5 votes vote down vote up
def __attrs_post_init__(self):
            self.loop = None

            id_counter = IdCounter()

            self.control_if = Control(self.send_queue, self.server_list, id_counter)
            self.device_if = Devices(self.send_queue, id_counter)

            self.bus = SessionBus()
            self.bus.publish("org.pantalaimon1", self.control_if, self.device_if) 
Example #3
Source File: dbus_client.py    From uchroma with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self._bus = pydbus.SessionBus() 
Example #4
Source File: dbus.py    From uchroma with GNU Lesser General Public License v3.0 5 votes vote down vote up
def run(self):
        """
        Publish the service
        """
        self._bus = SessionBus()
        self._bus.publish('org.chemlab.UChroma', self) 
Example #5
Source File: power.py    From uchroma with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self._logger = Log.get('uchroma.power')
        self._name_watchers = []
        self._running = False
        self._sleeping = False
        self._user_active = False

        self._session_bus = SessionBus()
        self._system_bus = SystemBus()
        self._dm = UChromaDeviceManager() #singleton 
Example #6
Source File: subprocess_manager.py    From vexbot with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self.session_bus_available = True
        try:
            self.bus = _SessionBus()
        # NOTE: GError from package `gi`
        except Exception:
            # No session bus if we're here. Depending on linux distro, that's
            # not surprising
            self.session_bus_available = False

        # TODO: It's possible that the user is on a system that is not using
        # systemd, which means that this next call will fail. Should probably
        # have a try/catch and then just default to not having a subprocess
        # manager if that happens.
        self.system_bus = _SystemBus()

        # TODO: Verify that we can start services as the system bus w/o root
        # permissions
        if self.session_bus_available:
            self.systemd = self.bus.get('.systemd1')
        else:
            self.systemd = self.system_bus.get('.systemd1')

        # atexit.register(self._close_subprocesses)
        # signal.signal(signal.SIGINT, self._handle_close_signal)
        # signal.signal(signal.SIGTERM, self._handle_close_signal) 
Example #7
Source File: __init__.py    From signal-curses with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        log('message thread')

        if self.app.state.bus == 'system':
            self.bus = pydbus.SystemBus()
        else:
            self.bus = pydbus.SessionBus()

        log('waiting for ({}) dbus...'.format(self.app.state.bus))
        self.signal = exception_waitloop(self.get_message_bus, GLib.Error, 60)
        if not self.signal:
            log('dbus err')
            npyscreen.notify_wait('Unable to get signal {} bus. Messaging functionality will not function.'.format(
                self.app.state.bus), title='Error in SignalDaemonThread')
            exit(1)
        log('got dbus')
        # self.signal.onMessageReceived

        while True:
            item = self.queue.get()
            log('queue item', item)
            if 'exit' in item:
                break
            self.do_action(**item)
            self.queue.task_done()
        log('message thread exit')