Made it so the font actually gets loaded, fixed run.sh
This commit is contained in:
parent
b6e7445d5f
commit
b63565646a
31
main.py
31
main.py
@ -7,23 +7,17 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import threading
|
|
||||||
import io
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
from flask import request
|
from flask import request
|
||||||
from flask import jsonify
|
from flask import jsonify
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout, QHBoxLayout
|
from PyQt5.QtWidgets import *
|
||||||
from PyQt5.QtCore import Qt, QObject, QTimer, QRect, pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import *
|
||||||
from PyQt5.QtGui import QPainter, QColor, QFont, QPen, QBrush, QPixmap, QPainterPath
|
from PyQt5.QtGui import *
|
||||||
|
|
||||||
from multiprocessing import Queue
|
from multiprocessing import Queue
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
os.environ["LC_ALL"] = "C"
|
os.environ["LC_ALL"] = "C"
|
||||||
os.environ["LANG"] = "C"
|
os.environ["LANG"] = "C"
|
||||||
|
|
||||||
@ -37,6 +31,10 @@ M3U_URL = os.environ.get('IPMPV_M3U_URL')
|
|||||||
|
|
||||||
class OsdWidget(QWidget):
|
class OsdWidget(QWidget):
|
||||||
def __init__(self, channel_info, width=600, height=165, close_time=5, corner_radius=int(osd_corner_radius) if osd_corner_radius is not None else 15):
|
def __init__(self, channel_info, width=600, height=165, close_time=5, corner_radius=int(osd_corner_radius) if osd_corner_radius is not None else 15):
|
||||||
|
|
||||||
|
QFontDatabase.addApplicationFont('FiraSans-Regular.ttf')
|
||||||
|
QFontDatabase.addApplicationFont('FiraSans-Bold.ttf')
|
||||||
|
|
||||||
global is_wayland
|
global is_wayland
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@ -138,7 +136,7 @@ class OsdWidget(QWidget):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Failed to load logo: {e}")
|
print(f"Failed to load logo: {e}")
|
||||||
|
|
||||||
def paintEvent(self, event):
|
def paintEvent(self, a0):
|
||||||
painter = QPainter(self)
|
painter = QPainter(self)
|
||||||
painter.setRenderHint(QPainter.Antialiasing)
|
painter.setRenderHint(QPainter.Antialiasing)
|
||||||
|
|
||||||
@ -165,7 +163,6 @@ class OsdWidget(QWidget):
|
|||||||
# Setup text drawing
|
# Setup text drawing
|
||||||
painter.setPen(QColor(255, 255, 255))
|
painter.setPen(QColor(255, 255, 255))
|
||||||
|
|
||||||
# Use Fira Sans as originally intended
|
|
||||||
try:
|
try:
|
||||||
font = QFont("Fira Sans", 18)
|
font = QFont("Fira Sans", 18)
|
||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
@ -823,10 +820,10 @@ def toggle_resolution():
|
|||||||
return jsonify(res=get_current_resolution())
|
return jsonify(res=get_current_resolution())
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Start Qt process
|
# Start Qt process
|
||||||
qt_proc = multiprocessing.Process(target=qt_process)
|
qt_proc = multiprocessing.Process(target=qt_process)
|
||||||
qt_proc.daemon = True
|
qt_proc.daemon = True
|
||||||
qt_proc.start()
|
qt_proc.start()
|
||||||
|
|
||||||
# Start Flask in main thread
|
# Start Flask in main thread
|
||||||
app.run(host="0.0.0.0", port=5000)
|
app.run(host="0.0.0.0", port=5000)
|
||||||
|
|||||||
6
run.sh
6
run.sh
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
# Check if virtual environment already exists
|
# Check if virtual environment already exists
|
||||||
if [ -d "./.venv" ]; then
|
if [ -d "./.venv" ]; then
|
||||||
echo "Virtual environment already exists."
|
echo "Virtual environment already exists."
|
||||||
@ -8,6 +10,8 @@ else
|
|||||||
python -m venv --system-site-packages ./.venv
|
python -m venv --system-site-packages ./.venv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Activate the virtual environment
|
# Activate the virtual environment
|
||||||
source ./.venv/bin/activate
|
source ./.venv/bin/activate
|
||||||
|
|
||||||
@ -16,4 +20,4 @@ pip install -r requirements.txt
|
|||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
echo "Starting..."
|
echo "Starting..."
|
||||||
python main.py
|
python main.py &> ipmpv.log
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user