diff --git a/sat_frontends/primitivus/primitivus b/sat_frontends/primitivus/primitivus index c9566f1c..c2dbf117 100755 --- a/sat_frontends/primitivus/primitivus +++ b/sat_frontends/primitivus/primitivus @@ -640,10 +640,17 @@ class PrimitivusApp(QuickApp, InputHistory): 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 --git a/sat_frontends/primitivus/xmlui.py b/sat_frontends/primitivus/xmlui.py index 6b8b7a3e..f0946a7d 100644 --- a/sat_frontends/primitivus/xmlui.py +++ b/sat_frontends/primitivus/xmlui.py @@ -503,7 +503,7 @@ class XMLUIPanel(xmlui.XMLUIPanel, PrimitivusWidget): 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()