本文整理汇总了Python中pydbus.SessionBus方法的典型用法代码示例。如果您正苦于以下问题:Python pydbus.SessionBus方法的具体用法?Python pydbus.SessionBus怎么用?Python pydbus.SessionBus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pydbus
的用法示例。
在下文中一共展示了pydbus.SessionBus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __attrs_post_init__
# 需要导入模块: import pydbus [as 别名]
# 或者: from pydbus import SessionBus [as 别名]
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)
示例2: __attrs_post_init__
# 需要导入模块: import pydbus [as 别名]
# 或者: from pydbus import SessionBus [as 别名]
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)
示例3: __init__
# 需要导入模块: import pydbus [as 别名]
# 或者: from pydbus import SessionBus [as 别名]
def __init__(self):
self._bus = pydbus.SessionBus()
示例4: run
# 需要导入模块: import pydbus [as 别名]
# 或者: from pydbus import SessionBus [as 别名]
def run(self):
"""
Publish the service
"""
self._bus = SessionBus()
self._bus.publish('org.chemlab.UChroma', self)
示例5: __init__
# 需要导入模块: import pydbus [as 别名]
# 或者: from pydbus import SessionBus [as 别名]
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
示例6: __init__
# 需要导入模块: import pydbus [as 别名]
# 或者: from pydbus import SessionBus [as 别名]
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)
示例7: run
# 需要导入模块: import pydbus [as 别名]
# 或者: from pydbus import SessionBus [as 别名]
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')