comparison 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
comparison
equal deleted inserted replaced
3003:e624550d5c24 3004:d86cddc1cd05
638 app=C.APP_NAME, 638 app=C.APP_NAME,
639 entity=u' ({})'.format(entity) if entity else '') 639 entity=u' ({})'.format(entity) if entity else '')
640 self.x_notify.sendNotification(message) 640 self.x_notify.sendNotification(message)
641 641
642 642
643 def newWidget(self, widget): 643 def newWidget(self, widget, user_action=False):
644 """Method called when a new widget is created
645
646 if suitable, the widget will be displayed
647 @param widget(widget.PrimitivusWidget): created widget
648 @param user_action(bool): if True, the widget has been created following an
649 explicit user action. In this case, the widget may get focus immediately
650 """
644 # FIXME: when several widgets are possible (e.g. with :split) 651 # FIXME: when several widgets are possible (e.g. with :split)
645 # do not replace current widget when self.selected_widget != None 652 # do not replace current widget when self.selected_widget != None
646 if self.selected_widget is None: 653 if user_action or self.selected_widget is None:
647 self.selectWidget(widget) 654 self.selectWidget(widget)
648 655
649 def selectWidget(self, widget): 656 def selectWidget(self, widget):
650 """Display a widget if possible, 657 """Display a widget if possible,
651 658