From 73aa49812eb3d34e0d44918fc7ac21d819187203 Mon Sep 17 00:00:00 2001 From: Bruno Cauet Date: Thu, 28 Nov 2013 15:02:12 +0100 Subject: [PATCH] Clean setup file, create launch script - Setup file: 'entry_point' is used in stead of non-existent 'bin/hackertray' for scripts - hackertray package init file - does not check if it is called as a script (which should not happen) - main() code is now replaced in HackerNewsApp.run() - main() instantiates the app and calls run() on it (previous roles grouped) --- hackertray/__init__.py | 10 +++++----- setup.py | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hackertray/__init__.py b/hackertray/__init__.py index 117faa6..489d77f 100644 --- a/hackertray/__init__.py +++ b/hackertray/__init__.py @@ -65,6 +65,10 @@ class HackerNewsApp: file.write(json.dumps(l)) gtk.main_quit() + def run(self): + gtk.main() + return 0 + '''Opens the link in the web browser''' def open(self, widget, event=None, data=None): #We disconnect and reconnect the event in case we have @@ -107,9 +111,5 @@ def getHomePage(): return r.json() def main(): - gtk.main() - return 0 - -if __name__ == "__main__": indicator = HackerNewsApp() - main() \ No newline at end of file + indicator.run() diff --git a/setup.py b/setup.py index 6ad0e7c..50413b0 100644 --- a/setup.py +++ b/setup.py @@ -11,5 +11,7 @@ setup(name='hackertray', install_requires=[ 'requests', ], - scripts=['bin/hackertray'], - zip_safe=False) \ No newline at end of file + entry_points={ + 'console_scripts': ['hackertray = hackertray:main'], + }, + zip_safe=False)