Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: scripts/newbitmaps/lib/pixdisplay.py

Issue 6588139: Add "File->Save snapshot" menu item to export the displayed screen. (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/newbitmaps/lib/pixcontrol.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/newbitmaps/lib/pixdisplay.py
diff --git a/scripts/newbitmaps/lib/pixdisplay.py b/scripts/newbitmaps/lib/pixdisplay.py
index 0d40580b9f57304003281176797c618b9265b9da..339e2dfecaa520cb3ef34ab52250d8d8357bcdb4 100755
--- a/scripts/newbitmaps/lib/pixdisplay.py
+++ b/scripts/newbitmaps/lib/pixdisplay.py
@@ -37,6 +37,24 @@ class MyPanel(wx.Panel):
bmp = img.ConvertToBitmap()
dc.DrawBitmap(bmp, x, y)
+ def OnSave(self, name):
+ """Draw the current image sequence into a file."""
+ dc = wx.MemoryDC()
+ done_first = False
+ for x, y, filename in self.imglist:
+ img = wx.Image(filename, wx.BITMAP_TYPE_ANY)
+ if (not done_first):
+ w,h = img.GetSize()
+ base = wx.EmptyBitmap(w,h)
+ dc.SelectObject(base)
+ done_first = True
+ bmp = img.ConvertToBitmap()
+ dc.DrawBitmap(bmp, x, y)
+ new = wx.ImageFromBitmap(base)
+ outfile = name + '.png'
+ new.SaveFile(outfile, wx.BITMAP_TYPE_PNG)
+ print "wrote", outfile
+
class Frame(wx.Frame):
@@ -60,3 +78,7 @@ class Frame(wx.Frame):
self.SetStatusText(name)
self.p.imglist = imglist
self.p.OnPaint()
+
+ def SaveScreen(self, name, imglist):
+ self.p.imglist = imglist
+ self.p.OnSave(name)
« no previous file with comments | « scripts/newbitmaps/lib/pixcontrol.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698