2025-03-10 18:37:53 +08:00

69 lines
2.0 KiB
Python

from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame
from pygame.locals import *
import cv2
import client_lib as lib
import client_elements as elements
import math
import time
import threading
import logging
uitest_enabled = 1
global running
elements = list()
class Element:
def __init__(self, name, desc):
self.name = name
self.desc = desc
def action(self):
print("default element action")
print(f"name: {self.name}")
print(f"desc: {self.desc}")
def data_proc():
global running
pass
def input_proc():
global running
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEMOTION:
loggin.info("鼠标: ", event.pos[0] - mousepos[0], event.pos[1] - mousepos[1])
mousepos = event.pos
pass
def main():
colors = {"main":"white", "remote":"green", "warn":"red"}
fonts = {"medium":pygame.font.Font('src/font.ttf', 20), "big":pygame.font.Font('src/font.ttf', 40), "huge":pygame.font.Font('src/font.ttf', 60), "small":pygame.font.Font('src/font.ttf', 16), "tiny":pygame.font.Font('src/font.ttf', 12)}
height = 1080
width = int(height / 9 * 16)
pygame.init()
pygame.display.set_caption(f"Commodore 远程终端")
screen = pygame.display.set_mode((width, height), RESIZABLE)
icon = pygame.image.load("src/icon.ico").convert_alpha()
pygame.display.set_icon(icon)
global running
running = True
pygame.mouse.set_visible(False)
pygame.mouse.set_pos([width / 2, height / 2])
mousepos = (width / 2, height / 2)
input_thr = threading.Thread(target=input_proc, name='InputProcess')
input_thr.start()
data_thr = threading.Thread(target=data_proc, name='DataProcess')
data_thr.start()
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
if uitest_enabled == 0:
pass # load data