Mercurial > libervia-backend
diff sat_frontends/primitivus/primitivus @ 3004:d86cddc1cd05
primitivus: select the widget even if an other one is selected when the selection comes from an user action:
new `user_action` arguments has been added to newWidget to specify when the new widget
comes from a direct user action.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 14 Jul 2019 20:38:34 +0200 |
parents | ce52ac2fe213 |
children | 595b8857538b |
line wrap: on
line diff
--- a/sat_frontends/primitivus/primitivus Sun Jul 14 16:43:04 2019 +0200 +++ b/sat_frontends/primitivus/primitivus Sun Jul 14 20:38:34 2019 +0200 @@ -640,10 +640,17 @@ self.x_notify.sendNotification(message) - def newWidget(self, widget): + def newWidget(self, widget, user_action=False): + """Method called when a new widget is created + + if suitable, the widget will be displayed + @param widget(widget.PrimitivusWidget): created widget + @param user_action(bool): if True, the widget has been created following an + explicit user action. In this case, the widget may get focus immediately + """ # FIXME: when several widgets are possible (e.g. with :split) # do not replace current widget when self.selected_widget != None - if self.selected_widget is None: + if user_action or self.selected_widget is None: self.selectWidget(widget) def selectWidget(self, widget):