]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/ide/activegrid/util/gettersetter.py
Added the ActiveGrid IDE as a sample application
[wxWidgets.git] / wxPython / samples / ide / activegrid / util / gettersetter.py
1 #----------------------------------------------------------------------------
2 # Name: gettersetter.py
3 # Purpose:
4 #
5 # Author: Peter Yared
6 #
7 # Created: 7/28/04
8 # CVS-ID: $Id$
9 # Copyright: (c) 2004-2005 ActiveGrid, Inc.
10 # License: wxWindows License
11 #----------------------------------------------------------------------------
12 def gettersetter(list):
13 for attr in list:
14 lowercase = attr[0].lower() + attr[1:]
15 uppercase = attr[0].upper() + attr[1:]
16 print " def get%s(self):" % uppercase
17 print " return self._%s" % lowercase
18 print
19 print " def set%s(self, %s):" % (uppercase, lowercase)
20 print " self._%s = %s" % (lowercase, lowercase)
21 print
22
23 def listgettersetter(list):
24 for attr in list:
25 lowercase = attr[0].lower() + attr[1:]
26 uppercase = attr[0].upper() + attr[1:]
27 print " def get%s(self):" % uppercase
28 print " return self._%s" % lowercase
29 print
30 print " def add%s(self, %s):" % (uppercase[:-1], lowercase[:-1])
31 print " self._%s.append(%s)" % (lowercase, lowercase[:-1])
32 print
33 print " def remove%s(self, %s):" % (uppercase[:-1], lowercase[:-1])
34 print " self._%s.remove(%s)" % (lowercase, lowercase[:-1])
35 print
36