add webview gui, define text font, remove unused import

This commit is contained in:
2021-04-04 20:31:19 +02:00
parent 8c4a6a495c
commit ea1b8f558e
3 changed files with 27 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
import sys
from os import path, sep, makedirs
from subprocess import Popen, PIPE, STDOUT
from configparser import ConfigParser, DuplicateSectionError
from configparser import ConfigParser
from re import search, IGNORECASE
from justpy import Div, WebPage, SetRoute, justpy
@@ -51,7 +51,7 @@ class Button(Div):
command = None
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.classes = "bg-gray-800 hover:bg-gray-700 w-20 h-20 m-2 p-1 rounded-lg font-bold flex items-center text-center justify-center select-none"
self.classes = "bg-gray-800 hover:bg-gray-700 text-gray-500 w-20 h-20 m-2 p-1 rounded-lg font-bold flex items-center text-center justify-center select-none"
if self.command is not None:
def click(self, msg):
print(self.command)
@@ -81,7 +81,7 @@ class ButtonSound(Div):
Button(inner_html=f'{self.description}<br> - 5%', click=self.decrease, a=self.div)
Button(inner_html=f'{self.description}<br> + 5%', click=self.increase, a=self.div)
self.add(self.div)
self.volume = Div(text=f"Volume: {volume(self.name)}%", classes="text-center -mt-2", a=self)
self.volume = Div(text=f"Volume: {volume(self.name)}%", classes="text-gray-600 text-center -mt-2", a=self)
async def decrease(self, msg):
self.volume.text = f'Volume: {volume_decrease(self.name)}%'

21
controldeck_gui.py Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python
import sys
from webview import create_window, start
import controldeck
def main():
if controldeck.process("ps -ef | grep -i controldeck.py | grep -v grep") == "":
controldeck.main()
create_window("ControlDeck",
url="http://0.0.0.0:8000",
width=800,
height=600,
frameless=True,
easy_drag=True,
background_color='#000000',
transparent=True)
start()
if __name__ == '__main__':
sys.exit(main())

View File

@@ -4,9 +4,12 @@ name = ControlDeck
[options]
install_requires =
justpy
pywebview
py_modules =
controldeck
controldeck-gui
[options.entry_points]
console_scripts =
controldeck = controldeck:main
controldeck-gui = controldeck_gui:main