From c100527f1ccfab5b34ce20702468e53f45f96edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas=20Albadalejo?= Date: Tue, 15 Jul 2014 13:53:28 +0200 Subject: [PATCH] Reordered the code and managed to get a clean install. We still lack proper icon installation. --- res/jsoninspector.desktop | 5 ++--- res/jsoninspector.glade | 1 + setup.py | 8 ++++---- src/__init__.py | 0 src/jsoninspector/__init__.py | 13 +++++++++++++ src/{ => jsoninspector}/jsoninspector.py | 8 +++++--- 6 files changed, 25 insertions(+), 10 deletions(-) delete mode 100644 src/__init__.py create mode 100644 src/jsoninspector/__init__.py rename src/{ => jsoninspector}/jsoninspector.py (98%) diff --git a/res/jsoninspector.desktop b/res/jsoninspector.desktop index 1ec3688..ccb9a03 100644 --- a/res/jsoninspector.desktop +++ b/res/jsoninspector.desktop @@ -1,9 +1,8 @@ [Desktop Entry] Name=JSON Inspector -GenericName=JSON Inspector Exec=jsoninspector.py Terminal=false -Icon=/usr/local/share/jsoninspector/ +Icon=jsoninspector Type=Application -Categories=Application;Programming; +Categories=GNOME;GTK;Development; Comment=JSON Inspector diff --git a/res/jsoninspector.glade b/res/jsoninspector.glade index 5c56bde..342ee57 100644 --- a/res/jsoninspector.glade +++ b/res/jsoninspector.glade @@ -9,6 +9,7 @@ True center-on-parent True + jsoninspector normal False center diff --git a/setup.py b/setup.py index ba49a27..2e205b7 100644 --- a/setup.py +++ b/setup.py @@ -59,13 +59,13 @@ class CustomInstall(install): except: print "Warning: error copying .desktop entry." - setup( - name = "jsoninspector", + name = "Jsoninspector", version = "2.0", - packages = find_packages('src', exclude=['ez_setup']), - scripts = ['src/jsoninspector.py'], + packages = find_packages('src', exclude = ['ez_setup']), + entry_points = { 'gui_scripts' : [ 'jsoninspector = jsoninspector:main_start' ] }, include_package_data = True, + package_dir = { '' : 'src' }, package_data = { # If any package contains *.glade files, include them: 'src': ['*.glade'], diff --git a/src/__init__.py b/src/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/jsoninspector/__init__.py b/src/jsoninspector/__init__.py new file mode 100644 index 0000000..6954003 --- /dev/null +++ b/src/jsoninspector/__init__.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from jsoninspector import LogicObject, MainWindowMethods + +def main_start(): + """ + So setuptools makes a nice startup script + """ + logicObject = LogicObject() + + mainWindow = MainWindowMethods(logicObject) + mainWindow.run(None) diff --git a/src/jsoninspector.py b/src/jsoninspector/jsoninspector.py similarity index 98% rename from src/jsoninspector.py rename to src/jsoninspector/jsoninspector.py index 42a5f23..2661a74 100644 --- a/src/jsoninspector.py +++ b/src/jsoninspector/jsoninspector.py @@ -11,10 +11,10 @@ import locale APP = "jsoninspector" -if os.path.exists('../locale/po') and os.path.exists('../res'): +if os.path.exists('../locale/po') and os.path.exists('../../res'): # We're in the development tree - DIR = "../locale/po/" - RESOURCES = "../res/" + DIR = "../../locale/po/" + RESOURCES = "../../res/" elif sys.platform != 'win32' and sys.platform != 'darwin': DIR = "/usr/share/locale/" @@ -281,6 +281,8 @@ class LogicObject(object): str(type(elems[key_val]))]) + + # Main procedure if __name__ == "__main__":