# HG changeset patch # User prock@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1266954276 0 # Node ID f44b149f63e7f80878c2b05fb6cf067d5d208972 # Parent ad1f09d954f96e8064ac8c0dc8651d38a17659ca Added the ability to request focus via the pychan widget (added the requestFocus() function). Also fixed a problem where dialog boxes were not given focus when opened. fixes[t:465] diff -r ad1f09d954f9 -r f44b149f63e7 engine/python/fife/extensions/pychan/widgets/widget.py --- a/engine/python/fife/extensions/pychan/widgets/widget.py Tue Feb 23 19:25:59 2010 +0000 +++ b/engine/python/fife/extensions/pychan/widgets/widget.py Tue Feb 23 19:44:36 2010 +0000 @@ -170,8 +170,21 @@ self.hide() self.findChild(name=name).capture( _quitThisDialog , group_name = "__execute__" ) self.show() + self.is_focusable = True + self.requestFocus() return get_manager().mainLoop() + def requestFocus(self): + """ + Requests focus. + + The widget must be focusable in order for this to work. See + the is_focusable property. + + """ + + self.real_widget.requestFocus() + def match(self,**kwargs): """ Matches the widget against a list of key-value pairs.