changeset 363:816a0c880f52

core: use selected widget from main screen in getWidgetToSwitch: if we are not on "main" screen, selected_widget may not refer to a widget that we want to change. To avoid that, getWidgetToSwitch check and use `_selected_widget_main` if suitable. In other words, a widget from "main" screen will be returned and switched, even if we are on a other screen (e.g. if on "extra", if a widget like ShareWidget is shown).
author Goffi <goffi@goffi.org>
date Mon, 27 Jan 2020 21:17:08 +0100
parents e1f56257cabc
children a1f3af7c0b67
files cagou/core/cagou_main.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Mon Jan 27 21:17:08 2020 +0100
+++ b/cagou/core/cagou_main.py	Mon Jan 27 21:17:08 2020 +0100
@@ -873,7 +873,10 @@
 
         @return (CagouWidget): widget to switch
         """
-        if self.selected_widget is not None:
+        if self._selected_widget_main is not None:
+            # we are not on the main screen, we want to switch a widget from main screen
+            return self._selected_widget_main
+        elif self.selected_widget is not None:
             return self.selected_widget
         # no widget is selected we check if we have any default widget
         default_cls = self.default_class