本文整理汇总了Python中blueman.gui.Notification.Notification._device方法的典型用法代码示例。如果您正苦于以下问题:Python Notification._device方法的具体用法?Python Notification._device怎么用?Python Notification._device使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blueman.gui.Notification.Notification
的用法示例。
在下文中一共展示了Notification._device方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Authorize
# 需要导入模块: from blueman.gui.Notification import Notification [as 别名]
# 或者: from blueman.gui.Notification.Notification import _device [as 别名]
def Authorize(self, device, uuid, ok, err):
def on_auth_action(n, action):
dprint(action)
#self.applet.status_icon.set_blinking(False)
if action == "always":
device = Bluez.Device(n._device)
device.set("Trusted", True)
if action == "always" or action == "accept":
ok()
else:
err(AgentErrorRejected())
self.n = None
dprint("Agent.Authorize")
alias = self.get_device_alias(device)
uuid16 = uuid128_to_uuid16(uuid)
service = uuid16_to_name(uuid16)
notify_message = (_("Authorization request for:") + "\n%s\n" + _("Service:") + " <b>%s</b>") % (alias, service)
actions = [["always", _("Always accept"), "blueman-trust"],
["accept", _("Accept"), "help-about"],
["deny", _("Deny"), "help-about"]]
n = Notification(_("Bluetooth Authentication"), notify_message, 0,
actions, on_auth_action,
pixbuf=get_icon("blueman", 48), status_icon=self.status_icon)
n._device = device
示例2: _on_authorize_service
# 需要导入模块: from blueman.gui.Notification import Notification [as 别名]
# 或者: from blueman.gui.Notification.Notification import _device [as 别名]
def _on_authorize_service(self, device, uuid, ok, err):
def on_auth_action(action):
logging.info(action)
if action == "always":
device = bluez.Device(n._device)
device.set("Trusted", True)
if action == "always" or action == "accept":
ok()
else:
err(BluezErrorRejected("Rejected"))
self.n = None
logging.info("Agent.Authorize")
dev_str = self.get_device_string(device)
service = ServiceUUID(uuid).name
notify_message = \
(_("Authorization request for:") + "\n%s\n" + _("Service:") + " <b>%s</b>") % (dev_str, service)
actions = [["always", _("Always accept")],
["accept", _("Accept")],
["deny", _("Deny")]]
n = Notification(_("Bluetooth Authentication"), notify_message, 0, actions, on_auth_action, icon_name="blueman")
n.show()
n._device = device
示例3: _on_authorize_service
# 需要导入模块: from blueman.gui.Notification import Notification [as 别名]
# 或者: from blueman.gui.Notification.Notification import _device [as 别名]
def _on_authorize_service(self, parameters, invocation):
def on_auth_action(action):
logging.info(action)
if action == "always":
device = Bluez.Device(n._device)
device.set("Trusted", True)
if action == "always" or action == "accept":
invocation.return_value(GLib.Variant('()', ()))
else:
invocation.return_dbus_error('org.bluez.Error.Rejected', 'Rejected')
self.n = None
device, uuid = parameters.unpack()
logging.info("Agent.Authorize")
dev_str = self.get_device_string(device)
service = ServiceUUID(uuid).name
notify_message = (_("Authorization request for:") + "\n%s\n" + _("Service:") + " <b>%s</b>") % (dev_str, service)
actions = [["always", _("Always accept")],
["accept", _("Accept")],
["deny", _("Deny")]]
n = Notification(_("Bluetooth Authentication"), notify_message, 0, actions, on_auth_action,
icon_name="blueman", pos_hint=self.status_icon.geometry)
n.show()
n._device = device
示例4: _on_authorize_service
# 需要导入模块: from blueman.gui.Notification import Notification [as 别名]
# 或者: from blueman.gui.Notification.Notification import _device [as 别名]
def _on_authorize_service(self, parameters, invocation):
def on_auth_action(n, action):
dprint(action)
#self.applet.status_icon.set_blinking(False)
if action == "always":
device = Bluez.Device(n._device)
device.set("Trusted", True)
if action == "always" or action == "accept":
invocation.return_value(GLib.Variant('()', ()))
else:
invocation.return_dbus_error('org.bluez.Error.Rejected', 'Rejected')
self.n = None
device, uuid = parameters.unpack()
dprint("Agent.Authorize")
alias = self.get_device_alias(device)
uuid16 = uuid128_to_uuid16(uuid)
service = uuid16_to_name(uuid16)
notify_message = (_("Authorization request for:") + "\n%s\n" + _("Service:") + " <b>%s</b>") % (alias, service)
actions = [["always", _("Always accept")],
["accept", _("Accept")],
["deny", _("Deny")]]
n = Notification(_("Bluetooth Authentication"), notify_message, 0,
actions, on_auth_action,
pixbuf=get_icon("blueman", 48), status_icon=self.status_icon)
n._device = device