mirror of https://git.48k.eu/ogclient
parent
7ace7f9403
commit
39c97fc1bc
1
ogclient
1
ogclient
|
@ -91,6 +91,7 @@ def main():
|
|||
kiosk_pid = os.fork()
|
||||
if kiosk_pid == 0:
|
||||
client.shutdown()
|
||||
configure_logging('kiosk', LOGLEVEL)
|
||||
logging.info('Launching Kiosk...')
|
||||
try:
|
||||
ret = launch_kiosk(socket=client.get_kiosk_socket_1(), debug_mode=False)
|
||||
|
|
|
@ -18,6 +18,7 @@ from src.kiosk.sidepanel import SidePanel, ViewType
|
|||
import src.kiosk.thirdparty.breeze.breeze_pyqt6
|
||||
from src.kiosk.spinner import *
|
||||
from src.kiosk.config import *
|
||||
import logging
|
||||
|
||||
|
||||
SIDE_PANEL_WIDTH = 200
|
||||
|
@ -66,9 +67,9 @@ class Kiosk(QMainWindow):
|
|||
json_data = json.dumps(data)
|
||||
self.socket.send(json_data.encode('utf-8'))
|
||||
except TypeError as e:
|
||||
print(f'Failed to encode data to JSON: {e}')
|
||||
logging.error(f'Failed to encode payload to JSON: {e}')
|
||||
except Exception as e:
|
||||
print(f'Unexpected error in send_kiosk_event: {e}')
|
||||
logging.error(f'Unexpected error in send_kiosk_event: {e}')
|
||||
|
||||
def read_from_socket(self):
|
||||
try:
|
||||
|
@ -85,9 +86,9 @@ class Kiosk(QMainWindow):
|
|||
elif payload.get('command') == 'close':
|
||||
self.close()
|
||||
except OSError as e:
|
||||
print(f'Failed to read from socket: {e}')
|
||||
logging.error(f'Failed to read from socket: {e}')
|
||||
except json.JSONDecodeError as e:
|
||||
print(f'Failed to decode JSON: {e}')
|
||||
logging.error(f'Failed to decode JSON: {e}')
|
||||
|
||||
def reload_theme(self):
|
||||
# Floating side panel
|
||||
|
|
|
@ -84,6 +84,11 @@ def _default_logging_live():
|
|||
logconfig['loggers']['']['handlers'].append('rtlog')
|
||||
return logconfig
|
||||
|
||||
def _default_logging_kiosk():
|
||||
logconfig = _default_logging_live()
|
||||
logconfig['formatters']['formatter.syslogtime']['format'] = '({asctime}) ogClient-Kiosk: [{levelname}] - {message}'
|
||||
return logconfig
|
||||
|
||||
|
||||
def _default_logging_win():
|
||||
logconfig = {
|
||||
|
@ -129,6 +134,8 @@ def configure_logging(mode, level):
|
|||
logconfig = _default_logging_linux()
|
||||
elif mode == 'live':
|
||||
logconfig = _default_logging_live()
|
||||
elif mode == 'kiosk':
|
||||
logconfig = _default_logging_kiosk()
|
||||
else:
|
||||
raise OgError(f'Logging mode {mode} not supported')
|
||||
|
||||
|
|
Loading…
Reference in New Issue