Mercurial > libervia-desktop-kivy
comparison libervia/desktop_kivy/plugins/plugin_wid_calls.py @ 512:644a8d165e5a
plugin calls: use the new binding feature of webrtc module:
the new binding feature is used to update the "Desktop" button if sharing is cancelled by
user, or stopped somehow.
rel 434
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 18 Jan 2024 23:31:29 +0100 |
parents | 97ab236e8f20 |
children | d78728d7fd6a |
comparison
equal
deleted
inserted
replaced
511:290b405940b5 | 512:644a8d165e5a |
---|---|
104 test_mode: bool = False | 104 test_mode: bool = False |
105 | 105 |
106 PROXIED_PROPERTIES = { | 106 PROXIED_PROPERTIES = { |
107 'audio_muted', 'callee', 'desktop_sharing', 'sid', 'video_muted', 'desktop_sharing_data' | 107 'audio_muted', 'callee', 'desktop_sharing', 'sid', 'video_muted', 'desktop_sharing_data' |
108 } | 108 } |
109 PROXIED_METHODS = {'answer_call', 'end_call', 'on_accepted_call', 'on_ice_candidates_new', 'setup_call', 'start_pipeline'} | 109 PROXIED_METHODS = {'answer_call', 'bind', 'end_call', 'on_accepted_call', 'on_ice_candidates_new', 'setup_call', 'start_pipeline'} |
110 | 110 |
111 def __init__(self, parent_calls: "Calls", profile: str) -> None: | 111 def __init__(self, parent_calls: "Calls", profile: str) -> None: |
112 self.parent_calls = parent_calls | 112 self.parent_calls = parent_calls |
113 self.profile = profile | 113 self.profile = profile |
114 self.webrtc = webrtc.WebRTC( | 114 self.webrtc = webrtc.WebRTC( |
241 buf.unmap(mapinfo) | 241 buf.unmap(mapinfo) |
242 finally: | 242 finally: |
243 if buf is not None and mapinfo is not None: | 243 if buf is not None and mapinfo is not None: |
244 buf.unmap(mapinfo) | 244 buf.unmap(mapinfo) |
245 | 245 |
246 | |
246 class WindowSelectButton(Button): | 247 class WindowSelectButton(Button): |
247 pass | 248 pass |
248 | 249 |
249 | 250 |
250 class DesktopScreenDialog(Popup): | 251 class DesktopScreenDialog(Popup): |
299 call_btn = CallButton( | 300 call_btn = CallButton( |
300 parent_widget=self, on_press=lambda *__: aio.run_async(self.toggle_call()) | 301 parent_widget=self, on_press=lambda *__: aio.run_async(self.toggle_call()) |
301 ) | 302 ) |
302 self.header_input_add_extra(call_btn) | 303 self.header_input_add_extra(call_btn) |
303 self.webrtc = WebRTC(self, self.profile) | 304 self.webrtc = WebRTC(self, self.profile) |
305 self.webrtc.bind( | |
306 desktop_sharing=partial(setattr, self, "desktop_sharing") | |
307 ) | |
304 self.previous_fullscreen = None | 308 self.previous_fullscreen = None |
305 self.reset_instance() | 309 self.reset_instance() |
306 | 310 |
307 @property | 311 @property |
308 def sid(self): | 312 def sid(self): |
417 | 421 |
418 def on_desktop_btn_press(self) -> None: | 422 def on_desktop_btn_press(self) -> None: |
419 if self.desktop_sharing: | 423 if self.desktop_sharing: |
420 self.desktop_sharing = False | 424 self.desktop_sharing = False |
421 else: | 425 else: |
422 DesktopScreenDialog(self).open() | 426 if display_servers.detect() == display_servers.X11: |
427 DesktopScreenDialog(self).open() | |
428 else: | |
429 self.desktop_sharing = True | |
423 | 430 |
424 def on_desktop_sharing(self, instance, active: bool) -> None: | 431 def on_desktop_sharing(self, instance, active: bool) -> None: |
425 self.webrtc.desktop_sharing = active | 432 self.webrtc.desktop_sharing = active |
426 | 433 |
427 def on_fullscreen(self, instance, fullscreen: bool) -> None: | 434 def on_fullscreen(self, instance, fullscreen: bool) -> None: |