]> git.saurik.com Git - wxWidgets.git/commitdiff
Updates from contributor
authorRobin Dunn <robin@alldunn.com>
Wed, 15 May 2002 19:46:31 +0000 (19:46 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 15 May 2002 19:46:31 +0000 (19:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/wxPython/lib/printout.py

index 5f9e78eba9e059e60438ed8099984778d0ac3bc0..33f3a24432ac3ace7c8d5904766fec80cc7f8aa3 100644 (file)
@@ -6,9 +6,14 @@
 #
 # Created:
 # Version       0.75
-# Date:         Sept 18, 2001
+# Date:         May 15, 2002
 # Licence:      wxWindows license
 #----------------------------------------------------------------------------
+# Release Notes
+
+# fixed bug for string wider than print region
+# add index to data list after parsing total pages for paging
+#----------------------------------------------------------------------------
 
 import os, sys, string, copy
 
@@ -87,6 +92,13 @@ class PrintBase:
         if len(split) == 1:
             return ln_text, ""
 
+        try:
+            w, h = self.DC.GetTextExtent(split[0])
+            if w >= width:
+                return ln_text, ""
+        except:
+            pass
+
         cnt = 0
         for word in split:
             bword = " " + word # blank + word
@@ -341,31 +353,22 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
         if self.total_pages == None:
             self.GetTotalPages()    # total pages for display/printing
 
-        self.data_cnt = 0
-
-        cnt = 1                 # get selected page
-        if cnt == self.page:
-            self.draw = TRUE
-        else:
-            self.draw = FALSE
-
-        while cnt < self.page:
-            self.OutPage()
-            cnt = cnt + 1
+        self.data_cnt = self.page_index[self.page-1]
 
         self.draw = TRUE
         self.PrintHeader()
         self.PrintFooter()
         self.OutPage()
 
-
     def GetTotalPages(self):
         self.data_cnt = 0
         self.draw = FALSE
+        self.page_index = [0]
 
         cnt = 0
         while 1:
             test = self.OutPage()
+            self.page_index.append(self.data_cnt)
             if  test == FALSE:
                 break
             cnt = cnt + 1
@@ -376,7 +379,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
         self.y = self.y_start
         self.end_x = self.column[-1]
 
-        if self.data_cnt < len(self.data)-1:  # if there data for display on the page
+        if self.data_cnt < len(self.data):  # if there data for display on the page
             if self.label != []:        # check if header defined
                 self.PrintLabel()
         else: