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

Side by Side Diff: scripts/newbitmaps/lib/pixdisplay.py

Issue 6598046: Add stuff to support new bitmap format. (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Agree to all changes. PTAL. Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/python -tt
2 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Display for bmpblock object."""
7 import wx
8
9 class MyPanel(wx.Panel):
10
11 def __init__(self, parent):
12 wx.Panel.__init__(self, parent, wx.ID_ANY)
13 self.Bind(wx.EVT_PAINT, self.OnPaint)
14 self.parent = parent
15 self.imglist = ()
16
17 def OnPaint(self, evt=None):
18 if (evt):
19 dc = wx.PaintDC(self)
20 else:
21 dc = wx.ClientDC(self)
22
23 done_first = False
24 # The first image in the sequence may be used by the BIOS to set the
25 # display resolution. Regardless, it should match the desired or default
26 # resolution so that any previous screens get cleared.
27 for x, y, filename in self.imglist:
28 img = wx.Image(filename, wx.BITMAP_TYPE_ANY)
29 if (not done_first):
30 size = img.GetSize()
31 self.SetMinSize(size)
32 self.SetSize(size)
33 self.Fit()
34 w,h = self.parent.GetBestSize()
35 self.parent.SetDimensions(-1, -1, w, h, wx.SIZE_AUTO)
36 done_first = True
37 bmp = img.ConvertToBitmap()
38 dc.DrawBitmap(bmp, x, y)
39
40
41 class Frame(wx.Frame):
42
43 def __init__(self, bmpblock=None, title=None):
44 wx.Frame.__init__(self, None, wx.ID_ANY, title=title)
45 self.CreateStatusBar()
46 self.SetStatusText(title)
47 self.Bind(wx.EVT_CLOSE, self.OnQuit)
48
49 self.bmpblock = bmpblock
50 if self.bmpblock:
51 self.bmpblock.RegisterScreenDisplayObject(self)
52
53 self.p = MyPanel(self)
54
55
56 def OnQuit(self, event):
57 wx.GetApp().ExitMainLoop()
58
59 def DisplayScreen(self, name, imglist):
60 self.SetStatusText(name)
61 self.p.imglist = imglist
62 self.p.OnPaint()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698