Skip to content

Commit 5ffe8f7

Browse files
committed
Argument names for Editor object
1 parent 6508311 commit 5ffe8f7

File tree

2 files changed

+389
-368
lines changed

2 files changed

+389
-368
lines changed

PythonScript/src/CreateWrapper.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,18 @@ def writePythonParams(param1Type, param1Name, param2Type, param2Name):
339339

340340
return retVal
341341

342+
def getPythonParamNamesQuoted(param1Type, param1Name, param2Type, param2Name):
343+
mappedSig = mapSignature((param1Type, param1Name, param2Type, param2Name))
344+
if mappedSig:
345+
param1Type = mappedSig[1]
346+
param2Type = mappedSig[2]
347+
348+
349+
pythonParams = writePythonParams(param1Type, param1Name, param2Type, param2Name)
350+
quotedParams = ", ".join(['"' + p.strip() + '"' for p in pythonParams.split(',')])
351+
return quotedParams
352+
353+
342354
argumentMap = [
343355
# (firstParamType, firstParamName, secondParamType, secondParamName) : ( returnType, FirstParamType, SecondParamType, bodyFunction)
344356
('int', 'length', 'string', '', ('int', '', 'boost::python::object', constString)),
@@ -467,7 +479,7 @@ def writeCppFile(f,out):
467479
print "Unique combinations:"
468480
for k in uniqueCombinations:
469481
print str(k) + ' (%s)' % ", ".join(uniqueCombinations[k][:4])
470-
482+
"""
471483
for k in uniqueCombinations:
472484
comb = [c[0].lower() + c[1:] for c in uniqueCombinations[k][:4]]
473485
print ' def test_scintillawrapper_{0}_{1}_{2}(self):'.format(k[0], emptyIsVoid(k[1]), emptyIsVoid(k[2]))
@@ -483,7 +495,7 @@ def writeCppFile(f,out):
483495
print ' editor.write("test");'
484496
print ' time.sleep(0.1)'
485497
print ' self.assertEqual(self.callbackCalled, True)\n'
486-
498+
"""
487499

488500

489501

@@ -527,7 +539,14 @@ def writeBoostWrapFile(f,out):
527539
if v["Name"] in exclusions:
528540
continue
529541

530-
out.write('\t\t.def("{0}", &ScintillaWrapper::{1}, \"'.format(formatPythonName(v["Name"]), v["Name"]))
542+
out.write('\t\t.def("{0}", &ScintillaWrapper::{1}, '.format(formatPythonName(v["Name"]), v["Name"]))
543+
# TODO: This is getting really nasty. We need to refactor this whole file.
544+
# We need to
545+
quotedParams = getPythonParamNamesQuoted(v['Param1Type'], v['Param1Name'], v['Param2Type'], v['Param2Name'])
546+
if quotedParams and quotedParams != '""':
547+
out.write("boost::python::args({0}), ".format(quotedParams))
548+
549+
out.write('\"')
531550
out.write("\\n".join(v["Comment"]).replace('\\','\\\\').replace('"','\\"').replace('\\\\n', '\\n'))
532551
out.write('\")\n')
533552

0 commit comments

Comments
 (0)