diff --git a/src/scratchtocatrobat/converter/converter.py b/src/scratchtocatrobat/converter/converter.py index 17617aae..ca880447 100644 --- a/src/scratchtocatrobat/converter/converter.py +++ b/src/scratchtocatrobat/converter/converter.py @@ -343,6 +343,7 @@ class _ScratchToCatrobat(object): # WORKAROUND: using ROUND for Catrobat float => Scratch int "soundLevel": lambda *_args: catrobat.formula_element_for(catformula.Functions.ROUND, arguments=[catrobat.formula_element_for(catformula.Sensors.LOUDNESS)]), # @UndefinedVariable + "note:": catbricks.NoteBrick, }.items() + math_function_block_parameters_mapping.items() \ + math_unary_operators_mapping.items() + math_binary_operators_mapping.items() \ + user_list_block_parameters_mapping.items() \ @@ -2354,3 +2355,11 @@ def _convert_doBroadcastAndWait(self): message = str(message) return catbricks.BroadcastWaitBrick(message.lower()) + #Note: NoteBricks are not implemented in scratch. We insert one in the Scratch3 parser if there is a problem(e.g. + # a block that is not implemented in Catroid) when parsing a block. + @_register_handler(_block_name_to_handler_map, "note:") + def _convert_note_block(self): + arg = self.arguments[0] + if isinstance(arg, (str, unicode)) or isinstance(arg, catformula.Formula): + return self.CatrobatClass(arg) + log.warn("Invalid argument for NoteBrick: " + arg) \ No newline at end of file diff --git a/src/scratchtocatrobat/scratch/scratch3visitor/sound.py b/src/scratchtocatrobat/scratch/scratch3visitor/sound.py index 93689922..9e0fe18b 100644 --- a/src/scratchtocatrobat/scratch/scratch3visitor/sound.py +++ b/src/scratchtocatrobat/scratch/scratch3visitor/sound.py @@ -15,14 +15,12 @@ def visitStopallsounds(blockcontext): return ["stopAllSounds"] def visitChangeeffectby(blockcontext): - block = blockcontext.block log.warn("[Scratch3] block {} ({}) possibly not available in Scratch2".format(blockcontext.block.opcode, blockcontext.block.name)) - pass #TODO: doesnt exist in scratch2/catroid + return ["note:", "ChangeEffectBy block is not yet implemented in Catroid"] #TODO: doesnt exist in scratch2/catroid def visitSeteffectto(blockcontext): - block = blockcontext.block log.warn("[Scratch3] block {} ({}) possibly not available in Scratch2".format(blockcontext.block.opcode, blockcontext.block.name)) - pass #TODO: doesnt exist in scratch2/catroid + return ["note:", "SetEffect block is not yet implemented in Catroid"] #TODO: doesnt exist in scratch2/catroid def visitCleareffects(blockcontext): log.warn("[Scratch3] block {} ({}) possibly not available in Scratch2".format(blockcontext.block.opcode, blockcontext.block.name))