diff options
author | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-13 00:37:49 +0200 |
---|---|---|
committer | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-13 00:37:49 +0200 |
commit | 7856465e1ab0ab69101996b12e93450c6bea160b (patch) | |
tree | 0a0478b3696be337fc080163f1cac085f1af3295 | |
parent | d53188baa1c4175d2f9456ac722d35facb47f818 (diff) | |
download | pyParrotZikTCP-7856465e1ab0ab69101996b12e93450c6bea160b.tar.xz pyParrotZikTCP-7856465e1ab0ab69101996b12e93450c6bea160b.zip |
Add flight mode.
Diffstat (limited to '')
-rw-r--r-- | ParrotZik.py | 9 | ||||
-rwxr-xr-x | ParrotZikTray | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/ParrotZik.py b/ParrotZik.py index c47ce26..7cb623d 100644 --- a/ParrotZik.py +++ b/ParrotZik.py @@ -195,3 +195,12 @@ class ParrotZikVersion2(ParrotZikBase): @property def battery_level(self): return self.get_battery_level('percent') + + @property + def flight_mode(self): + data = self.api.get('/api/flight_mode/get') + return self._result_to_bool(data.answer.flight_mode['enabled']) + + @flight_mode.setter + def flight_mode(self, arg): + self.api.set('/api/flight_mode/enable', arg) diff --git a/ParrotZikTray b/ParrotZikTray index 6de9e1c..9a96b9b 100755 --- a/ParrotZikTray +++ b/ParrotZikTray @@ -268,7 +268,7 @@ class ParrotZikVersion2Interface(ParrotZikBaseInterface): self.concert_hall_mode_submenu.append(self.silent_mode) self.indicator.menu.append(self.concert_hall_mode) - self.flight_mode = MenuItem("Flight Mode", None, + self.flight_mode = MenuItem("Flight Mode", self.toggle_flight_mode, sensitive=True, checkitem=True, visible=False) self.indicator.menu.append(self.flight_mode) @@ -278,13 +278,18 @@ class ParrotZikVersion2Interface(ParrotZikBaseInterface): self.flight_mode.show() super(ParrotZikVersion2Interface, self).activate(parrot) self.noise_cancelation_enabled.set_active(self.parrot.noise_cancel) - # self.flight_mode.set_active(self.parrot.flight_mode) + self.flight_mode.set_active(self.parrot.flight_mode) def toggleANC(self, widget): if self.connected: self.parrot.noise_cancel = self.noise_cancelation.get_active() self.noise_cancelation.set_active(self.parrot.noise_cancel) + def toggle_flight_mode(self, widget): + if self.connected: + self.parrot.flight_mode = self.flight_mode.get_active() + self.flight_mode.set_active(self.parrot.flight_mode) + def toggledummy(self, widget): print(widget.get_name()) |