comparison src/core/sat_main.py @ 1467:ceba6fd77739

core, bridge: new signal actionNew to launch an action from the backend (e.g. display a dialog message): - SAT.actionNew is a shortcut to call bridge.actionNew with a generated id. The id may be used in the future to ignore an action (e.g.: an action is sent to all frontends to accept a file, one of the frontend did manage the dialog, the other ones can then ignore this dialog), but is not used for now.
author Goffi <goffi@goffi.org>
date Tue, 18 Aug 2015 09:01:18 +0200
parents 176de79c8c39
children b233274e9a0f
comparison
equal deleted inserted replaced
1466:2184d5f496b5 1467:ceba6fd77739
38 from sat.stdui import ui_contact_list, ui_profile_manager 38 from sat.stdui import ui_contact_list, ui_profile_manager
39 from glob import glob 39 from glob import glob
40 from uuid import uuid4 40 from uuid import uuid4
41 import sys 41 import sys
42 import os.path 42 import os.path
43 import uuid
43 44
44 try: 45 try:
45 from collections import OrderedDict # only available from python 2.7 46 from collections import OrderedDict # only available from python 2.7
46 except ImportError: 47 except ImportError:
47 from ordereddict import OrderedDict 48 from ordereddict import OrderedDict
726 else: 727 else:
727 cb = client._waiting_conf[conf_id][-1] 728 cb = client._waiting_conf[conf_id][-1]
728 del client._waiting_conf[conf_id] 729 del client._waiting_conf[conf_id]
729 cb(conf_id, accepted, data, profile) 730 cb(conf_id, accepted, data, profile)
730 731
732 def actionNew(self, action_data, profile):
733 """Shortcut to bridge.actionNew which generate and id
734
735 @param action_data(dict): action data (see bridge documentation)
736 @param profile: %(doc_profile)s
737 """
738 id_ = unicode(uuid.uuid4())
739 self.bridge.actionNew(action_data, id_, profile)
740
731 def registerProgressCB(self, progress_id, CB, profile): 741 def registerProgressCB(self, progress_id, CB, profile):
732 """Register a callback called when progress is requested for id""" 742 """Register a callback called when progress is requested for id"""
733 client = self.getClient(profile) 743 client = self.getClient(profile)
734 client._progress_cb_map[progress_id] = CB 744 client._progress_cb_map[progress_id] = CB
735 745