Example #1
0
class AuthAgent(AppletPlugin):
    __description__ = _(
        "Provides passkey, authentication services for BlueZ daemon")
    __icon__ = "dialog-password"
    __author__ = "Walmis"
    __depends__ = ["StatusIcon"]

    _agent = None
    _last_event_time = 0

    @dbus.service.method('org.blueman.Applet', in_signature="u")
    def SetTimeHint(self, time):
        self._last_event_time = time

    def on_unload(self):
        if self._agent:
            self._agent.unregister_agent()
            self._agent = None

    def on_manager_state_changed(self, state):
        if state:
            self._agent = BluezAgent(lambda: self._last_event_time)
            self._agent.register_agent()
        else:
            # At this point bluez already called Release on the agent
            self._agent = None
Example #2
0
class AuthAgent(AppletPlugin):
    __description__ = _("Provides passkey, authentication services for BlueZ daemon")
    __icon__ = "dialog-password"
    __author__ = "Walmis"
    __depends__ = ["StatusIcon"]

    _agent = None
    _last_event_time = 0

    def on_load(self, applet):
        self.Applet = applet

    @dbus.service.method('org.blueman.Applet', in_signature="u")
    def SetTimeHint(self, time):
        self._last_event_time = time

    def on_unload(self):
        if self._agent:
            self._agent.unregister_agent()
            self._agent = None

    def on_manager_state_changed(self, state):
        if state:
            self._agent = BluezAgent(self.Applet.Plugins.StatusIcon, lambda: self._last_event_time)
            self._agent.register_agent()
        else:
            # At this point bluez already called Release on the agent
            self._agent = None
Example #3
0
 def on_manager_state_changed(self, state):
     if state:
         self._agent = BluezAgent(lambda: self._last_event_time)
         self._agent.register_agent()
     else:
         # At this point bluez already called Release on the agent
         self._agent = None
Example #4
0
 def on_manager_state_changed(self, state: bool) -> None:
     if state:
         self._agent = BluezAgent()
         self._agent.register_agent()
     else:
         # At this point bluez already called Release on the agent
         self._agent = None
Example #5
0
class AuthAgent(AppletPlugin):
    __description__ = _(
        "Provides passkey, authentication services for BlueZ daemon")
    __icon__ = "dialog-password"
    __author__ = "Walmis"
    __depends__ = ["StatusIcon"]

    _agent = None
    _last_event_time = 0

    def on_load(self, applet):
        self.Applet = applet

    @dbus.service.method('org.blueman.Applet', in_signature="u")
    def SetTimeHint(self, time):
        self._last_event_time = time

    def on_unload(self):
        self._remove_agent()

    def on_manager_state_changed(self, state):
        if state:
            self._agent = BluezAgent(self.Applet.Plugins.StatusIcon,
                                     lambda: self._last_event_time)
        else:
            self._remove_agent()

    def _remove_agent(self):
        if self._agent:
            self._agent._on_release()
            del self._agent
Example #6
0
 def on_manager_state_changed(self, state):
     if state:
         self._agent = BluezAgent(self.Applet.Plugins.StatusIcon, lambda: self._last_event_time)
         self._agent.register_agent()
     else:
         # At this point bluez already called Release on the agent
         self._agent = None
Example #7
0
 def on_manager_state_changed(self, state):
     if state:
         self._agent = BluezAgent()
         self._agent.register_agent()
     else:
         # At this point bluez already called Release on the agent
         self._agent = None
Example #8
0
class AuthAgent(AppletPlugin):
    __description__ = _("Provides passkey, authentication services for BlueZ daemon")
    __icon__ = "dialog-password"
    __author__ = "Walmis"
    __depends__ = ["StatusIcon"]

    _agent = None

    def on_unload(self):
        if self._agent:
            self._agent.unregister_agent()
            self._agent = None

    def on_manager_state_changed(self, state):
        if state:
            self._agent = BluezAgent()
            self._agent.register_agent()
        else:
            # At this point bluez already called Release on the agent
            self._agent = None
Example #9
0
class AuthAgent(AppletPlugin):
    __description__ = _("Provides passkey, authentication services for BlueZ daemon")
    __icon__ = "blueman-pair-symbolic"
    __author__ = "Walmis"
    __depends__ = ["StatusIcon"]

    _agent = None

    def on_unload(self) -> None:
        if self._agent:
            self._agent.unregister_agent()
            self._agent = None

    def on_manager_state_changed(self, state: bool) -> None:
        if state:
            self._agent = BluezAgent()
            self._agent.register_agent()
        else:
            # At this point bluez already called Release on the agent
            self._agent = None
Example #10
0
 def on_manager_state_changed(self, state):
     if state:
         self._agent = BluezAgent(self.Applet.Plugins.StatusIcon,
                                  lambda: self._last_event_time)
     else:
         self._remove_agent()