From dec49f55a15622b5489ba06ad7492796c7d65672 Mon Sep 17 00:00:00 2001 From: neodarz Date: Fri, 10 May 2019 22:46:44 +0200 Subject: Update parrot zik version1 --- README.md | 2 ++ parrot_zik/interface/version1.py | 50 ++++++++++++---------------------------- 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 47b66b1..05b18d2 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ reverse engineering of Parrot Zik communication protocol. This repo contains some base class without unmaintained pyGTK crap and python3 compatible code with a simple TCP client/server for use this. +/!\ Parrot Zik 1 not tested for the moment. + ## Windows Usage Windows support is not tested for the moment. All old code from forked project diff --git a/parrot_zik/interface/version1.py b/parrot_zik/interface/version1.py index d0a1b2b..1d8f385 100644 --- a/parrot_zik/interface/version1.py +++ b/parrot_zik/interface/version1.py @@ -1,5 +1,4 @@ from parrot_zik import resource_manager -from parrot_zik.indicator import MenuItem from parrot_zik.interface.base import ParrotZikBaseInterface from parrot_zik.model.version1 import ParrotZikVersion1 @@ -9,55 +8,36 @@ class ParrotZikVersion1Interface(ParrotZikBaseInterface): def __init__(self, indicator): super(ParrotZikVersion1Interface, self).__init__(indicator) - self.noise_cancelation = MenuItem( - "Noise Cancellation", self.toggle_noise_cancelation, - checkitem=True, visible=False) - self.lou_reed_mode = MenuItem("Lou Reed Mode", self.toggle_lou_reed_mode, - checkitem=True, visible=False) - self.concert_hall_mode = MenuItem( - "Concert Hall Mode", self.toggle_parrot_concert_hall, - checkitem=True, visible=False) - self.indicator.menu.append(self.noise_cancelation) - self.indicator.menu.append(self.lou_reed_mode) - self.indicator.menu.append(self.concert_hall_mode) def activate(self, manager): super(ParrotZikVersion1Interface, self).activate(manager) - self.noise_cancelation.set_active(self.parrot.cancel_noise) - self.lou_reed_mode.set_active(self.parrot.lou_reed_mode) - self.concert_hall_mode.set_active(self.parrot.concert_hall) - - self.noise_cancelation.show() - self.lou_reed_mode.show() - self.concert_hall_mode.show() - self.indicator.menu.reposition() def deactivate(self): - self.noise_cancelation.hide() - self.lou_reed_mode.hide() - self.concert_hall_mode.hide() super(ParrotZikVersion1Interface, self).deactivate() - def toggle_noise_cancelation(self, widget): + def toggle_noise_cancelation(self, noise_cancelation): + """ + Define noise cancelation mode. + """ try: - self.parrot.cancel_noise = self.noise_cancelation.get_active() - self.noise_cancelation.set_active(self.parrot.cancel_noise) + self.parrot.cancel_noise = noise_cancelation except resource_manager.DeviceDisconnected: self.deactivate() - def toggle_lou_reed_mode(self, widget): + def toggle_lou_reed_mode(self, lou_reed_mode): + """ + Define lou reed mode. + """ try: - self.parrot.lou_reed_mode = self.lou_reed_mode.get_active() - self.lou_reed_mode.set_active(self.parrot.lou_reed_mode) - self.concert_hall_mode.set_active(self.parrot.concert_hall) - self.concert_hall_mode.set_sensitive( - not self.lou_reed_mode.get_active()) + self.parrot.lou_reed_mode = lou_reed_mode except resource_manager.DeviceDisconnected: self.deactivate() - def toggle_parrot_concert_hall(self, widget): + def toggle_parrot_concert_hall(self, parrot_concert_hall): + """ + Define parrot concert hall + """ try: - self.parrot.concert_hall = self.concert_hall_mode.get_active() - self.concert_hall_mode.set_active(self.parrot.concert_hall) + self.parrot.concert_hall = parrot_concert_hall except resource_manager.DeviceDisconnected: self.deactivate() -- cgit v1.2.1