()
| 57 | |
| 58 | |
| 59 | def main(): |
| 60 | check_versions() |
| 61 | sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error |
| 62 | if os.path.exists(SCREENSHOT_PATH): |
| 63 | print("[screenshot.py] Remove old screenshot") |
| 64 | os.remove(SCREENSHOT_PATH) |
| 65 | command_line_arguments() |
| 66 | # Off-screen-rendering requires setting "windowless_rendering_enabled" |
| 67 | # option. |
| 68 | settings = { |
| 69 | "windowless_rendering_enabled": True, |
| 70 | } |
| 71 | switches = { |
| 72 | # GPU acceleration is not supported in OSR mode, so must disable |
| 73 | # it using these Chromium switches (Issue #240 and #463) |
| 74 | "disable-gpu": "", |
| 75 | "disable-gpu-compositing": "", |
| 76 | # Tweaking OSR performance by setting the same Chromium flags |
| 77 | # as in upstream cefclient (Issue #240). |
| 78 | "enable-begin-frame-scheduling": "", |
| 79 | "disable-surfaces": "", # This is required for PDF ext to work |
| 80 | } |
| 81 | browser_settings = { |
| 82 | # Tweaking OSR performance (Issue #240) |
| 83 | "windowless_frame_rate": 30, # Default frame rate in CEF is 30 |
| 84 | } |
| 85 | cef.Initialize(settings=settings, switches=switches) |
| 86 | create_browser(browser_settings) |
| 87 | cef.MessageLoop() |
| 88 | cef.Shutdown() |
| 89 | print("[screenshot.py] Opening screenshot with default application") |
| 90 | open_with_default_application(SCREENSHOT_PATH) |
| 91 | |
| 92 | |
| 93 | def check_versions(): |
no test coverage detected