frontends (xmlui): added a user_action attribute:
this attribute indicate if the data is a result of a user interaction or an event from the backend (in the later case, the frontend can choose to avoid interrupting the user). Internally (in XMLUI), "FROM_BACKEND" is added to XMLUI.flags if the UI result from a backend event.
This commit is contained in:
parent
a1d5ee167c
commit
0c83d13b7c
1 changed files with 10 additions and 3 deletions
|
|
@ -204,7 +204,7 @@ class MessageDialog(Dialog):
|
|||
|
||||
|
||||
class NoteDialog(Dialog):
|
||||
"""Dialog with a OK/Cancel type configuration"""
|
||||
"""Short message which doesn't need user confirmation to disappear"""
|
||||
pass
|
||||
|
||||
|
||||
|
|
@ -237,6 +237,7 @@ class XMLUIBase(object):
|
|||
@param title: force the title, or use XMLUI one if None
|
||||
@param flags: list of string which can be:
|
||||
- NO_CANCEL: the UI can't be cancelled
|
||||
- FROM_BACKEND: the UI come from backend (i.e. it's not the direct result of user operation)
|
||||
@param callback(callable, None): if not None, will be used with launchAction:
|
||||
- if None is used, default behaviour will be used (closing the dialog and calling host.actionManager)
|
||||
- if a callback is provided, it will be used instead, so you'll have to manage
|
||||
|
|
@ -253,6 +254,10 @@ class XMLUIBase(object):
|
|||
self.callback = callback or self._defaultCb
|
||||
self.profile = profile
|
||||
|
||||
@property
|
||||
def user_action(self):
|
||||
return "FROM_BACKEND" not in self.flags
|
||||
|
||||
def _defaultCb(self, data, cb_id, profile):
|
||||
# TODO: when XMLUI updates will be managed, the _xmluiClose
|
||||
# must be called only if there is not update
|
||||
|
|
|
|||
Loading…
Reference in a new issue