wx.PageSetupDialog & wx.PrintDialogData will not change default values.

david wrote:

I don't know why, but after the 2nd day mailinglist has stopped coming to me.
Have to look these up each time on net.

If your mail server is aggressive about rejecting spam during the SMTP connection then the ezmlm list software can interpret that as your address no longer being valid. When it sends another message to you telling you that the messages were rejected and asking if you are still there, and it also gets rejected because they include a copy of the prior rejected message, then it assumes you are gone and it unsubscribes you.

You can also receive the list messages via NNTP from gmane, or use their online message browser here: http://news.gmane.org/gmane.comp.python.wxpython

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

[CC'd to Robert to help him stay in the loop...]

david wrote:

Have gotten the wxPageSetupDialog working with orientation, margins and some paper media now thanks to Roebling.
Still having an issue changing some defaults on wxPrintDialogData. He said it was working fine in the C++ example.
Does not work in the example from wxPython in Action.

<snip>
        self.pdata = wx.PrintData()
        self.pdata.SetPaperId(wx.PAPER_LETTER)
        self.pdata.SetOrientation(wx.LANDSCAPE)
<snip>
    def OnPrintSetup(self, evt):
        data = wx.PrintDialogData(self.pdata)
        dlg = wx.PrintDialog(self, data)
        dlg.GetPrintDialogData()
        dlg.ShowModal();
        data = dlg.GetPrintDialogData()
        self.pdata = wx.PrintData(data.GetPrintData())
        dlg.Destroy()

The Print Setup mode of the print dialog was deprecated in 2.6 and is pretty much gone in 2.8. You probably noticed that the SetSetupDialog method shown in the book gave an error.

So the way things are supposed to work now is to use the wx.PageSetupDialog for setup and the wx.PrintDialog for printing. You can see the current version of the printing sample from the book in the demo download tarball, or in CVS at http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/wxPython/samples/wxPIA_book/Chapter-17/printing.py

You can see there that it only has OnPageSetup, OnPrintPreview and OnPrint methods. The current C++ printing sample also follows this pattern so this will more closely match what Robert is testing.

I have found though that with the recent additions to gprint.cpp if call the OnPrintSetup TWICE, it actually does change
the defaults available thru the additions to gprint.cpp (ie orientation and paper media). There has to be a way to get
wxPrintDialogData to accept changes to defaults without calling the function twice, especially since have these items
working for wxPageSetupDialog now.

With the current sample code I'm not seeing the need to open the wx.PrintDialog twice to get the print data to take effect, however as you've mentioned, not every item in the dialog seems to be taking its data from the print data. For example, if I select a supported paper size in the print setup then it is also selected in the page tab of the print dialog, but if I change the paper orientation page setup it is not changed in the print dialog. It looks to me like the page setup dialog is not updating that value in the wxPrintData.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!