summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blockext/generate.py5
-rw-r--r--example.py5
2 files changed, 8 insertions, 2 deletions
diff --git a/blockext/generate.py b/blockext/generate.py
index 207163b..c384fa8 100644
--- a/blockext/generate.py
+++ b/blockext/generate.py
@@ -113,6 +113,7 @@ def generate_snap(descriptor, language):
inputs = SubElement(defn, "inputs")
snap_spec = ""
+ inputCounter = 0
for part in block.parts:
if isinstance(part, Input):
input_el = SubElement(inputs, "input", {
@@ -126,8 +127,8 @@ def generate_snap(descriptor, language):
# TODO menus
# XXX ^ why is there a todo comment here?
- index = block.inputs.index(part)
- part = "%'arg-{}'".format(index)
+ part = "%'arg-{}'".format(inputCounter)
+ inputCounter += 1
else:
assert isinstance(part, str)
# Snap! doesn't allow %-signs in block text yet.
diff --git a/example.py b/example.py
index 3b3690b..163908d 100644
--- a/example.py
+++ b/example.py
@@ -32,6 +32,11 @@ class Example:
print(text)
time.sleep(duration)
+ @command("multiple %s inputs are %s allowed")
+ def argstest(self, arg1, arg2):
+ print(arg1)
+ print(arg2)
+
@command("play note %n")
def play_note(self, note):
print("DING {note}".format(note=note))