def load(self, data):
"""
Prepare the content for display
"""
self.type = data["type"]
if self.type == "powerpoint":
if not self.pptregistry: return False
# https://mail.python.org/pipermail/python-win32/2012-July/012471.html
self.PPTapplication = win32com.client.DispatchWithEvents("PowerPoint.Application", self.PPTevents)
try:
self.PPTpresentation = self.PPTapplication.Presentations.Open(data["path"].replace("/", "\\"),
WithWindow=False)
# Change PowerPoint output monitor setting (Touch and revert)
reset = []
try:
reset.append((winreg.QueryValueEx(self.pptregistry, "UseAutoMonSelection")[0],
lambda value: winreg.SetValueEx(self.pptregistry, "UseAutoMonSelection", 0,
winreg.REG_DWORD,
value)))
except WindowsError:
reset.append((None, lambda _: winreg.DeleteValue(self.pptregistry, "UseAutoMonSelection")))
try:
reset.append((winreg.QueryValueEx(self.pptregistry, "DisplayMonitor")[0],
lambda value: winreg.SetValueEx(self.pptregistry, "DisplayMonitor", 0, winreg.REG_SZ,
value)))
except WindowsError:
reset.append((None, lambda _: winreg.DeleteValue(self.pptregistry, "DisplayMonitor")))
winreg.SetValueEx(self.pptregistry, "DisplayMonitor", 0, winreg.REG_SZ,
self.states["screens"][self.states["display"]["outputID"]]["physical"])
winreg.SetValueEx(self.pptregistry, "UseAutoMonSelection", 0, winreg.REG_DWORD, 0)
self.PPTpresentation.SlideShowSettings.ShowPresenterView = False
self.PPTpresentation.SlideShowSettings.Run()
self.PPTpresentation.SlideShowWindow.View.AcceleratorsEnabled = False
self.overlay.setGeometry(self.screen)
self.overlay.showFullScreen()
[action(value) for value, action in reset]
except Exception as e:
print(e)
else:
# Play with VLC
self.player.set_hwnd(int(self.foreground.winId()))
self.VLCmedia = self.vlc.media_new(data["path"])
self.player.set_media(self.VLCmedia)
评论列表
文章目录