🚧 [WIP/TEST] Model : Overlayの処理を起動したらしっぱなしにするように変更
This commit is contained in:
@@ -427,12 +427,11 @@ def callbackToggleTranscriptionReceive(is_turned_on):
|
|||||||
view.changeTranscriptionDisplayStatus("SPEAKER_OFF")
|
view.changeTranscriptionDisplayStatus("SPEAKER_OFF")
|
||||||
|
|
||||||
if config.ENABLE_TRANSCRIPTION_RECEIVE is True and config.ENABLE_OVERLAY_SMALL_LOG is True:
|
if config.ENABLE_TRANSCRIPTION_RECEIVE is True and config.ENABLE_OVERLAY_SMALL_LOG is True:
|
||||||
if model.overlay.initialized is False:
|
if model.overlay.initialized is False and model.overlay.checkSteamvrRunning() is True:
|
||||||
model.startOverlay()
|
model.startOverlay()
|
||||||
print("model.startOverlay()")
|
print("model.startOverlay()")
|
||||||
elif config.ENABLE_TRANSCRIPTION_RECEIVE is False:
|
elif config.ENABLE_TRANSCRIPTION_RECEIVE is False:
|
||||||
model.shutdownOverlay()
|
pass
|
||||||
print("model.shutdownOverlay()")
|
|
||||||
|
|
||||||
def callbackToggleForeground(is_turned_on):
|
def callbackToggleForeground(is_turned_on):
|
||||||
config.ENABLE_FOREGROUND = is_turned_on
|
config.ENABLE_FOREGROUND = is_turned_on
|
||||||
@@ -882,12 +881,11 @@ def callbackSetEnableOverlaySmallLog(value):
|
|||||||
config.ENABLE_OVERLAY_SMALL_LOG = value
|
config.ENABLE_OVERLAY_SMALL_LOG = value
|
||||||
|
|
||||||
if config.ENABLE_OVERLAY_SMALL_LOG is True and config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
if config.ENABLE_OVERLAY_SMALL_LOG is True and config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||||
if model.overlay.initialized is False:
|
if model.overlay.initialized is False and model.overlay.checkSteamvrRunning() is True:
|
||||||
model.startOverlay()
|
model.startOverlay()
|
||||||
print("model.startOverlay()")
|
print("model.startOverlay()")
|
||||||
elif config.ENABLE_OVERLAY_SMALL_LOG is False:
|
elif config.ENABLE_OVERLAY_SMALL_LOG is False:
|
||||||
model.shutdownOverlay()
|
pass
|
||||||
print("model.shutdownOverlay()")
|
|
||||||
|
|
||||||
def callbackSetOverlaySmallLogSettings(value, set_type:str):
|
def callbackSetOverlaySmallLogSettings(value, set_type:str):
|
||||||
print("callbackSetOverlaySmallLogSettings", value, set_type)
|
print("callbackSetOverlaySmallLogSettings", value, set_type)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import os
|
||||||
import ctypes
|
import ctypes
|
||||||
import psutil
|
from psutil import process_iter
|
||||||
# from os import path as os_path
|
# from os import path as os_path
|
||||||
import ctypes
|
import ctypes
|
||||||
import time
|
import time
|
||||||
@@ -8,12 +9,6 @@ from PIL import Image
|
|||||||
# from queue import Queue
|
# from queue import Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
def checkSteamvrRunning() -> bool:
|
|
||||||
for proc in psutil.process_iter():
|
|
||||||
if "vrserver.exe" == proc.name().lower():
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def mat34Id():
|
def mat34Id():
|
||||||
arr = openvr.HmdMatrix34_t()
|
arr = openvr.HmdMatrix34_t()
|
||||||
arr[0][0] = 1
|
arr[0][0] = 1
|
||||||
@@ -44,22 +39,21 @@ class Overlay:
|
|||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
try:
|
try:
|
||||||
if checkSteamvrRunning() is True:
|
self.system = openvr.init(openvr.VRApplication_Background)
|
||||||
self.system = openvr.init(openvr.VRApplication_Background)
|
self.overlay = openvr.IVROverlay()
|
||||||
self.overlay = openvr.IVROverlay()
|
self.handle = self.overlay.createOverlay("Overlay_Speaker2log", "SOverlay_Speaker2log_UI")
|
||||||
self.handle = self.overlay.createOverlay("Overlay_Speaker2log", "SOverlay_Speaker2log_UI")
|
|
||||||
|
|
||||||
self.updateImage(Image.new("RGBA", (1, 1), (0, 0, 0, 0)))
|
self.updateImage(Image.new("RGBA", (1, 1), (0, 0, 0, 0)))
|
||||||
self.setColor(self.settings['Color'])
|
self.setColor(self.settings['Color'])
|
||||||
self.updateColor()
|
self.updateColor()
|
||||||
self.setTransparency(self.settings['Transparency'])
|
self.setTransparency(self.settings['Transparency'])
|
||||||
self.updateTransparency()
|
self.updateTransparency()
|
||||||
self.setUiScaling(self.settings['Ui_scaling'])
|
self.setUiScaling(self.settings['Ui_scaling'])
|
||||||
self.updateUiScaling()
|
self.updateUiScaling()
|
||||||
self.setPosition((self.settings["Normalized_icon_X_position"], self.settings["Normalized_icon_Y_position"]))
|
self.setPosition((self.settings["Normalized_icon_X_position"], self.settings["Normalized_icon_Y_position"]))
|
||||||
self.updatePosition()
|
self.updatePosition()
|
||||||
self.overlay.showOverlay(self.handle)
|
self.overlay.showOverlay(self.handle)
|
||||||
self.initialized = True
|
self.initialized = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Could not initialise OpenVR", e)
|
print("Could not initialise OpenVR", e)
|
||||||
|
|
||||||
@@ -195,6 +189,11 @@ class Overlay:
|
|||||||
self.system = None
|
self.system = None
|
||||||
self.initialized = False
|
self.initialized = False
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def checkSteamvrRunning() -> bool:
|
||||||
|
_proc_name = "vrmonitor.exe" if os.name == 'nt' else "vrmonitor"
|
||||||
|
return _proc_name in (p.name() for p in process_iter())
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from overlay_image import OverlayImage
|
from overlay_image import OverlayImage
|
||||||
overlay_image = OverlayImage()
|
overlay_image = OverlayImage()
|
||||||
|
|||||||
Reference in New Issue
Block a user