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.
This commit is contained in:
parent
4743b1c840
commit
8fc78a71f0
2 changed files with 10 additions and 3 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue