Closed alexkoon closed 3 years ago
Hello, thanks You enjoy the app and thanks for the pull request. It seems that majority of users won't use server functionality and moreover 'http.server' can have some security issues. Taking it into account please add following changes before merge:
Changed the code now with a web ui tab for the webserver. This has a checkbox for enabling and disabling and a spin/text for setting the port. The default is False. Change the checkbox state starts and stops the webserver. The default port is 8000 and is hardcoded to localhost (127.0.0.1) so external machines cannot connect to it. To set the favourite you can simple run 'curl http://127.0.0.1:8000/fave/0' for the 0th favourite. I have this bound to hotkeys on my desktop to change desk height.
I also found that when --minimized was specified, the application started and quit. I added a call to
app.setQuitOnLastWindowClosed(False)
in main.py.
Note: my code has the mpl toolbar commented out.
…d to move to favourite position
First off - thanks for the code, one of the main reasons for me for using Linak was this program to allow me to do the below.
I wanted to be able to bind a keyboard short cut to move the desk to a pre-saved favourite position. I have tried deriving a command line app, but do like the UI you have and the information provided. With that, I have a pull request that starts a http server on localhost (no reason to have this on any interface), port 8000. This allows you to simply send a GET request to the server to move to a pre-saved favourite position. For example 'curl http://127.0.0.1:8000/fave/0' for the first favourite position. Not being a python developer, best to check out my code, I have only done some simple testing.
Maybe further enhancements: