Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #366 from BallAerospace/fix_screenshots_on_linux
closes #327. Fix screenshots on linux
  • Loading branch information
ryanmelt committed Nov 29, 2016
2 parents dfd4825 + 6c3d671 commit 3afdd12
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/cosmos/gui/utilities/screenshot.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 3afdd12

Please sign in to comment.