realnet
Advanced tools
| # Code goes here.... | ||
| from realnet.resource.items.items import Items | ||
| class Resource(Items): | ||
| pass |
+1
-1
| Metadata-Version: 2.1 | ||
| Name: realnet | ||
| Version: 0.0.105 | ||
| Version: 0.0.106 | ||
| Summary: Realnet command line interface | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/virtual-space/realnet |
| Metadata-Version: 2.1 | ||
| Name: realnet | ||
| Version: 0.0.105 | ||
| Version: 0.0.106 | ||
| Summary: Realnet command line interface | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/virtual-space/realnet |
@@ -127,2 +127,3 @@ LICENSE | ||
| realnet/static/initialization/geometry.json | ||
| realnet/static/initialization/resource.py | ||
| realnet/static/initialization/views.json | ||
@@ -129,0 +130,0 @@ realnet/templates/__init__.py |
@@ -32,26 +32,30 @@ import importlib.util | ||
| if resource_item: | ||
| # Check if there is a child function with that name and return that | ||
| funcs = [f for f in resource_item.items_of_type('Func') if f.name.lower() == method_name.lower()] | ||
| if funcs: | ||
| func = next(iter(funcs), None) | ||
| if func: | ||
| return Func(func) | ||
| module_path = resource_item.attributes.get('module_path') | ||
| module_class_name = resource_item.attributes.get('module_class') | ||
| if module_path: | ||
| resource_module = importlib.import_module(module_path) | ||
| resource_class = getattr(resource_module, module_class_name) | ||
| resource_instance = resource_class() | ||
| func = getattr(resource_instance, method_name, None) | ||
| if callable(func): | ||
| return Func(callback=lambda module, endpoint, args, path, content_type : func(module, endpoint, args, path, content_type)) | ||
| code = resource_item.attributes.get('code') | ||
| if not code: | ||
| resource_data = module.get_data(resource_item.id) | ||
| if resource_data: | ||
| code = resource_data.decode('utf-8') | ||
| return | ||
| resource_data = None | ||
| if module_path: | ||
| resource_module = importlib.import_module(module_path) | ||
| resource_class = getattr(resource_module, module_class_name) | ||
| resource_instance = resource_class() | ||
| func = getattr(resource_instance, method_name, None) | ||
| if callable(func): | ||
| return Func(callback=lambda module, endpoint, args, path, content_type : func(module, endpoint, args, path, content_type)) | ||
| else: | ||
| resource_data = module.get_data(resource_item.id) | ||
| if resource_data: | ||
| code = resource_data.bytes.decode('utf-8') | ||
| if code: | ||
| d = dict(globals()) | ||
| l = dict(locals()) | ||
| res = exec(code, d, l) | ||
| cls = l.get('Resource') | ||
| if cls: | ||
| resource_instance = cls() | ||
| func = getattr(resource_instance, method_name, None) | ||
| if callable(func): | ||
| return Func(callback=lambda module, endpoint, args, path, content_type : func(module, endpoint, args, path, content_type)) | ||
| return None |
@@ -0,1 +1,3 @@ | ||
| import os | ||
| import sys | ||
| from flask import render_template, jsonify | ||
@@ -24,2 +26,4 @@ from realnet.resource.items.items import Items | ||
| resource_item = module.create_item(name=args.get('resource'), type='Resource', attributes={'module':'true'}, public='true') | ||
| with open(os.path.join(os.path.abspath(os.path.join(os.path.dirname(sys.modules[__name__].__file__), os.pardir)), '../static/initialization/resource.py'), 'r') as f: | ||
| module.update_data(resource_item.id, f.read()) | ||
@@ -26,0 +30,0 @@ app_endpoint = module.get_endpoint(module, args.get('endpoint')) |
@@ -11,4 +11,4 @@ import mimetypes | ||
| attributes = dict() | ||
| attributes['filename'] = args.get('filename', ['file.tmp'])[0] | ||
| attributes['filesize'] = args.get('size', 0)[0] | ||
| attributes['filename'] = args.get('filename', 'file.tmp') | ||
| attributes['filesize'] = args.get('size', 0) | ||
| content_type = mimetypes.guess_type(attributes['filename'].lower())[0] | ||
@@ -42,7 +42,7 @@ if not content_type: | ||
| arguments['type'] = args.get('type', typename) | ||
| parent_id = args.get('parent_id', [None])[0] | ||
| parent_id = args.get('parent_id', [None]) | ||
| target = 'item' | ||
| if parent_id: | ||
| if 'target' in args: | ||
| target = args['target'][0] | ||
| target = args['target'] | ||
@@ -115,4 +115,9 @@ if target == 'type': | ||
| # module.create_item(**args) | ||
| if 'add' in args: | ||
| del args['add'] | ||
| elif path and path.endswith('/data'): | ||
| file_id = path.split('/')[-2] | ||
| file = module.get_item(file_id) | ||
| if file and module.can_account_write_item(module.get_account(), file): | ||
| module.update_data(file.id, args.get('data', None)) | ||
| return jsonify(file.to_dict()), 200 | ||
| return self.render_item(module, endpoint, args, path, content_type) |
@@ -871,3 +871,3 @@ { | ||
| "attributes": { | ||
| "query": {"types": ["Media"], "my_items": "true"}, | ||
| "query": {"types": ["Media"], "children": "true"}, | ||
| "menu": [ | ||
@@ -972,3 +972,3 @@ { | ||
| "name": "Folder", | ||
| "base": "Media", | ||
| "base": "File", | ||
| "attributes": { | ||
@@ -994,3 +994,3 @@ "icon": "folder", | ||
| "name": "Document", | ||
| "base": "Media", | ||
| "base": "File", | ||
| "attributes": { | ||
@@ -1009,3 +1009,3 @@ "icon": "description", | ||
| "name": "Page", | ||
| "base": "Media", | ||
| "base": "File", | ||
| "attributes": { | ||
@@ -1024,3 +1024,3 @@ "icon": "web_asset", | ||
| "name": "Image", | ||
| "base": "Media", | ||
| "base": "File", | ||
| "attributes": { | ||
@@ -1039,3 +1039,3 @@ "icon": "image", | ||
| "name": "Video", | ||
| "base": "Media", | ||
| "base": "File", | ||
| "attributes": { | ||
@@ -1054,3 +1054,3 @@ "icon": "ondemand_video", | ||
| "name": "Drawing", | ||
| "base": "Media", | ||
| "base": "File", | ||
| "attributes": { | ||
@@ -1068,18 +1068,4 @@ "icon": "gesture", | ||
| { | ||
| "name": "Folder", | ||
| "base": "Media", | ||
| "attributes": { | ||
| "icon": "folder", | ||
| "creatable": "true", | ||
| "views": [ | ||
| { | ||
| "name": "Children", | ||
| "type": "ListView" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "name": "Scene", | ||
| "base": "Media", | ||
| "base": "File", | ||
| "attributes": { | ||
@@ -1086,0 +1072,0 @@ "icon": "view_in_ar", |
@@ -136,8 +136,10 @@ <!DOCTYPE html> | ||
| $($(this).attr('data-target')).find('.modal-footer #create_submitting').hide(); | ||
| const tagin = new Tagin($($(this).attr('data-target')).find('.tagin')); | ||
| //const t = $($(this).attr('data-target')).find('.tagin'); | ||
| // const tagin = new Tagin(); | ||
| //console.log($($(this).attr('data-target')).find('.modal-body #control_target').val()) | ||
| $(document).on('change', '#file', function(e) { | ||
| //console.log(e); | ||
| //console.log(e.target.files); | ||
| console.log(e); | ||
| console.log(e.target.files); | ||
| //console.log($('#file')[0].files); | ||
@@ -144,0 +146,0 @@ var nextSibling = e.target.nextElementSibling; |
@@ -327,2 +327,3 @@ {% set views=None %} | ||
| <input type="hidden" id="language" value="python"> | ||
| <input type="hidden" id="file_id" value="{{item.id}}"> | ||
| </div> | ||
@@ -340,3 +341,3 @@ <div class="col-2"> | ||
| <div class="col-md-12"> | ||
| <div id="editor" style="min-height: 85vh; width:100%;"># Code goes here....</div> | ||
| <div id="editor" style="min-height: 85vh; width:100%;"></div> | ||
| </div> | ||
@@ -365,3 +366,12 @@ </div> | ||
| } | ||
| file_id = $('#file_id').val(); | ||
| if(file_id) { | ||
| $.ajax({ | ||
| url: '/files/' + file_id + '/data', | ||
| type: 'GET', | ||
| success: function(result){ | ||
| editor.setValue(result); | ||
| } | ||
| }); | ||
| } | ||
| $('#save').on('click', function(event) { | ||
@@ -375,3 +385,3 @@ //console.log('clicked'); | ||
| $.ajax({ | ||
| url: '/admin/filemgmt/' + $('#file_id').val() + '/edit', | ||
| url: '/files/' + file_id + '/data', | ||
| type: 'POST', | ||
@@ -378,0 +388,0 @@ data : formData, |
+1
-1
@@ -13,3 +13,3 @@ import pathlib | ||
| name="realnet", | ||
| version="0.0.105", | ||
| version="0.0.106", | ||
| description="Realnet command line interface", | ||
@@ -16,0 +16,0 @@ long_description=README, |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
2341018
0.04%140
0.72%19407
0.01%