当前位置: 首页>>代码示例>>Python>>正文


Python Notification._device方法代码示例

本文整理汇总了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
开发者ID:GreenLunar,项目名称:blueman,代码行数:31,代码来源:BluezAgent.py

示例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
开发者ID:blueman-project,项目名称:blueman,代码行数:28,代码来源:BluezAgent.py

示例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
开发者ID:cschramm,项目名称:blueman,代码行数:30,代码来源:BluezAgent.py

示例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
开发者ID:COLTONKERNS,项目名称:blueman,代码行数:32,代码来源:BluezAgent.py


注:本文中的blueman.gui.Notification.Notification._device方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。