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

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: Add French and Spanish 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
Randall Spangler 2011/03/01 17:37:18 Might want to comment that size is taken from the
24 for x, y, filename in self.imglist:
25 img = wx.Image(filename, wx.BITMAP_TYPE_ANY)
26 if (not done_first):
27 size = img.GetSize()
28 self.SetMinSize(size)
29 self.SetSize(size)
30 self.Fit()
31 w,h = self.parent.GetBestSize()
32 self.parent.SetDimensions(-1, -1, w, h, wx.SIZE_AUTO)
33 done_first = True
34 bmp = img.ConvertToBitmap()
35 dc.DrawBitmap(bmp, x, y)
36
37
38 class Frame(wx.Frame):
39
40 def __init__(self, bmpblock=None, title=None):
41 wx.Frame.__init__(self, None, wx.ID_ANY, title=title)
42 self.CreateStatusBar()
43 self.SetStatusText(title)
44 self.Bind(wx.EVT_CLOSE, self.OnQuit)
45
46 # HEY: really?
Randall Spangler 2011/03/01 17:37:18 Leftover comment? (line 51 too)
47 self.bmpblock = bmpblock
48 if self.bmpblock:
49 self.bmpblock.RegisterScreenDisplayObject(self)
50
51 # Is this enough?
52 self.p = MyPanel(self)
53
54
55 def OnQuit(self, event):
56 wx.GetApp().ExitMainLoop()
57
58 def DisplayScreen(self, name, imglist):
59 self.SetStatusText(name)
60 self.p.imglist = imglist
61 self.p.OnPaint()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698