Skip to content

Commit

Permalink
refs #6601. Screen shot overload.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Feb 22, 2013
1 parent 0eb8141 commit ce6bb2c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Code/Mantid/MantidPlot/mantidplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,7 @@ def _replace_report_text(filename, section, newtext):
f = open(filename, 'w')
f.write(contents)
f.close()





class Screenshot(QtCore.QObject):
"""
Expand Down Expand Up @@ -840,6 +838,22 @@ def screenshot(widget, filename, description, png_exists=False):
section_text += '<img src="%s.png" alt="%s"></img>' % (filename, description)

_replace_report_text(report, filename, section_text)

def screenshot(widget, filename, screenshot_dir):
"""Take a screenshot of a widget
@param widget :: QWidget to take an image of
@param filename :: Destination filename for that image
@param screenshot_dir :: Directory to put the screenshots into.
"""
# Find the widget if handled with a proxy
if hasattr(widget, "_getHeldObject"):
widget = widget._getHeldObject()

if widget is not None:
camera = Screenshot()
threadsafe_call(camera.take_picture, widget, os.path.join(screenshot_dir, filename+".png"))


#=============================================================================
# Helper methods
Expand Down

0 comments on commit ce6bb2c

Please sign in to comment.