home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- from PIL.Image import BICUBIC, ANTIALIAS
- import wx
-
- HSizer = lambda : wx.BoxSizer(wx.HORIZONTAL)
-
- VSizer = lambda : wx.BoxSizer(wx.VERTICAL)
-
- class ImageDialog(wx.Dialog):
- SuccessID = wx.ID_OK
-
- def __init__(self, parent, screenshot, pos, title, message, oklabel = _('OK'), cancellabel = _('Cancel')):
- wx.Dialog.__init__(self, parent, -1, title)
- if isinstance(screenshot, wx.Bitmap):
- screenshot = screenshot.PIL
-
- (w, h) = screenshot.size
- squaresize = 650
- img = screenshot
- if w > squaresize or h > squaresize:
- if w > h:
- new_height = int((h / float(w)) * squaresize)
- img = None(img.resize, (squaresize, new_height) if squaresize > w else ANTIALIAS)
- else:
- new_width = int((w / float(h)) * squaresize)
- img = None(img.resize, (new_width, squaresize) if squaresize > h else ANTIALIAS)
-
- self.screenshot = img.WXB
- p = self.panel = wx.Panel(self)
- s = self.panel.Sizer = VSizer()
- s.Add((self.screenshot.Width, self.screenshot.Height + 20))
- p.Bind(wx.EVT_PAINT, self.paint)
- s.Add(wx.StaticText(p, -1, message), 0, wx.EXPAND | wx.BOTTOM, 8)
- send = wx.Button(p, self.SuccessID, oklabel)
- send.SetDefault()
- cancel = wx.Button(p, wx.ID_CANCEL, cancellabel)
- h = HSizer()
- h.AddStretchSpacer(1)
- h.AddMany([
- (send, 0, wx.EXPAND | wx.RIGHT, 10),
- (cancel, 0)])
- s.Add(h, 0, wx.EXPAND)
- s = self.Sizer = VSizer()
- s.Add(self.panel, 1, wx.EXPAND | wx.ALL, 8)
- self.Fit()
- self.SetPosition(pos)
-
-
- def paint(self, e):
- dc = wx.PaintDC(e.EventObject)
- r = self.ClientRect
- dc.DrawBitmap(self.screenshot, r.HCenter(self.screenshot), 10, True)
-
-
-