Move app settings into config files
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import pyautogui
|
||||
import pygetwindow as gw
|
||||
|
||||
from common.env_config import getEnvFloat
|
||||
from common.config_loader import loadOcrConfig
|
||||
from common.project_paths import RUNTIME_DIR
|
||||
|
||||
SCREENSHOT_PATH = RUNTIME_DIR / "latest_screenshot.png"
|
||||
@@ -100,13 +100,14 @@ def clampRatio(value):
|
||||
|
||||
def getOcrRegion():
|
||||
left, top, width, height = getVrchatRegion()
|
||||
config = loadOcrConfig()
|
||||
|
||||
# Default to the lower central area. It is much faster than OCRing the
|
||||
# whole VRChat window and usually contains chat/subtitle text.
|
||||
crop_left = clampRatio(getEnvFloat("OCR_CROP_LEFT", 0.05))
|
||||
crop_top = clampRatio(getEnvFloat("OCR_CROP_TOP", 0.35))
|
||||
crop_right = clampRatio(getEnvFloat("OCR_CROP_RIGHT", 0.95))
|
||||
crop_bottom = clampRatio(getEnvFloat("OCR_CROP_BOTTOM", 0.95))
|
||||
crop_left = clampRatio(config["crop_left"])
|
||||
crop_top = clampRatio(config["crop_top"])
|
||||
crop_right = clampRatio(config["crop_right"])
|
||||
crop_bottom = clampRatio(config["crop_bottom"])
|
||||
|
||||
if crop_right <= crop_left:
|
||||
crop_left = 0.0
|
||||
|
||||
Reference in New Issue
Block a user