# HG changeset patch # User Goffi # Date 1439881278 -7200 # Node ID ceba6fd777394a0186b77b2249c299e316901a1e # Parent 2184d5f496b5ddbf3aadd426ac47acb3cc7c9f83 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. diff -r 2184d5f496b5 -r ceba6fd77739 src/bridge/DBus.py --- a/src/bridge/DBus.py Tue Aug 18 09:01:18 2015 +0200 +++ b/src/bridge/DBus.py Tue Aug 18 09:01:18 2015 +0200 @@ -126,6 +126,11 @@ pass @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, + signature='a{ss}ss') + def actionNew(self, action_data, id, profile): + pass + + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ssa{ss}s') def actionResult(self, answer_type, id, data, profile): pass @@ -546,6 +551,9 @@ self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus) self.dbus_bridge = DbusObject(self.session_bus, const_OBJ_PATH) + def actionNew(self, action_data, id, profile): + self.dbus_bridge.actionNew(action_data, id, profile) + def actionResult(self, answer_type, id, data, profile): self.dbus_bridge.actionResult(answer_type, id, data, profile) diff -r 2184d5f496b5 -r ceba6fd77739 src/bridge/bridge_constructor/bridge_template.ini --- a/src/bridge/bridge_constructor/bridge_template.ini Tue Aug 18 09:01:18 2015 +0200 +++ b/src/bridge/bridge_constructor/bridge_template.ini Tue Aug 18 09:01:18 2015 +0200 @@ -109,6 +109,18 @@ doc_param_2=data: conf_type dependent data doc_param_3=%(doc_profile)s +[actionNew] +type=signal +category=core +sig_in=a{ss}ss +doc=A frontend action is requested +doc_param_0=action_data: a dict where key can be: + - xmlui: a XMLUI need to be displayed +doc_param_1=id: action id + This id can be used later by frontends to announce to other ones + That the action is managed and can now be ignored. +doc_param_2=%(doc_profile)s + [actionResult] deprecated= type=signal diff -r 2184d5f496b5 -r ceba6fd77739 src/core/sat_main.py --- a/src/core/sat_main.py Tue Aug 18 09:01:18 2015 +0200 +++ b/src/core/sat_main.py Tue Aug 18 09:01:18 2015 +0200 @@ -40,6 +40,7 @@ from uuid import uuid4 import sys import os.path +import uuid try: from collections import OrderedDict # only available from python 2.7 @@ -728,6 +729,15 @@ del client._waiting_conf[conf_id] cb(conf_id, accepted, data, profile) + def actionNew(self, action_data, profile): + """Shortcut to bridge.actionNew which generate and id + + @param action_data(dict): action data (see bridge documentation) + @param profile: %(doc_profile)s + """ + id_ = unicode(uuid.uuid4()) + self.bridge.actionNew(action_data, id_, profile) + def registerProgressCB(self, progress_id, CB, profile): """Register a callback called when progress is requested for id""" client = self.getClient(profile)