annotate libervia/desktop_kivy/plugins/plugin_wid_remote.py @ 499:f387992d8e37

plugins: new "call" plugin for A/V calls: this is the base implementation for calls plugin, handling one2one calls. For now, the interface is very basic, call is done by specifying the bare jid of the destinee, then press the "call" button. Incoming calls are automatically accepted. rel 424
author Goffi <goffi@goffi.org>
date Wed, 04 Oct 2023 22:54:36 +0200
parents b3cedbee561d
children 196483685a63
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
379
1da3c379205b fixed shebangs
Goffi <goffi@goffi.org>
parents: 378
diff changeset
1 #!/usr/bin/env python3
1da3c379205b fixed shebangs
Goffi <goffi@goffi.org>
parents: 378
diff changeset
2
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
493
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
4 #Libervia Desktop-Kivy
461
3c9ba4a694ef dates update
Goffi <goffi@goffi.org>
parents: 404
diff changeset
5 # Copyright (C) 2016-2021 Jérôme Poisson (goffi@goffi.org)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
19
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
20
493
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
21 from libervia.backend.core import log as logging
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
22 from libervia.backend.core.i18n import _
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
23 from libervia.frontends.quick_frontend import quick_widgets
404
f7476818f9fb core (common): JidSelector + behaviors various improvments:
Goffi <goffi@goffi.org>
parents: 379
diff changeset
24 from ..core import cagou_widget
f7476818f9fb core (common): JidSelector + behaviors various improvments:
Goffi <goffi@goffi.org>
parents: 379
diff changeset
25 from ..core.constants import Const as C
f7476818f9fb core (common): JidSelector + behaviors various improvments:
Goffi <goffi@goffi.org>
parents: 379
diff changeset
26 from ..core.behaviors import TouchMenuBehavior, FilterBehavior
f7476818f9fb core (common): JidSelector + behaviors various improvments:
Goffi <goffi@goffi.org>
parents: 379
diff changeset
27 from ..core.common_widgets import (Identities, ItemWidget, DeviceWidget,
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 CategorySeparator)
493
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
29 from libervia.backend.tools.common import template_xmlui
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
30 from libervia.backend.tools.common import data_format
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
31 from libervia.desktop_kivy.core import xmlui
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
32 from libervia.frontends.tools import jid
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
33 from kivy import properties
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
34 from kivy.uix.label import Label
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
35 from kivy.uix.boxlayout import BoxLayout
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
36 from kivy.uix.floatlayout import FloatLayout
493
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
37 from libervia.desktop_kivy import G
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 from functools import partial
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
39
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
40
322
e2b51663d8b8 core, android: new share widget + added Cagou to "share" menu:
Goffi <goffi@goffi.org>
parents: 312
diff changeset
41 log = logging.getLogger(__name__)
e2b51663d8b8 core, android: new share widget + added Cagou to "share" menu:
Goffi <goffi@goffi.org>
parents: 312
diff changeset
42
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
43 PLUGIN_INFO = {
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
44 "name": _("remote control"),
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
45 "main": "RemoteControl",
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
46 "description": _("universal remote control"),
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
47 "icon_symbol": "signal",
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
48 }
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
49
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
50 NOTE_TITLE = _("Media Player Remote Control")
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
51
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
52
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
53 class RemoteItemWidget(ItemWidget):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
54
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
55 def __init__(self, device_jid, node, name, main_wid, **kw):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
56 self.device_jid = device_jid
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
57 self.node = node
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
58 super(RemoteItemWidget, self).__init__(name=name, main_wid=main_wid, **kw)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
59
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
60 def do_item_action(self, touch):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
61 self.main_wid.layout.clear_widgets()
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
62 player_wid = MediaPlayerControlWidget(main_wid=self.main_wid, remote_item=self)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
63 self.main_wid.layout.add_widget(player_wid)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
64
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
65
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
66 class MediaPlayerControlWidget(BoxLayout):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
67 main_wid = properties.ObjectProperty()
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
68 remote_item = properties.ObjectProperty()
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
69 status = properties.OptionProperty("play", options=("play", "pause", "stop"))
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
70 title = properties.StringProperty()
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
71 identity = properties.StringProperty()
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
72 command = properties.DictProperty()
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
73 ui_tpl = properties.ObjectProperty()
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
74
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
75 @property
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
76 def profile(self):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
77 return self.main_wid.profile
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
78
492
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
79 def update_ui(self, action_data_s):
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
80 action_data = data_format.deserialise(action_data_s)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
81 xmlui_raw = action_data['xmlui']
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
82 ui_tpl = template_xmlui.create(G.host, xmlui_raw)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
83 self.ui_tpl = ui_tpl
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
84 for prop in ('Title', 'Identity'):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
85 try:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
86 setattr(self, prop.lower(), ui_tpl.widgets[prop].value)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
87 except KeyError:
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
88 log.warning(_("Missing field: {name}").format(name=prop))
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
89 playback_status = self.ui_tpl.widgets['PlaybackStatus'].value
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
90 if playback_status == "Playing":
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
91 self.status = "pause"
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
92 elif playback_status == "Paused":
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
93 self.status = "play"
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
94 elif playback_status == "Stopped":
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
95 self.status = "play"
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
96 else:
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
97 G.host.add_note(
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
98 title=NOTE_TITLE,
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
99 message=_("Unknown playback status: playback_status")
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
100 .format(playback_status=playback_status),
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
101 level=C.XMLUI_DATA_LVL_WARNING)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
102 self.commands = {v:k for k,v in ui_tpl.widgets['command'].options}
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
103
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
104 def ad_hoc_run_cb(self, xmlui_raw):
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
105 ui_tpl = template_xmlui.create(G.host, xmlui_raw)
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
106 data = {xmlui.XMLUIPanel.escape("media_player"): self.remote_item.node,
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
107 "session_id": ui_tpl.session_id}
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
108 G.host.bridge.action_launch(
492
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
109 ui_tpl.submit_id, data_format.serialise(data),
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
110 self.profile, callback=self.update_ui,
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
111 errback=self.main_wid.errback
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
112 )
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
113
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
114 def on_remote_item(self, __, remote):
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
115 NS_MEDIA_PLAYER = G.host.ns_map["mediaplayer"]
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
116 G.host.bridge.ad_hoc_run(str(remote.device_jid), NS_MEDIA_PLAYER, self.profile,
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
117 callback=self.ad_hoc_run_cb,
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
118 errback=self.main_wid.errback)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
119
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
120 def do_cmd(self, command):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
121 try:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
122 cmd_value = self.commands[command]
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
123 except KeyError:
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
124 G.host.add_note(
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
125 title=NOTE_TITLE,
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
126 message=_("{command} command is not managed").format(command=command),
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
127 level=C.XMLUI_DATA_LVL_WARNING)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
128 else:
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
129 data = {xmlui.XMLUIPanel.escape("command"): cmd_value,
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
130 "session_id": self.ui_tpl.session_id}
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
131 # hidden values are normally transparently managed by XMLUIPanel
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
132 # but here we have to add them by hand
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
133 hidden = {xmlui.XMLUIPanel.escape(k):v
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
134 for k,v in self.ui_tpl.hidden.items()}
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
135 data.update(hidden)
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
136 G.host.bridge.action_launch(
492
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
137 self.ui_tpl.submit_id, data_format.serialise(data), self.profile,
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
138 callback=self.update_ui, errback=self.main_wid.errback
5114bbb5daa3 plugin remove: update `action_launch` call following changes in bridge API
Goffi <goffi@goffi.org>
parents: 491
diff changeset
139 )
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
140
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
141
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
142 class RemoteDeviceWidget(DeviceWidget):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
143
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
144 def xmlui_cb(self, data, cb_id, profile):
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
145 if 'xmlui' in data:
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
146 xml_ui = xmlui.create(
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
147 G.host, data['xmlui'], callback=self.xmlui_cb, profile=profile)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
148 if isinstance(xml_ui, xmlui.XMLUIDialog):
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
149 self.main_wid.show_root_widget()
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
150 xml_ui.show()
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
151 else:
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
152 xml_ui.set_close_cb(self.on_close)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
153 self.main_wid.layout.add_widget(xml_ui)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
154 else:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
155 if data:
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
156 log.warning(_("Unhandled data: {data}").format(data=data))
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
157 self.main_wid.show_root_widget()
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
158
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
159 def on_close(self, __, reason):
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
160 if reason == C.XMLUI_DATA_CANCELLED:
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
161 self.main_wid.show_root_widget()
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
162 else:
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
163 self.main_wid.layout.clear_widgets()
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
164
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
165 def ad_hoc_run_cb(self, data):
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
166 xml_ui = xmlui.create(G.host, data, callback=self.xmlui_cb, profile=self.profile)
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
167 xml_ui.set_close_cb(self.on_close)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
168 self.main_wid.layout.add_widget(xml_ui)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
169
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
170 def do_item_action(self, touch):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
171 self.main_wid.layout.clear_widgets()
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
172 G.host.bridge.ad_hoc_run(str(self.entity_jid), '', self.profile,
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
173 callback=self.ad_hoc_run_cb, errback=self.main_wid.errback)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
174
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
175
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
176 class DevicesLayout(FloatLayout):
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
177 """Layout used to show devices"""
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
178 layout = properties.ObjectProperty()
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
179
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
180
493
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
181 class RemoteControl(quick_widgets.QuickWidget, cagou_widget.LiberviaDesktopKivyWidget, FilterBehavior,
404
f7476818f9fb core (common): JidSelector + behaviors various improvments:
Goffi <goffi@goffi.org>
parents: 379
diff changeset
182 TouchMenuBehavior):
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
183 SINGLE=False
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
184 layout = properties.ObjectProperty()
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
185
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
186 def __init__(self, host, target, profiles):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
187 quick_widgets.QuickWidget.__init__(self, host, target, profiles)
493
b3cedbee561d refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents: 492
diff changeset
188 cagou_widget.LiberviaDesktopKivyWidget.__init__(self)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
189 FilterBehavior.__init__(self)
404
f7476818f9fb core (common): JidSelector + behaviors various improvments:
Goffi <goffi@goffi.org>
parents: 379
diff changeset
190 TouchMenuBehavior.__init__(self)
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
191 self.stack_layout = None
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
192 self.show_root_widget()
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
193
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
194 def errback(self, failure_):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
195 """Generic errback which add a warning note and go back to root widget"""
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
196 G.host.add_note(
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
197 title=NOTE_TITLE,
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
198 message=_("Can't use remote control: {reason}").format(reason=failure_),
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
199 level=C.XMLUI_DATA_LVL_WARNING)
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
200 self.show_root_widget()
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
201
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
202 def key_input(self, window, key, scancode, codepoint, modifier):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
203 if key == 27:
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
204 self.show_root_widget()
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
205 return True
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
206
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
207 def show_root_widget(self):
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
208 self.layout.clear_widgets()
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
209 devices_layout = DevicesLayout()
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
210 self.stack_layout = devices_layout.layout
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
211 self.layout.add_widget(devices_layout)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
212 found = []
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
213 self.get_remotes(found)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
214 self.discover_devices(found)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
215
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
216 def ad_hoc_remotes_get_cb(self, remotes_data, found):
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
217 found.insert(0, remotes_data)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
218 if len(found) == 2:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
219 self.show_devices(found)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
220
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
221 def ad_hoc_remotes_get_eb(self, failure_, found):
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
222 G.host.errback(failure_, title=_("discovery error"),
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
223 message=_("can't check remote controllers: {msg}"))
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
224 found.insert(0, [])
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
225 if len(found) == 2:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
226 self.show_devices(found)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
227
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
228 def get_remotes(self, found):
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
229 self.host.bridge.ad_hoc_remotes_get(
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
230 self.profile,
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
231 callback=partial(self.ad_hoc_remotes_get_cb, found=found),
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
232 errback=partial(self.ad_hoc_remotes_get_eb,found=found))
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
233
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
234 def _disco_find_by_features_cb(self, data, found):
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
235 found.append(data)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
236 if len(found) == 2:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
237 self.show_devices(found)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
238
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
239 def _disco_find_by_features_eb(self, failure_, found):
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
240 G.host.errback(failure_, title=_("discovery error"),
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
241 message=_("can't check devices: {msg}"))
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
242 found.append(({}, {}, {}))
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
243 if len(found) == 2:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
244 self.show_devices(found)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
245
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
246 def discover_devices(self, found):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
247 """Looks for devices handling file "File Information Sharing" and display them"""
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
248 try:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
249 namespace = self.host.ns_map['commands']
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
250 except KeyError:
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
251 msg = _("can't find ad-hoc commands namespace, is the plugin running?")
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
252 log.warning(msg)
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
253 G.host.add_note(_("missing plugin"), msg, C.XMLUI_DATA_LVL_ERROR)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
254 return
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
255 self.host.bridge.disco_find_by_features(
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
256 [namespace], [], False, True, True, True, False, self.profile,
491
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
257 callback=partial(self._disco_find_by_features_cb, found=found),
203755bbe0fe massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 461
diff changeset
258 errback=partial(self._disco_find_by_features_eb, found=found))
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
259
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
260 def show_devices(self, found):
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
261 remotes_data, (entities_services, entities_own, entities_roster) = found
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
262 if remotes_data:
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
263 title = _("media players remote controls")
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
264 self.stack_layout.add_widget(CategorySeparator(text=title))
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
265
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
266 for remote_data in remotes_data:
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
267 device_jid, node, name = remote_data
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
268 wid = RemoteItemWidget(device_jid, node, name, self)
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
269 self.stack_layout.add_widget(wid)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
270
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
271 for entities_map, title in ((entities_services,
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
272 _('services')),
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
273 (entities_own,
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
274 _('your devices')),
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
275 (entities_roster,
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
276 _('your contacts devices'))):
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
277 if entities_map:
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
278 self.stack_layout.add_widget(CategorySeparator(text=title))
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
279 for entity_str, entity_ids in entities_map.items():
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
280 entity_jid = jid.JID(entity_str)
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
281 item = RemoteDeviceWidget(
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
282 self, entity_jid, Identities(entity_ids))
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
283 self.stack_layout.add_widget(item)
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
284 if (not remotes_data and not entities_services and not entities_own
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
285 and not entities_roster):
305
b2727877bad4 remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
286 self.stack_layout.add_widget(Label(
238
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
287 size_hint=(1, 1),
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
288 halign='center',
7918a5668304 plugin remote: remote controllers plugin first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
289 text_size=self.size,
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 306
diff changeset
290 text=_("No sharing device found")))