diff options
author | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-15 13:41:06 +0200 |
---|---|---|
committer | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-15 13:41:06 +0200 |
commit | f291feaa8a33645850818f811ba8d7f9eb9d4c31 (patch) | |
tree | 29e085ca418110a81aee21c1794a654200301212 /parrot_zik | |
parent | 3b4f022722e43d5821f4d2276018242c88cb1ed3 (diff) | |
download | pyParrotZikTCP-f291feaa8a33645850818f811ba8d7f9eb9d4c31.tar.xz pyParrotZikTCP-f291feaa8a33645850818f811ba8d7f9eb9d4c31.zip |
Refactor.
Diffstat (limited to '')
-rw-r--r-- | parrot_zik/indicator/base.py | 3 | ||||
-rw-r--r-- | parrot_zik/indicator/linux.py | 3 | ||||
-rw-r--r-- | parrot_zik/indicator/mac.py | 3 | ||||
-rw-r--r-- | parrot_zik/indicator/windows.py | 3 | ||||
-rwxr-xr-x | parrot_zik/parrot_zik_tray.py (renamed from parrot_zik/parrot_zik_tray) | 21 |
5 files changed, 16 insertions, 17 deletions
diff --git a/parrot_zik/indicator/base.py b/parrot_zik/indicator/base.py index 8204fa9..b29368e 100644 --- a/parrot_zik/indicator/base.py +++ b/parrot_zik/indicator/base.py @@ -7,7 +7,8 @@ class BaseIndicator(object): def setIcon(self, name): raise NotImplementedError - def main(self): + @classmethod + def main(cls): raise NotImplementedError def show_about_dialog(self, widget): diff --git a/parrot_zik/indicator/linux.py b/parrot_zik/indicator/linux.py index ff06587..fc0f425 100644 --- a/parrot_zik/indicator/linux.py +++ b/parrot_zik/indicator/linux.py @@ -31,7 +31,8 @@ class LinuxIndicator(BaseIndicator): def setIcon(self, name): self.statusicon.set_icon(name) - def main(self): + @classmethod + def main(cls): gtk.main() def quit(self, _): diff --git a/parrot_zik/indicator/mac.py b/parrot_zik/indicator/mac.py index d28ee26..232e010 100644 --- a/parrot_zik/indicator/mac.py +++ b/parrot_zik/indicator/mac.py @@ -21,7 +21,8 @@ class DarwinIndicator(BaseIndicator): def setIcon(self, name): self.statusicon.setIcon(name, self.icon_directory) - def main(self): + @classmethod + def main(cls): AppHelper.runEventLoop() def show_about_dialog(self, widget): diff --git a/parrot_zik/indicator/windows.py b/parrot_zik/indicator/windows.py index 118f620..79a4ef3 100644 --- a/parrot_zik/indicator/windows.py +++ b/parrot_zik/indicator/windows.py @@ -30,7 +30,8 @@ class WindowsIndicator(BaseIndicator): def setIcon(self, name): self.statusicon.set_from_file(self.icon_directory + name + '.png') - def main(self): + @classmethod + def main(cls): gtk.main() def quit(self, _): diff --git a/parrot_zik/parrot_zik_tray b/parrot_zik/parrot_zik_tray.py index 0e5b951..35931d7 100755 --- a/parrot_zik/parrot_zik_tray +++ b/parrot_zik/parrot_zik_tray.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from parrot_zik.interface.version1 import ParrotZikVersion1Interface from parrot_zik.interface.version2 import ParrotZikVersion2Interface from parrot_zik import resource_manager @@ -72,14 +70,11 @@ class ParrotZikIndicator(SysIndicator): self.reconnect.start(self, RECONNECT_FREQUENCY) self.autorefresh.stop() - def main(self): - self.reconnect.start(self, RECONNECT_FREQUENCY) - SysIndicator.main(self) - - -if __name__ == "__main__": - try: - indicator = ParrotZikIndicator() - indicator.main() - except KeyboardInterrupt: - pass + @classmethod + def main(cls): + try: + indicator = cls() + cls.reconnect.start(indicator, RECONNECT_FREQUENCY) + super(ParrotZikIndicator, cls).main() + except KeyboardInterrupt: + pass |