Re: [Pgu-devel] Dialog close on Esc
Status: Beta
Brought to you by:
philhassey
|
From: Phil H. <phi...@ya...> - 2006-07-25 14:32:38
|
Ethan,
Thanks for the patch, I'll see about adding it in for the next release. (I've added it to changes.txt as a reminder to myself.)
With any luck, I'll be doing a new release with a handful of bug fixes and a few cleanup changes.
Thanks!
Phil
Ethan Glasser-Camp <gl...@cs...> wrote: Hi,
I see in the archives that this feature was suggested and a patch
requested but never supplied (at least in SVN revision 15). I'm
attaching one based on my (admittedly limited) understanding of the
library. Is this the way to do this?
Ethan
Index: pgu/gui/dialog.py
===================================================================
--- pgu/gui/dialog.py (revision 15)
+++ pgu/gui/dialog.py (working copy)
@@ -5,6 +5,7 @@
from const import *
import table, area
import basic, input, button
+import pygame.constants
class Dialog(table.Table):
"""A dialog window with a title bar and an "close" button on the bar.
@@ -35,12 +36,20 @@
self.td(title,align=-1,cls=self.cls+'.bar')
clos = button.Icon(self.cls+".bar.close")
clos.connect(CLICK,self.close,None)
+ self.connect(KEYDOWN, self._keystroke, None)
self.td(clos,align=1,cls=self.cls+'.bar')
self.tr()
self.td(main,colspan=2,cls=self.cls+".main")
-
+ def _keystroke(self, value, _event=None):
+ '''Handle a KEYDOWN event.'''
+ if _event.key == pygame.constants.K_ESCAPE:
+ self.close()
+ else:
+ table.Table.event(self, _event)
+
+
# self.tr()
#
#
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
Pgu-devel mailing list
Pgu...@li...
https://lists.sourceforge.net/lists/listinfo/pgu-devel
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less. |