summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/res/resedit.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-06-18 20:20:27 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-06-18 20:20:27 (GMT)
commit1e054024c12b478eab2c09aae10f1a6cc1d6fda3 (patch)
treeff917b4d6f03fe13b6428b21bf8cf175066679cb /Mac/Modules/res/resedit.py
parenta177228ff8596f2457c8f527ec919c7c6f7c60fc (diff)
downloadcpython-1e054024c12b478eab2c09aae10f1a6cc1d6fda3.zip
cpython-1e054024c12b478eab2c09aae10f1a6cc1d6fda3.tar.gz
cpython-1e054024c12b478eab2c09aae10f1a6cc1d6fda3.tar.bz2
Added methods as_Menu and as_Control to convert a resource
to those object types You can now set the data attribute of a resource with the expected semantics (but you have to call ChangedResource yourself)
Diffstat (limited to 'Mac/Modules/res/resedit.py')
-rw-r--r--Mac/Modules/res/resedit.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Mac/Modules/res/resedit.py b/Mac/Modules/res/resedit.py
index 5e54ef2..bffec5f 100644
--- a/Mac/Modules/res/resedit.py
+++ b/Mac/Modules/res/resedit.py
@@ -23,3 +23,19 @@ The created resource object is actually just a handle.
Apply AddResource() to write it to a resource file.
"""
functions.append(f)
+
+# Convert resources to other things.
+
+as_xxx_body = """
+return %sObj_New((%sHandle)_self->ob_itself);
+"""
+
+def genresconverter(longname, shortname):
+
+ f = ManualGenerator("as_%s"%longname, as_xxx_body%(shortname, longname))
+ docstring = "Return this resource/handle as a %s"%longname
+ f.docstring = lambda docstring=docstring: docstring
+ return f
+
+resmethods.append(genresconverter("Control", "Ctl"))
+resmethods.append(genresconverter("Menu", "Menu"))