mirror of
http://git.xinwangdao.com/cnnc-embedded-parts-detect/detect-gui.git
synced 2025-06-24 05:04:12 +08:00
38 lines
765 B
Python
38 lines
765 B
Python
from PyQt5.QtWidgets import QMainWindow
|
|
|
|
|
|
class AppContext:
|
|
"""
|
|
存放一些全局服务对象
|
|
"""
|
|
# 显示比例
|
|
_display_ratio = 1
|
|
# EdgeContext
|
|
_edge_context = None
|
|
# 主窗口
|
|
_main_window: QMainWindow = None
|
|
|
|
@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():
|
|
return AppContext._edge_context
|
|
|
|
@staticmethod
|
|
def set_main_window(win):
|
|
AppContext._main_window = win
|
|
|
|
@staticmethod
|
|
def get_main_window():
|
|
return AppContext._main_window
|