Skip to content

Commit 013325a

Browse files
committed
Added motor control helper functions that support kwargs
1 parent 4a30e8d commit 013325a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{% assign class_name = currentClass.friendlyName | camel_case | capitalize %}{%
2+
assign properties = " _properties = [" %}{%
3+
for propval in currentClass.systemProperties %}{%
4+
if propval.writeAccess %}{%
5+
capture properties %}{{ properties }}
6+
, '{{ propval.systemName }}'{% endcapture %}{%
7+
endif %}{%
8+
endfor %}
9+
{{ properties | replace_first:',',' ' }} ]
10+
11+
def _helper( self, **kwargs ):
12+
for p,v in kwargs.iteritems():
13+
if p in self._properties:
14+
self._set_int_attribute( p, p, v )
15+
{% for propval in currentClass.propertyValues %}{%
16+
if propval.propertyName == "Command" %}{%
17+
for value in propval.values %}{%
18+
assign cmd = value.name | replace:'-','_' %}
19+
def {{ cmd }}( self, **kwargs ):
20+
self._helper( **kwargs )
21+
self._set_string_attribute( 'command', 'command', '{{ value.name }}' )
22+
{% endfor %}{%
23+
endif %}{%
24+
endfor %}{%
25+
comment %}{%
26+
for func in currentClass.helperFunctions %}{%
27+
assign func_name = func.name | downcase | underscore_spaces %}{%
28+
assign param_list = "" %}{%
29+
for param in func.parameters %}{%
30+
capture param_list %}{{ param_list }}, {{ param.name }}{% endcapture %}{%
31+
endfor %}
32+
def {{ func_name }}( {{ param_list | remove_first:', ' }} ):
33+
pass {%
34+
endfor %}{%
35+
endfor %}
36+
{% endcomment %}

0 commit comments

Comments
 (0)