]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/samples/ide/activegrid/util/gettersetter.py
Added the ActiveGrid IDE as a sample application
[wxWidgets.git] / 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 (file)
index 0000000..34d6248
--- /dev/null
@@ -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
+