From 68effe8a5f8ed487485f85ff788351b088f85627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Thu, 27 May 2010 17:45:19 +0200 Subject: [PATCH] version 1.5. Ahora instalable en el sistema. --- setup.py | 5 +++-- src/{jsoninspector => }/__init__.py | 0 src/{jsoninspector => }/jsoninspector.glade | 0 src/{jsoninspector => }/jsoninspector.py | 17 +++++++---------- 4 files changed, 10 insertions(+), 12 deletions(-) rename src/{jsoninspector => }/__init__.py (100%) rename src/{jsoninspector => }/jsoninspector.glade (100%) rename src/{jsoninspector => }/jsoninspector.py (97%) diff --git a/setup.py b/setup.py index 76175db..f42fd08 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,11 @@ from setuptools import setup, find_packages setup( name = "jsoninspector", version = "1.2", - packages = find_packages(), + packages = find_packages('src', exclude=['distribute_setup']), + scripts = ['src/jsoninspector.py'], entry_points = { 'gui_scripts': [ - 'jsoninspector = jsoninspector.MainApp.start', + 'jsoninspector = jsoninspector:MainApp.start', ] }, package_data = { diff --git a/src/jsoninspector/__init__.py b/src/__init__.py similarity index 100% rename from src/jsoninspector/__init__.py rename to src/__init__.py diff --git a/src/jsoninspector/jsoninspector.glade b/src/jsoninspector.glade similarity index 100% rename from src/jsoninspector/jsoninspector.glade rename to src/jsoninspector.glade diff --git a/src/jsoninspector/jsoninspector.py b/src/jsoninspector.py similarity index 97% rename from src/jsoninspector/jsoninspector.py rename to src/jsoninspector.py index 4fbd64a..ecd541d 100644 --- a/src/jsoninspector/jsoninspector.py +++ b/src/jsoninspector.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from pkg_resources import resource_filename + import json import sys import pygtk @@ -23,7 +25,7 @@ class MainWindowMethods(object): principal """ self.builder = gtk.Builder() - self.builder.add_from_file("jsoninspector.glade") + self.builder.add_from_file(resource_filename(__name__,'../../src/jsoninspector.glade')) self.builder.connect_signals(self) # Prepara los renderizados de columna y las asigna a los valores @@ -243,21 +245,16 @@ class LogicObject(object): str(elems[key_val]), str(type(elems[key_val]))]) + class MainApp(object): """ Clase principal """ - def __init__(self): - """ - Inicialización - """ - self.logicObject = LogicObject() + @staticmethod + def start(): + logicObject = LogicObject() mainWindow = MainWindowMethods(logicObject) - def start(self): - """ - Comienza el programa - """ gtk.main()