comparison sat_frontends/quick_frontend/quick_app.py @ 2899:5b0f897689b7

quick frontend (app): (un)set sync state on (dis)connect: when connected signal is received, a whole (re)connection has happened, meaning that everything is potentially out of sync (opened widget and contact lists), so host.sync is set accordingly. It's a temporary option, as (dis)connect is a per-profile signal, and host.sync is global. Methods similar to sync workflow must be implemented on a per-profile basis.
author Goffi <goffi@goffi.org>
date Sun, 07 Apr 2019 21:09:49 +0200
parents fc78d53f0ffa
children 49458e12e414
comparison
equal deleted inserted replaced
2898:fc78d53f0ffa 2899:5b0f897689b7
694 as the resource might differ from the JID we asked for. 694 as the resource might differ from the JID we asked for.
695 """ 695 """
696 log.debug(_("Connected")) 696 log.debug(_("Connected"))
697 self.profiles[profile].whoami = jid.JID(jid_s) 697 self.profiles[profile].whoami = jid.JID(jid_s)
698 self.setPresenceStatus(profile=profile) 698 self.setPresenceStatus(profile=profile)
699 # FIXME: fill() is already called for all profiles when doing self.sync = True
700 # a per-profile fill() should be done once, see below note
699 self.contact_lists[profile].fill() 701 self.contact_lists[profile].fill()
702 # if we were already displaying widgets, they must be resynchronized
703 # FIXME: self.sync is for all profiles
704 # while (dis)connection is per-profile.
705 # A mechanism similar to sync should be available
706 # on a per-profile basis
707 self.sync = True
700 708
701 def disconnectedHandler(self, profile): 709 def disconnectedHandler(self, profile):
702 """called when the connection is closed""" 710 """called when the connection is closed"""
703 log.debug(_("Disconnected")) 711 log.debug(_("Disconnected"))
704 self.contact_lists[profile].disconnect() 712 self.contact_lists[profile].disconnect()
713 # FIXME: see note on connectedHandler
714 self.sync = False
705 self.setPresenceStatus(C.PRESENCE_UNAVAILABLE, "", profile=profile) 715 self.setPresenceStatus(C.PRESENCE_UNAVAILABLE, "", profile=profile)
706 716
707 def actionNewHandler(self, action_data, id_, security_limit, profile): 717 def actionNewHandler(self, action_data, id_, security_limit, profile):
708 self.actionManager(action_data, user_action=False, profile=profile) 718 self.actionManager(action_data, user_action=False, profile=profile)
709 719