本文整理匯總了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')