diff cagou/core/cagou_main.py @ 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 a77386b73e55
children 58e395c0777e
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