changeset 431:f44b149f63e7

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]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 23 Feb 2010 19:44:36 +0000
parents ad1f09d954f9
children 4f2752d45458
files engine/python/fife/extensions/pychan/widgets/widget.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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.