1f780e48af
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
#----------------------------------------------------------------------------
|
|
# 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
|
|
|