mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 20:40:11 +01:00
Merge pull request #101 from wernerfb/2015MarchSpeedGTK
unittest failure in speedMeterMethods when calling SetTicks
This commit is contained in:
@@ -31,9 +31,6 @@ class SpeedMeterDemo(wx.Panel):
|
||||
|
||||
wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL|wx.NO_FULL_REPAINT_ON_RESIZE)
|
||||
|
||||
wx.CallLater(50, self.laterStuff)
|
||||
|
||||
def laterStuff(self):
|
||||
panel = wx.Panel(self, -1)
|
||||
sizer = wx.FlexGridSizer(rows=2, cols=3, vgap=2, hgap=5)
|
||||
|
||||
|
||||
@@ -324,12 +324,22 @@ class BufferedWindow(wx.Window):
|
||||
self.Bind(wx.EVT_SIZE, self.OnSize)
|
||||
self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None)
|
||||
|
||||
# OnSize called to make sure the buffer is initialized.
|
||||
# This might result in OnSize getting called twice on some
|
||||
# platforms at initialization, but little harm done.
|
||||
self._isWindowCreated = False
|
||||
if '__WXGTK__' in wx.PlatformInfo:
|
||||
self.Bind(wx.EVT_WINDOW_CREATE, self.doSetWindowCreated)
|
||||
else:
|
||||
# OnSize called to make sure the buffer is initialized.
|
||||
# This might result in OnSize getting called twice on some
|
||||
# platforms at initialization, but little harm done.
|
||||
self.doSetWindowCreated(None)
|
||||
|
||||
def doSetWindowCreated(self, evt):
|
||||
"""
|
||||
Method to call OnSize on GTK when window is created.
|
||||
"""
|
||||
self._isWindowCreated = True
|
||||
self.OnSize(None)
|
||||
|
||||
|
||||
|
||||
def Draw(self, dc):
|
||||
"""
|
||||
This method should be overridden when sub-classed.
|
||||
@@ -372,7 +382,8 @@ class BufferedWindow(wx.Window):
|
||||
self.Height = max(self.Height, 1)
|
||||
|
||||
self._Buffer = wx.Bitmap(self.Width, self.Height)
|
||||
self.UpdateDrawing()
|
||||
if self._isWindowCreated:
|
||||
self.UpdateDrawing()
|
||||
|
||||
|
||||
def UpdateDrawing(self):
|
||||
@@ -489,7 +500,6 @@ class SpeedMeter(BufferedWindow):
|
||||
if self._agwStyle & SM_DRAW_FANCY_TICKS:
|
||||
wx.lib.colourdb.updateColourDB()
|
||||
|
||||
|
||||
self.SetAngleRange()
|
||||
self.SetIntervals()
|
||||
self.SetSpeedValue()
|
||||
@@ -515,7 +525,6 @@ class SpeedMeter(BufferedWindow):
|
||||
BufferedWindow.__init__(self, parent, id, pos, size,
|
||||
style=wx.NO_FULL_REPAINT_ON_RESIZE,
|
||||
bufferedstyle=bufferedstyle)
|
||||
|
||||
if self._mousestyle & SM_MOUSE_TRACK:
|
||||
self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseMotion)
|
||||
|
||||
@@ -530,7 +539,7 @@ class SpeedMeter(BufferedWindow):
|
||||
|
||||
size = self.GetClientSize()
|
||||
|
||||
if size.x < 21 or size.y < 21:
|
||||
if size.x < 2 or size.y < 2:
|
||||
return
|
||||
|
||||
new_dim = size.Get()
|
||||
|
||||
Reference in New Issue
Block a user