This commit is contained in:
Lucca Ketterer 2023-06-15 12:29:53 +02:00
parent 635682cbf9
commit 78c89ad9c3
3 changed files with 14 additions and 12 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
venv/
__pycache__
node_modules

View File

@ -105,10 +105,10 @@ def main(arg):
def run(): def run():
config.set_option('server.headless', True) config.set_option('server.headless', True)
# bootstrap.run(gui.__file__, 'streamlit run gui.py --server.headless True', [], di) bootstrap.run(gui.__file__, 'streamlit run gui.py --server.headless True', [], di)
# p = multiprocessing.Process(target=run) p = multiprocessing.Process(target=run)
# p.start() p.start()
# import requests # import requests
@ -122,15 +122,15 @@ def main(arg):
# cli.main_run(str(gui.__file__)) # cli.main_run(str(gui.__file__))
# from streamlit.web.server import Server # from streamlit.web.server import Server
# server = Server(gui.__file__, 'streamlit run gui.py --server.headless True') # server = Server(gui.__file__, 'streamlit run gui.py --server.headless True')
import tornado.web # import tornado.web
class MainHandler(tornado.web.RequestHandler): # class MainHandler(tornado.web.RequestHandler):
def get(self): # def get(self):
self.write("Hello, world") # self.write("Hello, world")
application = tornado.web.Application([ # application = tornado.web.Application([
(r"/", ), ]) # (r"/", ), ])
application.listen(8888) # application.listen(8888)
webview.create_window('LED Control', application) webview.create_window('LED Control', application)
webview.start() webview.start()

View File

@ -33,7 +33,6 @@ def main():
except FileNotFoundError: except FileNotFoundError:
return {'color': '000000', 'saved': []} return {'color': '000000', 'saved': []}
def save(conf): def save(conf):
path = os.path.expanduser("~/.config/lc/lc.dmp") path = os.path.expanduser("~/.config/lc/lc.dmp")
with open(path, 'wb') as f: with open(path, 'wb') as f:
@ -63,7 +62,7 @@ def main():
st.session_state.config['color'] = color[1:] st.session_state.config['color'] = color[1:]
save(st.session_state.config) save(st.session_state.config)
controller.set_pixels(color[1:]) #controller.set_pixels(color[1:])
img = Image.new(mode="RGB", size=(30,30), color=(int(r * 255),int(g * 255),int(b * 255))) img = Image.new(mode="RGB", size=(30,30), color=(int(r * 255),int(g * 255),int(b * 255)))
st.subheader(color) st.subheader(color)