diff options
author | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-12 14:07:20 +0200 |
---|---|---|
committer | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-12 14:07:20 +0200 |
commit | b7ccaa7015df61c101b3aa40e44feb2b5da287a0 (patch) | |
tree | 82fe8a280cc285d8196b5973e2358374ebf66f3e /ParrotZikTray | |
parent | 7c7a156588b99dcd1d632a4d8ff6e53f46aef2e8 (diff) | |
download | pyParrotZikTCP-b7ccaa7015df61c101b3aa40e44feb2b5da287a0.tar.xz pyParrotZikTCP-b7ccaa7015df61c101b3aa40e44feb2b5da287a0.zip |
Fix pep8.
Diffstat (limited to '')
-rwxr-xr-x | ParrotZikTray | 83 |
1 files changed, 49 insertions, 34 deletions
diff --git a/ParrotZikTray b/ParrotZikTray index 9d392a3..f35662a 100755 --- a/ParrotZikTray +++ b/ParrotZikTray @@ -5,44 +5,57 @@ import ParrotZik import BluetoothPairedDevices from SysIndicator import * -UPDATE_FREQUENCY = 30 # seconds +# seconds +UPDATE_FREQUENCY = 30 + class ParrotZikIndicator(SysIndicator): def __init__(self): self.menu = UniversalMenu() - self.info_item = MenuItem("Parrot Zik Not connected..",None,sensitive = False) + self.info_item = MenuItem("Parrot Zik Not connected..", + None, sensitive=False) self.menu.append(self.info_item) - self.battery_level = MenuItem("Battery Level:",None,sensitive = False) + self.battery_level = MenuItem("Battery Level:", + None, sensitive=False) self.menu.append(self.battery_level) - self.battery_state = MenuItem("Battery State:",None,sensitive = False) + self.battery_state = MenuItem("Battery State:", + None, sensitive=False) self.menu.append(self.battery_state) - self.firmware_version = MenuItem("Firmware Version:",None,sensitive = False) + self.firmware_version = MenuItem("Firmware Version:", + None, sensitive=False) self.menu.append(self.firmware_version) - self.check = MenuItem("Noise Cancellation",self.toggleANC,sensitive = False, checkitem = True) + self.check = MenuItem("Noise Cancellation", self.toggleANC, + sensitive=False, checkitem=True) self.menu.append(self.check) - self.check2 = MenuItem("Auto Connection",self.toggleAuto,sensitive = False, checkitem = True) + self.check2 = MenuItem("Auto Connection", self.toggleAuto, + sensitive=False, checkitem=True) self.menu.append(self.check2) - self.check3 = MenuItem("Lou Reed Mode",self.toggleLouReedMode,sensitive = False, checkitem = True) + self.check3 = MenuItem("Lou Reed Mode", self.toggleLouReedMode, + sensitive=False, checkitem=True) self.menu.append(self.check3) - self.check4 = MenuItem("Concert Hall Mode",self.toggleParrotConcertHall,sensitive = False, checkitem = True) + self.check4 = MenuItem( + "Concert Hall Mode", self.toggleParrotConcertHall, + sensitive=False, checkitem=True) self.menu.append(self.check4) - self.quit = MenuItem("Quit",sys.exit,sensitive = True, checkitem = True) + self.quit = MenuItem("Quit", sys.exit, sensitive=True, checkitem=True) self.menu.append(self.quit) - SysIndicator.__init__(self,icon = "zik-audio-headset",menu = self.menu) + SysIndicator.__init__(self, icon="zik-audio-headset", menu=self.menu) - self.connected=False - self.p = re.compile('90:03:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}') + self.connected = False + self.p = re.compile( + '90:03:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}' + ) def EstablishConnection(self): if self.connected: @@ -52,7 +65,7 @@ class ParrotZikIndicator(SysIndicator): else: print "Connection already established" else: - mac=BluetoothPairedDevices.ParrotZikMac() + mac = BluetoothPairedDevices.ParrotZikMac() if mac: self.parrot = ParrotZik.ParrotZik(mac) if not self.parrot.sock: @@ -91,21 +104,21 @@ class ParrotZikIndicator(SysIndicator): self.CheckBattery() return True - def toggleANC(self,widget): + def toggleANC(self, widget): if self.connected: if self.check.get_active(): self.parrot.setNoiseCancel("true") else: self.parrot.setNoiseCancel("false") - def toggleAuto(self,widget): + def toggleAuto(self, widget): if self.connected: if self.check2.get_active(): self.parrot.setAutoConnection("true") else: self.parrot.setAutoConnection("false") - def toggleLouReedMode(self,widget): + def toggleLouReedMode(self, widget): if self.connected: if self.check3.get_active(): self.parrot.setLouReedMode("true") @@ -114,7 +127,7 @@ class ParrotZikIndicator(SysIndicator): self.parrot.setLouReedMode("false") self.check4.set_sensitive(True) - def toggleParrotConcertHall(self,widget): + def toggleParrotConcertHall(self, widget): if self.connected: if self.check4.get_active(): self.parrot.setParrotConcertHall("true") @@ -129,28 +142,30 @@ class ParrotZikIndicator(SysIndicator): if self.parrot.BatteryCharging: self.batteryLevel = "Charging" self.setIcon("zik-battery-charging") - self.batteryLevel="Unknown" - self.batteryState="Charging" - elif self.batteryLevel>80: + self.batteryLevel = "Unknown" + self.batteryState = "Charging" + elif self.batteryLevel > 80: self.setIcon("zik-battery-100") - self.batteryState="In Use" - elif self.batteryLevel>60: + self.batteryState = "In Use" + elif self.batteryLevel > 60: self.setIcon("zik-battery-080") - self.batteryState="In Use" - elif self.batteryLevel>40: + self.batteryState = "In Use" + elif self.batteryLevel > 40: self.setIcon("zik-battery-060") - self.batteryState="In Use" - elif self.batteryLevel>20: + self.batteryState = "In Use" + elif self.batteryLevel > 20: self.setIcon("zik-battery-040") - self.batteryState="In Use" + self.batteryState = "In Use" else: self.setIcon("zik-battery-low") - self.batteryState="In Use" - - self.info_item.set_label("Connected to: "+self.name) - self.firmware_version.set_label("Firmware version: "+self.version) - self.battery_state.set_label("State: "+self.batteryState) - self.battery_level.set_label("Battery Level: "+str(self.batteryLevel)) + self.batteryState = "In Use" + + self.info_item.set_label("Connected to: " + self.name) + self.firmware_version.set_label( + "Firmware version: " + self.version) + self.battery_state.set_label("State: " + self.batteryState) + self.battery_level.set_label( + "Battery Level: " + str(self.batteryLevel)) else: self.setIcon("zik-audio-headset") self.info_item.set_label("Parrot Zik Not connected..") |