From 6c3d67136056c493056467f3724abb765490745a Mon Sep 17 00:00:00 2001 From: Ryan Melton Date: Mon, 28 Nov 2016 16:55:53 -0700 Subject: [PATCH] closes #327. Fix screenshots on linux --- lib/cosmos/gui/utilities/screenshot.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cosmos/gui/utilities/screenshot.rb b/lib/cosmos/gui/utilities/screenshot.rb index 2e923ea72..9c110eeb8 100644 --- a/lib/cosmos/gui/utilities/screenshot.rb +++ b/lib/cosmos/gui/utilities/screenshot.rb @@ -15,6 +15,14 @@ class Screenshot # Take a screenshot of the given window def self.screenshot_window (window, filename) + if !Kernel.is_windows?() + # Delay for one second to allow any dialogs to fully clear first + start_time = Time.now + while ((Time.now - start_time) < 1.0) + Qt::CoreApplication.processEvents(Qt::EventLoop::AllEvents, 1000) + end + end + # Create a Pixmap to save the screenshot into pixmap = Qt::Pixmap::grabWindow(window.winId()) pixmap.save(filename)