TPL preview fixes for wx apps, RGBA8 is great *within* tpl.py but it fails on the wii :P

This commit is contained in:
Xuzz 2009-06-29 17:55:30 -07:00
parent 8d928288dc
commit f5a8145c4b

17
TPL.py
View File

@ -513,22 +513,21 @@ class TPL():
Again, only a single texture is supported.""" Again, only a single texture is supported."""
import wx import wx
class imp(wx.Panel): class imp(wx.Dialog):
def __init__(self, parent, id, im): def __init__(self, title, im):
wx.Panel.__init__(self, parent, id)
w = img.GetWidth() w = img.GetWidth()
h = img.GetHeight() h = img.GetHeight()
wx.StaticBitmap(self, -1, im, ( ((max(w, 300) - w) / 2), ((max(h, 200) - h) / 2) ), (w, h))
wx.Dialog.__init__(self, None, -1, title, size = (max(w, 300), max(h, 200)))
wx.StaticBitmap(self, -1, im, ( ((max(w, 300) - w) / 2), ((max(h, 200) - h) / 2) ), (w, h))
self.toImage("tmp.png") self.toImage("tmp.png")
img = wx.Image("tmp.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap() img = wx.Image("tmp.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap()
w = img.GetWidth() w = img.GetWidth()
h = img.GetHeight() h = img.GetHeight()
app = wx.App(redirect = False) dialog = imp("TPL (" + str(w) + ", " + str(h) + ")", img)
frame = wx.Frame(None, -1, "TPL (" + str(w) + ", " + str(h) + ")", size = (max(w, 300), max(h, 200))) dialog.ShowModal()
image = imp(frame, -1, img) dialog.Destroy()
frame.Show(True)
app.MainLoop()
os.unlink("tmp.png") os.unlink("tmp.png")
def RGBA8(self, (x, y), data): def RGBA8(self, (x, y), data):
out = [0 for i in range(x * y)] out = [0 for i in range(x * y)]