# Copyright: (c) 2002 by Robb Shecter (robb@acm.org)
# Licence: wxWindows license
#---------------------------------------------------------------------------
-#
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o What happened to wx.Color()?
-#
-
import wx
import wx.lib.evtmgr as em
message2 = wx.StaticText(self, -1, txt)
message2.SetFont(f1)
- targetPanel = Tile(self, log, bgColor=wxColour(80,10,10), active=0)
- buttonPanel = wxPanel(self ,-1)
- sizer = wxBoxSizer(wxHORIZONTAL)
+ targetPanel = Tile(self, log, bgColor=wx.Colour(80,10,10), active=0)
+ buttonPanel = wx.Panel(self ,-1)
+ sizer = wx.BoxSizer(wx.HORIZONTAL)
target = targetPanel.tile
sizer.Add((0,0), 1)
for factor in [0.2, 0.3, 0.4, 0.5, 0.6, 0.7]:
- sizer.Add(Tile(buttonPanel, log, factor-0.05, target), 0, wxALIGN_CENTER)
+ sizer.Add(Tile(buttonPanel, log, factor-0.05, target), 0, wx.ALIGN_CENTER)
sizer.Add((0,0),1)
- sizer.Add(Tile(buttonPanel, log, factor, target), 0, wxALIGN_CENTER)
+ sizer.Add(Tile(buttonPanel, log, factor, target), 0, wx.ALIGN_CENTER)
sizer.Add((0,0),1)
- buttonPanel.SetAutoLayout(1)
buttonPanel.SetSizer(sizer)
sizer.Fit(buttonPanel)
sizer.Add(message0, 0, wx.ALIGN_CENTER | wx.ALL, 6)
sizer.Add(title2, 0, wx.ALIGN_CENTER | wx.LEFT | wx.TOP | wx.RIGHT, 16)
sizer.Add(message1, 0, wx.ALIGN_CENTER | wx.ALL, 6)
- sizer.Add(buttonPanel, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, 16)
+ sizer.Add(buttonPanel, 0, wx.EXPAND | wx.ALL, 16)
sizer.Add(title3, 0, wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT, 16)
sizer.Add(message2, 0, wx.ALIGN_CENTER | wx.ALL, 6)
sizer.Add(targetPanel, 2, wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, 16)
- self.SetAutoLayout(1)
self.SetSizer(sizer)
-class Tile(wx.Panel):
+class Tile(wx.Window):
"""
This outer class is responsible for changing
its border color in response to certain mouse
hover = wx.Colour(210,220,210)
def __init__(self, parent, log, factor=1, thingToWatch=None, bgColor=None, active=1, size=(38,38), borderWidth=3):
- wx.Panel.__init__(self, parent, -1, size=size, style=wx.CLIP_CHILDREN)
+ wx.Window.__init__(self, parent, -1, size=size, style=wx.CLIP_CHILDREN)
self.tile = InnerTile(self, log, factor, thingToWatch, bgColor)
self.log = log
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.tile, 1, wx.EXPAND | wx.ALL, borderWidth)
- self.SetAutoLayout(1)
self.SetSizer(sizer)
self.Layout()
+ em.eventManager.Register(self.doLayout, wx.EVT_SIZE, self)
self.SetBackgroundColour(Tile.normal)
if active:
# Register myself for mouse events over self.tile in order to
em.eventManager.Register(self.setHover, wx.EVT_LEFT_UP, self.tile)
+ def doLayout(self, event):
+ self.Layout()
+
+
def setHover(self, event):
self.SetBackgroundColour(Tile.hover)
self.Refresh()
-class InnerTile(wxPanel):
+class InnerTile(wx.Window):
IDLE_COLOR = wx.Colour( 80, 10, 10)
START_COLOR = wx.Colour(200, 70, 50)
FINAL_COLOR = wx.Colour( 20, 80,240)
events over the 'thingToWatch'.
"""
def __init__(self, parent, log, factor, thingToWatch=None, bgColor=None):
- wx.Panel.__init__(self, parent, -1)
+ wx.Window.__init__(self, parent, -1)
+ self.SetMinSize((20,20))
self.log=log
if bgColor:
self.SetBackgroundColour(bgColor)
if __name__ == '__main__':
import sys,os
import run
- run.main(['', os.path.basename(sys.argv[0])])
+ run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])