]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/ColourDB.py
added test for writing empty value to the config
[wxWidgets.git] / wxPython / demo / ColourDB.py
index f23e294fe5d3bba166f2eb17ec490f4b2eff0923..91878075131596194ddead81af8f586fc4ace510 100644 (file)
@@ -60,6 +60,8 @@ class TestWindow(wxScrolledWindow):
         dc = evt.GetDC()
         if not dc:
             dc = wxClientDC(self)
+            rect = self.GetUpdateRegion().GetBox()
+            dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height)
         self.TileBackground(dc)
 
 
@@ -78,7 +80,7 @@ class TestWindow(wxScrolledWindow):
         numColours = len(colours)
 
         if rgn:
-            # determine the subset that have been exposed and needs drawn
+            # determine the subset that has been exposed and needs drawn
             rect = rgn.GetBox()
             pixStart = vs[1]*self.lineHeight + rect.y
             pixStop  = pixStart + rect.height
@@ -86,7 +88,7 @@ class TestWindow(wxScrolledWindow):
             stop = pixStop / self.lineHeight
         else:
             start = 0
-            stop = len(numColours)
+            stop = numColours
 
         for line in range(max(0,start), min(stop,numColours)):
             clr = colours[line]
@@ -100,12 +102,24 @@ class TestWindow(wxScrolledWindow):
         dc.EndDrawing()
 
 
+# On wxGTK there needs to be a panel under wxScrolledWindows if they are
+# going to be in a wxNotebook...
+class TestPanel(wxPanel):
+    def __init__(self, parent):
+        wxPanel.__init__(self, parent, -1)
+        self.win = TestWindow(self)
+        EVT_SIZE(self, self.OnSize)
+
+    def OnSize(self, evt):
+        self.win.SetSize(evt.GetSize())
+
+
 
 #----------------------------------------------------------------------
 
 
 def runTest(frame, nb, log):
-    win = TestWindow(nb)
+    win = TestPanel(nb)
     return win
 
 #----------------------------------------------------------------------