# HG changeset patch # User Goffi # Date 1563129514 -7200 # Node ID d86cddc1cd055de38ffcb5423e2f0ea73a2b853b # Parent e624550d5c2463472fd14cee5b38a089011c2501 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. diff -r e624550d5c24 -r d86cddc1cd05 sat_frontends/primitivus/primitivus --- 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): diff -r e624550d5c24 -r d86cddc1cd05 sat_frontends/primitivus/xmlui.py --- a/sat_frontends/primitivus/xmlui.py Sun Jul 14 16:43:04 2019 +0200 +++ b/sat_frontends/primitivus/xmlui.py Sun Jul 14 20:38:34 2019 +0200 @@ -503,7 +503,7 @@ if show_type == "popup": self.host.showPopUp(self, valign=valign) elif show_type == "window": - self.host.newWidget(self) + self.host.newWidget(self, user_action=self.user_action) else: assert False self.host.redraw()