status of wxPython books?

Hi,

I was wondering what the status of the two wxPython books are?

The posts of note were that Dunn/O'brien book would be ready when it was
ready... This was at the beginning of May. Has anything changed?

Also, what about Gary Wayne Young's book which he was promising would be
complete by 4/1/03? Does anyone have any news on that?

Thanks,
Sean

IMSTP.gif

All,

Here is some printing code that seems to work well enough (at least to get
started) for multi-page text documents. I tried adding this to the wxPython
wiki but didn't have write privileges.

Usage is simply:
from Printer import Printer

(in your frame __init__)
        self.printer = Printer(self)

(to print -- nothing is done w/ the text_title yet)
self.printer.Print(text, text_title)

(to preview -- text_title is used as the header for Preview -- Warning: I
get a run-time when closing the preview window w/ wxPython 2.4.1.2.. let me
know if you don't... anyone have any advice on workarounds?)
self.printer.PreviewText(text, text_title)

(page setup)
self.printer.PageSetup()

#Save the following as Printer.py
#License MIT
from wxPython.wx import *

def GetErrorText():
    return "Error occurred here.." #Put your error text here..

class Printer(wxPrintout):
    def __init__(self, frame):
        wxPrintout.__init__(self)
        self.printer_config = wxPrintData()
        self.printer_config.SetPaperId(wxPAPER_LETTER)
        self.frame = frame
        self.doc_text = ''
        self.doc_name = ''
        self.current_y = 15 #y should be either (15, 22, 30)
        if self.current_y == 15:
            self.num_lines_per_page = 50
        elif self.current_y == 22:
            self.num_lines_per_page = 35
        else:
            self.num_lines_per_page = 25
        
    def Print(self, text, doc_name):
        self.doc_text = text
        self.doc_name = doc_name
        pdd = wxPrintDialogData()
        pdd.SetPrintData(self.printer_config)
        printer = wxPrinter(pdd)
        if not printer.Print(self.frame,self):
            wxMessageBox("Unable to print the document.")
        else:
            self.printer_config = printer.GetPrintDialogData()
GetPrintData()
        
    def PreviewText(self, text, doc_name):
        try:
            self.doc_name = doc_name
            self.doc_text = text
            
            preview = wxPrintPreview(self,self,self.printer_config)
            if not preview.Ok():
                wxMessageBox("Unable to display preview of document.")
                return
            
            preview_window = wxPreviewFrame(preview, self.frame, \
                                            "Print Preview - %s" % doc_name)
            preview_window.Initialize()
            preview_window.SetPosition(self.frame.GetPosition())
            preview_window.SetSize(self.frame.GetSize())
            preview_window.Show(True)
        except:
            wxMessageBox(GetErrorText())
            
    def PageSetup(self):
        config_dialog = wxPrintDialog(self.frame)
        config_dialog.GetPrintDialogData().SetPrintData(self.printer_config)
        config_dialog.GetPrintDialogData().SetSetupDialog(True)
        config_dialog.ShowModal()
        self.printer_config = config_dialog.GetPrintDialogData()
GetPrintData()
        config_dialog.Destroy()

    def OnBeginDocument(self,start,end):
        return self.base_OnBeginDocument(start,end)
    
    def OnEndDocument(self):
        self.base_OnEndDocument()
        
    def OnBeginPrinting(self):
        self.base_OnBeginPrinting()
        
    def OnEndPrinting(self):
        self.base_OnEndPrinting()
        
    def OnPreparePrinting(self):
        self.base_OnPreparePrinting()
        
    def HasPage(self, page_num):
        return len(self.GetPageText(page_num)) > 0
    
    def GetPageInfo(self):
        minPage = 1
        maxPage = int(len(self.doc_text.split('\n'))/self
num_lines_per_page)
        fromPage, toPage = minPage, maxPage
        return (minPage,maxPage,fromPage,toPage)
    
    def OnPrintPage(self, page_num):
        dc = self.GetDC()
        x,y = 25, self.current_y
        if not self.IsPreview():
            y *=4
        line_count = 1
        for line in self.GetPageText(page_num):
            dc.DrawText(line, x, y*line_count)
            line_count += 1
        
        return True
    
    def GetPageText(self, page_num):
        lines = self.doc_text.split('\n')
        lines_for_page = lines[(page_num -1)*self.num_lines_per_page:
page_num*(self.num_lines_per_page-1)]
        return lines_for_page

IMSTP.gif