GithubHelp home page GithubHelp logo

Comments (3)

caksoylar avatar caksoylar commented on June 17, 2024

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.

anderso avatar anderso commented on June 17, 2024

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.

caksoylar avatar caksoylar commented on June 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.