Fix build issues on macos

This commit is contained in:
Brett Williams
2025-03-13 23:15:12 -05:00
parent 46e2b5f713
commit aefbad852e
3 changed files with 65 additions and 2 deletions

52
chroma-previewer.spec Normal file
View File

@@ -0,0 +1,52 @@
# -*- mode: python ; coding: utf-8 -*-
import sys
from PyInstaller.utils.hooks import collect_submodules
# Project name and entry script
app_name = "ChromaPreviewer"
entry_script = "main.py"
# Gather hidden imports for PyQt6 and OpenCV
hidden_imports = collect_submodules("cv2") + collect_submodules("PyQt6")
a = Analysis(
[entry_script],
pathex=["."], # Current directory
binaries=[],
datas=[],
hiddenimports=hidden_imports,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=None,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name=app_name,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False
)
app = BUNDLE(
exe,
name=app_name + ".app",
bundle_identifier="com.1060studios.chromapreviewer",
info_plist={
"NSCameraUsageDescription": "This app requires access to the camera for live chroma keying."
},
entitlements="entitlements.plist"
)

8
entitlements.plist Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.device.camera</key>
<true/>
</dict>
</plist>

View File

@@ -93,8 +93,11 @@ class ChromaPreviewer(QWidget):
], dtype=np.uint8) ], dtype=np.uint8)
def update_frame(self): def update_frame(self):
ret, frame = self.cap.read() try:
if not ret: ret, frame = self.cap.read()
if not ret:
return
except AttributeError:
return return
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)