Comments (3)
Hey there, that's a reasonable use case. You can get the web app running locally by installing the dependencies with poetry install --with streamlit
, then running streamlit run streamlit/app.py
. However I don't know if this will help you much, since the Streamlit stack is pretty integrated and it would be hard to pick out individual parts like web serving with auto-refresh (or at least I am not familiar enough with how it works internally to do that).
If I were you, I'd set up a file watcher like entr to automatically call keymap draw
on file change, like:
echo keymap.yaml | entr -s 'keymap draw keymap.yaml >keymap.svg'
Then you could set up a separate one to open the browser (or another svg viewer), the -r flag should help to not create a new window/tab every time:
echo keymap.svg | entr -r firefox keymap.svg
(Note I haven't tested above since I don't have computer access for a few days.)
I think a keymap serve
subcommand might be nice if it ends up a simple enough implementation and if the dependencies are either very light or can be made optional.
from keymap-drawer.
Thanks! That's actually a better solution than firing up the webapp, because that UI doesn't make sense anyway for this usecase, just displaying the svg is better. The solution works great except it opens in a new tab in firefox for each update, I'm not sure there's a way around that, looking at the command line flags for firefox.
Using something like https://github.com/lepture/python-livereload might be necessary to get autoreload working, I actually tried that but it unsurprisingly does not work when viewing svg-files. I'm guessing wrapping it an html page would do the trick.
So another solution that would probably be doable in 10 lines of code is adding the livereload module or similar to create a serve-command.
I'm guessing there's also a firefox extension that would allow autoreload of local files, so that's another option.
from keymap-drawer.
Great, opening a new tab everytime sounds annoying but you could replace that second part with an autoreload plugin indeed.
Thanks for the pointer to livereload, I can play around with that a bit when I get a chance. (PRs are also welcome!)
from keymap-drawer.
Related Issues (20)
- kinesis zmk keymap: "default_layer" (82) does not match physical layout specification (76) HOT 5
- Provide config option to enable drawing of held key's binding HOT 5
- Fetched SVGs not showing in web app or embedded in readme.md HOT 2
- Feature request: Support via json HOT 7
- Feature request: Alt-Gr key labels HOT 1
- Question: Missing shifted when parsing from qmk JSON HOT 3
- Some config options don't seem to have any effect, unclear why HOT 4
- Alternative combo displays HOT 1
- Workflow draw_args not applied HOT 6
- Feature request: export layout config for the GitHub action HOT 3
- Feature request: show us intl keys HOT 13
- Feature request: render specific layer(s) HOT 3
- Separate Combos on ZMK HOT 4
- Feature request: binding inheritence or aliases HOT 2
- Get help action to add to ZMK archive. HOT 6
- Upgrading to `v0.13.0` lose `trans_legend` config HOT 4
- MoErgo's Glove80's triggering the assert "Number of keys on layer {} does not match physical layout specification" HOT 2
- feature request: add support for overlaid devicetree node property values HOT 5
- TRANS keys some times not picked up correctly HOT 2
- View is cut off when combo description is offset HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keymap-drawer.