Skip to content

Commit 6a87d4c

Browse files
committed
Eliminate the led-color-method template
Eliminate the generic-helper template Use the motor-commands template instead of generic-helper
1 parent cfd7011 commit 6a87d4c

File tree

3 files changed

+15
-26
lines changed

3 files changed

+15
-26
lines changed

ev3dev/ev3dev.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ def __set_time_sp(self, value):
555555
}
556556

557557
#~autogen
558-
#~autogen python_generic-helper-function classes.motor>currentClass
558+
#~autogen python_motor_commands classes.motor>currentClass
559559

560560
def run_forever( self, **kwargs ):
561561
"""Run the motor until another command is sent.
@@ -810,7 +810,7 @@ def __set_time_sp(self, value):
810810

811811
#~autogen
812812

813-
#~autogen python_generic-helper-function classes.dcMotor>currentClass
813+
#~autogen python_motor_commands classes.dcMotor>currentClass
814814

815815
def run_forever( self, **kwargs ):
816816
"""Run the motor until another command is sent.
@@ -1019,7 +1019,7 @@ def __get_state(self):
10191019

10201020
#~autogen
10211021

1022-
#~autogen python_generic-helper-function classes.servoMotor>currentClass
1022+
#~autogen python_motor_commands classes.servoMotor>currentClass
10231023

10241024
def run( self, **kwargs ):
10251025
"""Drive servo to the position set in the `position_sp` attribute.

templates/python_led-color-methods.liquid

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
{% comment %}
2-
{% for prop in currentClass.propertyValues %}{%
3-
if prop.propertyName == 'Command' %}{%
4-
assign className = currentClass.friendlyName | downcase | underscore_spaces %}{%
5-
for value in prop.values %}{%
6-
assign commandName = value.name | downcase | underscore_non_wc %}
7-
def {{ className }}_{{ commandName }}(self, **attr):
8-
"""{%
9-
for line in value.description %}{{ line }}
10-
{% endfor %}"""
11-
12-
for key in attr:
13-
setattr(self, key, attr[key])
14-
self.command = "{{ value.name }}"
15-
16-
{{ className }}.{{commandName}} = {{ className }}_{{ commandName }}
1+
{% assign class_name = currentClass.friendlyName | camel_case | capitalize %}{%
2+
for propval in currentClass.propertyValues %}{%
3+
if propval.propertyName == "Command" %}{%
4+
for value in propval.values %}{%
5+
assign cmd = value.name | replace:'-','_' %}
6+
def {{ cmd }}( self, **kwargs ):
7+
"""{%
8+
for line in value.description %}{{line}}
9+
{% endfor %}"""
10+
for key in kwargs:
11+
setattr(self, key, kwargs[key])
12+
self.command = '{{value.name}}'
1713
{%
1814
endfor %}{%
1915
endif %}{%
2016
endfor %}
21-
{% endcomment %}

0 commit comments

Comments
 (0)