[wxPython-dev] 20060902 test build uploaded

jmf jfauth at bluewin.ch
Wed Sep 6 08:41:43 PDT 2006


w2k sp4, py25c1, wxpy2701

I downloaded the latest wxPython and jump directly into
the print framework.

In order to setup the printer condiguration, an application
has to display some dialog window.
So far there were two ways to achieve this:

1) the new way, introduced in one of the 2.6 serie

pdd = wx.PrintDialogData(self.printdata)
printerDialog = wx.PrintDialog(self.parent, pdd)
t = printerDialog.GetPrintDialogData()

2) the old way

pdd = wx.PrintDialogData(self.printdata)
printerDialog = wx.PrintDialog(self.parent, pdd)
printerDialog.GetPrintDialogData().SetSetupDialog(True)

The problem:
1) does not seem to work properly. The modification you enter in this
dialog window are not send back to the system, eg portrait/landscape.
More precisely, the dialog window is displayed in a such a way, there
is no "OK"or "Apply" button to validate the choosen options, instead there
is a "Print" button.
I thought, the printer driver could be the problem. It's not.
In other applications I tested, OpenOffice.org, notepad, ... this issue
is not appearing, while it is present in my wx apps and in the demo.
AcroRead 7 offers the old method.

The demo in more details:
- select Common Dialogs / PrintDialog
- Create and show a PrintDialog button
- The dialog window is shown, it has a "notebook", which probably
depends on the installed printers and below the "Print" and "Cancel"
buttons.
- Now the problems:
   - How do I send back the printer options to the printdata?
   - If I use the print button, what is printed? The underlaying
     PrintOut job?
   - How can I make an application with, let's say, two menu items,
     one for the printer configuration and one for printing?

It seems to me, there is a point in wxWidgets.

Since a month, I have a new printer, a Brother HL 2030, if I recall
correctly, the issue was also present with my old HP printer. Updating
some applications at those times, wxPy 2.6.?.? I had to choose the old
method.

The print preview uses this new way.

2) The old way does no more work.

printerDialog.GetPrintDialogData().SetSetupDialog(True)

The SetSetupDialog() is no more a valid xxx.GetPrintDialogData() method.
Indeed:
for e in dir(t):   (see above)
     print e
I got
<wx._windows.PrintDialogData; proxy of <Swig Object of type 'wxPrintDialogData 
*' at 0x95855c> >
Traceback (most recent call last):
   File "C:\jm\jmpy\wxonwork\PrintToolsPy25wxPy27\test.py", line 63, in OnClick2
     self.pt.PrinterSetup()
   File "C:\jm\jmpy\wxonwork\PrintToolsPy25wxPy27\PrintTools4.py", line 183, in 
PrinterSetup
     for e in t:
TypeError: 'PrintDialogData' object is not iterable

 From the wxPython doc (2.7.x):

void SetSetupDialog(bool flag)

Determines whether the dialog to be shown will be the Print dialog
(pass false) or Print Setup dialog (pass true).

This function has been deprecated since version 2.5.4.

It was still working in 2.6.x and helped me a lot.

A final note: Setting the printdata parameters programatically from
within an wxPython application works, eg:
self.printdata.SetOrientation(wx.LANDSCAPE)

I'm a little bit stuck here. The print framework is not so
easy, I hope I did not miss something.

Regards.
Jean-Michel Fauth, Switzerland




More information about the wxpython-dev mailing list