X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/510bb7480c5138dd5127ed3d8b1d9cbab39983c9..1f780e48af479e7bf9a07eaaa1ab6b41f1ffb17b:/wxPython/samples/ide/activegrid/util/gettersetter.py diff --git a/wxPython/samples/ide/activegrid/util/gettersetter.py b/wxPython/samples/ide/activegrid/util/gettersetter.py new file mode 100644 index 0000000000..34d62481ad --- /dev/null +++ b/wxPython/samples/ide/activegrid/util/gettersetter.py @@ -0,0 +1,36 @@ +#---------------------------------------------------------------------------- +# Name: gettersetter.py +# Purpose: +# +# Author: Peter Yared +# +# Created: 7/28/04 +# CVS-ID: $Id$ +# Copyright: (c) 2004-2005 ActiveGrid, Inc. +# License: wxWindows License +#---------------------------------------------------------------------------- +def gettersetter(list): + for attr in list: + lowercase = attr[0].lower() + attr[1:] + uppercase = attr[0].upper() + attr[1:] + print " def get%s(self):" % uppercase + print " return self._%s" % lowercase + print + print " def set%s(self, %s):" % (uppercase, lowercase) + print " self._%s = %s" % (lowercase, lowercase) + print + +def listgettersetter(list): + for attr in list: + lowercase = attr[0].lower() + attr[1:] + uppercase = attr[0].upper() + attr[1:] + print " def get%s(self):" % uppercase + print " return self._%s" % lowercase + print + print " def add%s(self, %s):" % (uppercase[:-1], lowercase[:-1]) + print " self._%s.append(%s)" % (lowercase, lowercase[:-1]) + print + print " def remove%s(self, %s):" % (uppercase[:-1], lowercase[:-1]) + print " self._%s.remove(%s)" % (lowercase, lowercase[:-1]) + print +