codelv / enaml-web Goto Github PK
View Code? Open in Web Editor NEWBuild interactive websites with enaml
Home Page: https://codelv.com/projects/enaml-web/
License: MIT License
Build interactive websites with enaml
Home Page: https://codelv.com/projects/enaml-web/
License: MIT License
Is there any way to integrate this with django currently?
If not, can I use this to spit out static html?
The image for the rendered form is broken.
Currently an Atom subclass is provided to support saving/restoring objects to and from MongoDB.
I need to also add support for SQL tables via sqlalchemy.
Better docs than the readme would be nice.
Hello,
I would like to launch a a func for collecting datas from the DB and assigning to component attribute at widget initialization.
Currently, I have this working by launching my function in my main.py file in the tornado RequestHandler. I would like to make my component containing the maximum code it use.
enamldef MyComponent(Html):
attr datas
async func get_datas_from_db(**parameters):
return datas
IOLoop.current().add_callback(get_datas_from_db, parameters) # Here is the syntax error
Conditionnal:
condition << datas is not None
Looper:
...........
I haven't seen something like on_prepare
which could be usefull (prepare)
Any idea ?
Regards
Streamed HTML as discussed here: The weirdly obscure art of Streamed HTML looks nice for performance enhancement.
I got an idea to have something similar in enaml-web but don't know if realistic:
I think we can add a "compute_order"property to Tag (default to 1). At the first pass for render, the engine will only compute Nodes (Tags) with compute_order=1 and send result to the browser. A second pass is done for rendering nodes with "compute_order=2". New nodes and updates are send to the client with websocket.
Do you thing it can be a good approach ?
Do you think it can be achieved without rewriting all enaml ?
Edit: The above question solution will be useless in my case because I want an async function to be run when observed value change and I think I'll not able to call such a function inside enaml block.
I would like to create a component with business logic embedded.
Select:
self.observe('value', test)
func test(self, change):
pass
Option:
value = "0"
text = "Zero"
Option:
value = "1"
text = "One"
A syntax error is raised.
Any idea if it's possible ?
child_moved needs handled
Been trying out enaml I can see it has conditionals is this the best way to do this something like this ?
conditional << 2 % index
conditional:
Div:
cls = 'one'
conditional:
Div:
cls = 'two'
or is there a way to do this in a single line ?
I'm interested in a very simple page that just provided an upload button.
If this was desktop Enaml I guess I would follow these steps:
file
to get the bytes and then "do stuff" with bytes.Are there similar widgets in Enable-Web? How might you go about doing this?
I'd like to have a kinda row/column view and populate each cell with graphical and interactive elements, not just text.
Ideally it would have a top search field for each column, pretty much like in https://github.com/frmdstryr/smd-search
Have you an idea to start with ?
Regards.
Hello.
I'm trying to setup a muti-pages website (was websocket only before).
My Base page is structured like this:
# index.enaml
enamldef Item(Div):
attrs item_ref
enamldef Statistics(Div):
attrs datas
enamldef Home(Div):
attrs datas
enamldef Index(MaterializePage): index:
Block:
block = parent.header
.........
Block: main_content:
block = parent.content
Home:
pass
# main.py
class IndexHandler(RequestHandler):
async def get(self):
path = self.request.path
page = path.split('/)[1]
if page == 'home':
datas = await Model_A().get_datas()
if page == 'statistics':
datas = await Model_B().get_datas()
index = Index()
#
# Here, how to change the content of index.main_content with datas set to the choosed child datas attribute
#
self.write(index.render())
I was wondering if there is a solution for changing the main_content child widget with specific attributes datas from python file. This file handle request.
Do you have any suggestion about other patterns to accomplish that ?
Regards
enaml-web/web/impl/lxml_app.py
Line 83 in ff29147
from web.impl.lxml_app import LxmlApplication
import signal
def main():
app = LxmlApplication()
app.init_reloader()
signal.pause()
results in
Detected changes in ./index.enaml, scheduling reload...
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/dev/.pyenv/versions/3.6.5/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/dev/.local/share/virtualenvs/quiz_backend-RJ5HRaNa/lib/python3.6/site-packages/watchdog/observers/api.py", line 199, in run
self.dispatch_events(self.event_queue, self.timeout)
File "/home/dev/.local/share/virtualenvs/quiz_backend-RJ5HRaNa/lib/python3.6/site-packages/watchdog/observers/api.py", line 368, in dispatch_events
handler.dispatch(event)
File "/home/dev/.local/share/virtualenvs/quiz_backend-RJ5HRaNa/lib/python3.6/site-packages/watchdog/events.py", line 322, in dispatch
self.on_any_event(event)
File "/home/dev/.local/share/virtualenvs/quiz_backend-RJ5HRaNa/lib/python3.6/site-packages/web/impl/lxml_app.py", line 83, in on_any_event
app.deferred_call(self.queue_reload)
File "/home/dev/.local/share/virtualenvs/quiz_backend-RJ5HRaNa/lib/python3.6/site-packages/enaml/application.py", line 278, in deferred_call
raise NotImplementedError
NotImplementedError
Hi, I'm getting this error in the browser console when running the data binding demo using tornado. Any ideas where to start looking? Shall I check the javascript or do you think it's tornado?
VM47:164 WebSocket connection to 'ws://localhost:8888/' failed: Error during WebSocket handshake: Unexpected response code: 200
WrappedWebSocket @ VM47:164
Thanks
How to add existing dynamic JavaScript widget like Plot.ly?
Or if the JavaScript widget has some interface/API/signals that the app should react on then how to connect to them?
Hi @frmdstryr could you give some comments on how to serve a site with a different instance of the model for each browser window? When I was testing enaml-web a couple of months ago, every new browser window would show the same view when changes were made in one view. Perhaps this is just my lack of understanding of tornado?
In debug mode, should display a page like django does .
Hello,
I'll have to create a project. I'm hesitating using enaml-web with Django. Enaml-web is so fun !!
I have seen the question has already been asked #8.
You have answered
Yes. You can create a LxmlApplication which has no server component and then render pages for any application (django, flask, etc..) or save them to a file to make a static site.
You talked about LxmlApplication. Haven't see any code relating to that in master.
Could you give me some hints and how to do this coupling ?
Regards
It always appends to the end
Hello !!!
I'm trying to integrate Enaml-web and Django using the CACHE system used ind dataframe example here:
I don't achieve to persist this object between users interactions, in other works, after the answer has been sent back to the user browser.
Any idea to achieve that ?
Here is my simple view:
from django.http import HttpResponse
from web.core.app import WebApplication
import enaml
with enaml.imports():
from .index import Index
enaml_web_app = WebApplication()
def testview(request):
# I would like to cache index to be able to retrieve it later.
index = Index()
return HttpResponse(index.render())
THIS might sound a little annoying,
I'm trying to use it as a markup language, because i'm sick of writing HTML.
I don't want to deal with the hassle of running python on web browser or using web-sockets to communicate with server.
I just want a better way to write UI than HTML
Related SO question
Ex this does not retain the order of 'Home', *menu_items, 'Contact
Ul:
Li:
text = 'Home'
Looper:
iterable << menu_items
Li:
text = loop_item
Li:
text = 'Contact'
When a new item is added to the menu_items
it is appended after last item ('Contact' in the example) when it should be inserted in proper order. To support this the child_added event must include the index where it should be inserted.
Hi, I'd like to have a TreeListView like :
https://github.com/frmdstryr/enamlx/tree/master/examples/tree_view
Ideally, two of them with Drag'n Drop between them, is it feasible ?
Regards.
pip install git+https://github.com/codelv/enaml-web.git
Collecting git+https://github.com/codelv/enaml-web.git
Cloning https://github.com/codelv/enaml-web.git to /private/var/folders/mn/wzflzlvn1ngg1vtyzd0s4sgc0000gn/T/pip-f734ms7a-build
Collecting distribute (from enaml-web==0.1.0)
Using cached distribute-0.7.3.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/mn/wzflzlvn1ngg1vtyzd0s4sgc0000gn/T/pip-build-4lkpjyuv/distribute/setuptools/__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "/private/var/folders/mn/wzflzlvn1ngg1vtyzd0s4sgc0000gn/T/pip-build-4lkpjyuv/distribute/setuptools/extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "/private/var/folders/mn/wzflzlvn1ngg1vtyzd0s4sgc0000gn/T/pip-build-4lkpjyuv/distribute/setuptools/dist.py", line 7, in <module>
from setuptools.command.install import install
File "/private/var/folders/mn/wzflzlvn1ngg1vtyzd0s4sgc0000gn/T/pip-build-4lkpjyuv/distribute/setuptools/command/__init__.py", line 8, in <module>
from setuptools.command import install_scripts
File "/private/var/folders/mn/wzflzlvn1ngg1vtyzd0s4sgc0000gn/T/pip-build-4lkpjyuv/distribute/setuptools/command/install_scripts.py", line 3, in <module>
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "/private/var/folders/mn/wzflzlvn1ngg1vtyzd0s4sgc0000gn/T/pip-build-4lkpjyuv/distribute/pkg_resources.py", line 1518, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/mn/wzflzlvn1ngg1vtyzd0s4sgc0000gn/T/pip-build-4lkpjyuv/distribute/
Is there such a list to see the implementation of enaml-web
from different people ?
Regards
I noticed that the examples all use cyclone
, which is Python2 only. Is it possible to use enaml-web
with any Python3 web servers?
Do you think it's possible to replace a plotly graph with websocket by just modifyng the traces
and display
attribute of PlotlyGraph component ?
It doesn't works for me. Plotly.js doesn't seems to react when data-traces
are modified in the DOM.
Any idea to do that without writing js for collecting all datas from Plotly div attribute and lauching a Plotly.react command ?
The about section of this repo points to www.codelv.com/projects/enaml-web/ which is not a working link.
Hi,
I have a domain that is served through a WGSI engine.
Is there a way to startup Enaml-web instead ?
Regards.
Better support for svg would be nice
enaml-web/web/components/html.py
Line 456 in e3a631f
Trying to add open graph data but I cant use property I assume it needs to be added to the above link ?
Or perhaps not as property does not appear to be a standard tag, so would I need to create a new element type ? and if so any docs on how to go about doing that ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.