comparison frontends/src/quick_frontend/quick_profile_manager.py @ 1489:039d96e131be

frontends: callback are now always used in QuickApp launchAction (before it was only used if validated is present): - actionManager is used by default (no callback provided) - in XMLUI, the dialog is closed before calling actionManager - if keys are not managed in resuling data, an exceptions is raised
author Goffi <goffi@goffi.org>
date Tue, 25 Aug 2015 14:41:42 +0200
parents 3265a2639182
children 1c5761cb1bdc
comparison
equal deleted inserted replaced
1488:66d01f29f886 1489:039d96e131be
94 94
95 @param profile_kes(iterable): profiles to connect 95 @param profile_kes(iterable): profiles to connect
96 """ 96 """
97 assert self._autoconnect 97 assert self._autoconnect
98 98
99 def authenticate_cb(callback_id, data, profile): 99 def authenticate_cb(data, cb_id, profile):
100 100
101 if C.bool(data['validated']): 101 if C.bool(data.pop('validated', C.BOOL_FALSE)):
102 self._autoconnect_profiles.append(profile) 102 self._autoconnect_profiles.append(profile)
103 if len(self._autoconnect_profiles) == len(profile_keys): 103 if len(self._autoconnect_profiles) == len(profile_keys):
104 # all the profiles have been validated 104 # all the profiles have been validated
105 self.host.plug_profiles(self._autoconnect_profiles) 105 self.host.plug_profiles(self._autoconnect_profiles)
106 else: 106 else:
107 # a profile is not validated, we go to manual mode 107 # a profile is not validated, we go to manual mode
108 self._autoconnect=False 108 self._autoconnect=False
109 self.host.actionManager(data, callback=authenticate_cb, profile=profile)
109 110
110 for profile_key in profile_keys: 111 for profile_key in profile_keys:
111 profile = self.host.bridge.getProfileName(profile_key) 112 profile = self.host.bridge.getProfileName(profile_key)
112 if not profile: 113 if not profile:
113 self._autoconnect = False # manual mode 114 self._autoconnect = False # manual mode