diff options
author | Sebastian Silva (icarito) <sebastian@sugarlabs.org> | 2012-10-09 07:26:25 (GMT) |
---|---|---|
committer | Sebastian Silva (icarito) <sebastian@sugarlabs.org> | 2012-10-09 07:26:25 (GMT) |
commit | 8cbaa8059b39256f7b6be01beb64580176b0db95 (patch) | |
tree | a310d41e120440e5a4916e95d34641b44912d7d2 | |
parent | d454e5f59d17982cb146053df1395948ef9b1d0e (diff) |
Make possible to run from command line again. Ninja IDE project file.
-rw-r--r-- | app/__init__.py | 2 | ||||
-rw-r--r-- | app/app.py | 2 | ||||
-rw-r--r-- | app/client.py | 2 | ||||
-rw-r--r-- | app/cursor.py | 4 | ||||
-rw-r--r-- | app/cursors.py | 4 | ||||
-rw-r--r-- | app/objects.py | 2 | ||||
-rw-r--r-- | interactive.py | 32 | ||||
-rw-r--r-- | red-azucar.nja | 26 | ||||
-rwxr-xr-x | red-azucar.py (renamed from mejorar-sistema) | 3 | ||||
l--------- | sugar_network_webui | 1 |
10 files changed, 69 insertions, 9 deletions
diff --git a/app/__init__.py b/app/__init__.py index 4b56d4a..6fc21cb 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012, Sebastian Silva +# Copyright (C) 2012, Sebastian Silva # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ from werkzeug import Headers import simplejson from sugar_network import sugar -from .client import Client +from client import Client _BUFFER_SIZE = 1024 * 10 diff --git a/app/client.py b/app/client.py index 0ffb1f0..70b4d6f 100644 --- a/app/client.py +++ b/app/client.py @@ -161,7 +161,7 @@ class _Resource(object): a dictionary of properties to filter resulting list """ - from .cursor import Cursor + from cursor import Cursor return Cursor(self.mountpoint, self.document, query, order_by, reply, page_size, **filters) diff --git a/app/cursor.py b/app/cursor.py index f2dd0ad..db9df81 100644 --- a/app/cursor.py +++ b/app/cursor.py @@ -17,8 +17,8 @@ import logging import collections from active_toolkit import coroutine, util, enforce -from .objects import Object -from .client import Client +from objects import Object +from client import Client _QUERY_PAGES_NUMBER = 2 diff --git a/app/cursors.py b/app/cursors.py index e53d238..37a3688 100644 --- a/app/cursors.py +++ b/app/cursors.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2012, Sebastian Silva +# Copyright (C) 2012, Sebastian Silva # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from .client import Client +from client import Client class Mount: def __init__(self, mountpoint, keep_impl=None): diff --git a/app/objects.py b/app/objects.py index 6b4ec67..c190563 100644 --- a/app/objects.py +++ b/app/objects.py @@ -19,7 +19,7 @@ from os.path import isdir, abspath from sugar_network.toolkit import sugar from active_toolkit import enforce -from .client import Client +from client import Client _logger = logging.getLogger('sugar_network.objects') diff --git a/interactive.py b/interactive.py new file mode 100644 index 0000000..264a592 --- /dev/null +++ b/interactive.py @@ -0,0 +1,32 @@ +from os.path import join, abspath, exists +from sugar_network import toolkit, local, node +from sugar_network.toolkit import sugar, sneakernet +from sugar_network.local.mounts import HomeMount, RemoteMount +from sugar_network.local.mountset import Mountset +from sugar_network.resources.volume import Volume +from active_toolkit import util, printf, application, coroutine, enforce +import gevent + +def _mountset(): + toolkit.ensure_dsa_pubkey(sugar.profile_path('owner.key')) + + _db_path = join(local.local_root.value, 'local') + volume = Volume(_db_path, lazy_open=local.lazy_open.value) + mountset = Mountset(volume) + mountset['~'] = HomeMount(volume) + mountset['/'] = RemoteMount(volume) + + return mountset + +mountset = _mountset() + +import sugar_network_webui as webui + +from gevent.wsgi import WSGIServer + +host = '0.0.0.0' # '0.0.0.0' for all +http_server = WSGIServer((host, 5000), webui.get_app(mountset)) + +import webbrowser +webbrowser.open_new_tab('localhost:5000') +http_server.serve_forever() diff --git a/red-azucar.nja b/red-azucar.nja new file mode 100644 index 0000000..99377da --- /dev/null +++ b/red-azucar.nja @@ -0,0 +1,26 @@ +{ + "mainFile": "interactive.py", + "venv": "", + "relatedProjects": [], + "name": "Red Az\u00facar", + "license": "GNU General Public License v3", + "url": "http://localhost:5000/", + "pythonPath": "python", + "preExecScript": "/usr/bin/sugar-network-service debug", + "programParams": "", + "PYTHONPATH": "", + "supported-extensions": [ + ".py", + ".html", + ".jpg", + ".png", + ".ui", + ".css", + ".json", + ".js", + ".ini" + ], + "project-type": "Import from sources", + "postExecScript": "", + "description": "" +}
\ No newline at end of file diff --git a/mejorar-sistema b/red-azucar.py index b20b7d0..3a03b57 100755 --- a/mejorar-sistema +++ b/red-azucar.py @@ -16,11 +16,12 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import sys +import optparse from os.path import dirname, join, realpath from gettext import gettext as _ from gevent.wsgi import WSGIServer -from sugar_network import application, optparse, sugar +from sugar_network import sugar SRC_ROOT = dirname(realpath(__file__)) diff --git a/sugar_network_webui b/sugar_network_webui new file mode 120000 index 0000000..f83b1b6 --- /dev/null +++ b/sugar_network_webui @@ -0,0 +1 @@ +app/
\ No newline at end of file |