From 5fc970e38e10c526d403eb833bc9d5a447c951cc Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 6 Feb 2017 22:34:58 -0800 Subject: [PATCH] Add context manager methods to WindowDisabler. Fixes #226 --- etg/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etg/utils.py b/etg/utils.py index 9084c602..a8cf7610 100644 --- a/etg/utils.py +++ b/etg/utils.py @@ -37,10 +37,15 @@ def run(): module.addHeaderCode('#include ') module.addHeaderCode('#include ') + c = module.find('wxWindowDisabler') assert isinstance(c, etgtools.ClassDef) c.mustHaveApp() c.addPrivateCopyCtor() + # add context manager methods + c.addPyMethod('__enter__', '(self)', 'return self') + c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'pass') + module.find('wxQsort').ignore() module.find('wxGetEmailAddress').findOverload('buf').ignore()