Change controllib

Buttons instead of i in list
pull/1/head
Julius Riegel 7 years ago
parent 56ddd9022d
commit fb6f53252e

@ -3,8 +3,6 @@
<component name="ChangeListManager">
<list default="true" id="49388e57-2b9e-468a-b880-1d7fb243112d" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/controllib.py" afterPath="$PROJECT_DIR$/lib/controllib.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/hardwarelib.py" afterPath="$PROJECT_DIR$/lib/hardwarelib.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/main.py" afterPath="$PROJECT_DIR$/main.py" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@ -55,8 +53,8 @@
<file leaf-file-name="controllib.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/controllib.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="53" column="38" lean-forward="true" selection-start-line="53" selection-start-column="38" selection-end-line="53" selection-end-column="38" />
<state relative-caret-position="79">
<caret line="64" column="66" lean-forward="false" selection-start-line="64" selection-start-column="66" selection-end-line="64" selection-end-column="66" />
<folding />
</state>
</provider>
@ -103,6 +101,14 @@
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>self.pressed.remove(i)</find>
</findStrings>
<replaceStrings>
<replace>self.pressed.remove(button)</replace>
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -123,9 +129,9 @@
<option value="$PROJECT_DIR$/thermo.py" />
<option value="$PROJECT_DIR$/update.sh" />
<option value="$PROJECT_DIR$/lib/graphiclib.py" />
<option value="$PROJECT_DIR$/lib/controllib.py" />
<option value="$PROJECT_DIR$/lib/hardwarelib.py" />
<option value="$PROJECT_DIR$/main.py" />
<option value="$PROJECT_DIR$/lib/controllib.py" />
</list>
</option>
</component>
@ -535,8 +541,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/lib/controllib.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="53" column="38" lean-forward="true" selection-start-line="53" selection-start-column="38" selection-end-line="53" selection-end-column="38" />
<state relative-caret-position="79">
<caret line="64" column="66" lean-forward="false" selection-start-line="64" selection-start-column="66" selection-end-line="64" selection-end-column="66" />
<folding />
</state>
</provider>

@ -40,9 +40,9 @@ class Joystick():
if i == c['LIGHT'] and button == 1 and button not in self.pressed:
self.light.switch()
self.pressed.append(i)
self.pressed.append(button)
elif i == c['LIGHT'] and button == 0 and button in self.pressed:
self.pressed.remove(i)
self.pressed.remove(button)
elif i == c['MUSIC'] and button == 1 and button not in self.pressed:
if self.splaying:
@ -51,27 +51,27 @@ class Joystick():
else:
self.sound.play()
self.splaying = True
self.pressed.append(i)
self.pressed.append(button)
elif i == c['MUSIC'] and button == 0 and button in self.pressed:
self.pressed.remove(i)
self.pressed.remove(button)
elif i == c['VOLIN'] and button == 1 and button not in self.pressed:
self.sound.set_volume(self.sound.get_volume() + 0.1)
self.pressed.append(i)
self.pressed.append(button)
elif i == c['VOLIN'] and button == 0 and button in self.pressed:
self.sound.set_volume(self.sound.get_volume() - 0.1)
self.pressed.remove(i)
self.pressed.remove(button)
elif i == c['VOLDE'] and button == 1 and button not in self.pressed:
self.pressed.append(i)
self.pressed.append(button)
elif i == c['VOLDE'] and button == 0 and button in self.pressed:
self.pressed.remove(i)
self.pressed.remove(button)
elif i == c['REC'] and button == 1 and button not in self.pressed:
self._save_camimg()
self.pressed.append(i)
self.pressed.append(button)
elif i == c['REC'] and button == 0 and button in self.pressed:
self.pressed.remove(i)
self.pressed.remove(button)
# hats
for i in range(self.joystick.get_numhats()):

Loading…
Cancel
Save