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"> <component name="ChangeListManager">
<list default="true" id="49388e57-2b9e-468a-b880-1d7fb243112d" name="Default" comment=""> <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/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> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
@ -55,8 +53,8 @@
<file leaf-file-name="controllib.py" pinned="false" current-in-tab="true"> <file leaf-file-name="controllib.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/controllib.py"> <entry file="file://$PROJECT_DIR$/lib/controllib.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493"> <state relative-caret-position="79">
<caret line="53" column="38" lean-forward="true" selection-start-line="53" selection-start-column="38" selection-end-line="53" selection-end-column="38" /> <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 /> <folding />
</state> </state>
</provider> </provider>
@ -103,6 +101,14 @@
</list> </list>
</option> </option>
</component> </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"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
@ -123,9 +129,9 @@
<option value="$PROJECT_DIR$/thermo.py" /> <option value="$PROJECT_DIR$/thermo.py" />
<option value="$PROJECT_DIR$/update.sh" /> <option value="$PROJECT_DIR$/update.sh" />
<option value="$PROJECT_DIR$/lib/graphiclib.py" /> <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$/lib/hardwarelib.py" />
<option value="$PROJECT_DIR$/main.py" /> <option value="$PROJECT_DIR$/main.py" />
<option value="$PROJECT_DIR$/lib/controllib.py" />
</list> </list>
</option> </option>
</component> </component>
@ -535,8 +541,8 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/controllib.py"> <entry file="file://$PROJECT_DIR$/lib/controllib.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493"> <state relative-caret-position="79">
<caret line="53" column="38" lean-forward="true" selection-start-line="53" selection-start-column="38" selection-end-line="53" selection-end-column="38" /> <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 /> <folding />
</state> </state>
</provider> </provider>

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

Loading…
Cancel
Save