2025-02-14 14:22:23 +08:00
|
|
|
from PyQt5.QtWidgets import QMainWindow
|
2024-11-21 11:39:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
class AppContext:
|
|
|
|
"""
|
|
|
|
存放一些全局服务对象
|
|
|
|
"""
|
|
|
|
# 显示比例
|
|
|
|
_display_ratio = 1
|
|
|
|
# EdgeContext
|
|
|
|
_edge_context = None
|
2025-02-14 14:22:23 +08:00
|
|
|
# 主窗口
|
|
|
|
_main_window: QMainWindow = None
|
2024-11-21 11:39:52 +08:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def set_ratio(ratio):
|
|
|
|
AppContext._display_ratio = ratio
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_ratio():
|
|
|
|
return AppContext._display_ratio
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def set_edge_context(ctx):
|
|
|
|
AppContext._edge_context = ctx
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_edge_context():
|
2025-02-14 14:22:23 +08:00
|
|
|
return AppContext._edge_context
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def set_main_window(win):
|
|
|
|
AppContext._main_window = win
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_main_window():
|
|
|
|
return AppContext._main_window
|