[ wxwindows-Bugs-1722634 ] wxHtmlEasyPrinting not inheriting
wxPrintData values changed
SourceForge.net
noreply at sourceforge.net
Sat Jun 2 11:48:06 PDT 2007
Bugs item #1722634, was opened at 2007-05-21 08:07
Message generated for change (Comment added) made by decibels
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1722634&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HTML
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: David Babcock (decibels)
Assigned to: Vaclav Slavik (vaclavslavik)
Summary: wxHtmlEasyPrinting not inheriting wxPrintData values changed
Initial Comment:
wxPython version 2.8 using the latest gprint.cpp
Robert recently fixed changing some defaults in wxPageSetupDialog (ie. orientation, paperid and margins).
It works fine for text file. It is not working for HtmlEasyPrinting though!
Can set the above defaults for wxPrintData fine for just the wxPageSetupDialog. But if call it up thru the HtmlEasyPrinting framework the dialog comes up with it's own defaults, not the changes I made. Same with the Html Preview.
Should be able to set the wxPrintData for those defaults (using gprint.cpp revision 1.53.2.4 for wxpython 2.8) and also have them changed when settin them and calling up the dialog thru HtmlEasyPrinting. Have looked thru htmprint.cpp and it seems that it should work. My C++ isn't very good though.
Thanks,
Dave
----------------------------------------------------------------------
>Comment By: David Babcock (decibels)
Date: 2007-06-02 13:48
Message:
Logged In: YES
user_id=464357
Originator: YES
Progress!! There is a difference between windows and Linux now.
Downloaded the wxpython-demo 2.8.4.0 for windows and tried the htmlwindow
print code. I was able to get it to work in Windows.
Tried it in demo (modify source) and in my app.
printer = html.HtmlEasyPrinting()
printer.GetPrintData().SetPaperId(wx.PAPER_LEGAL)
printer.GetPrintData().SetOrientation(wx.LANDSCAPE)
printer.GetPageSetupData().SetMarginTopLeft((1,1))
printer.GetPageSetupData().SetMarginBottomRight((1,1))
#linux
printer.PreviewFile("Reports/StatusReports.html")
#windows
#printer.PreviewFile("C:\Pyfolio\StatusReports.html")
#linux
#printer.PrintFile("Reports/StatusReports.html")
#windows
#printer.PrintFile("C:\Pyfolio\StatusReports.html")
WINDOWS:
1) PreviewFile works, Html works (windows screws up the tables where linux
doesn't) but the margins, orientation and paperid look right.
2) click Print in Preview and dialog settings are right for margins,
orientation and paperid.
3) PrintFile works also.
WINDOWS DEMO also works
LINUX:
1) PreviewFile works, Html works (windows screws up the tables where linux
doesn't) but the margins, orientation and paperid look right.
*** HERE IS WHERE SCREWS UP **
2) click Print in Preview and printdialog settings are defaults (ie.
margins,orientation,paperid are not set to what I set).
3) PrintFile doesn't work either, the printdialog settings are defaults.
Same as #2 above. Expected that, same dialog.
LINUX DEMO works: (Partly only!!)
Seems that it is previewing on screen correctly, but still printing in
PORTRAIT, even though LANDSCAPE is selected.
Using the same code, except for paths to file, in linux and windows. Works
in Windows and don't in Linux.
I just downloaded the latest wxpython-2.8.4.0 and wxGTK-2.8.4.0 this
morning for sourceforge. I looked into the gprint.cpp in wxpython bzip2 and
found this version of gprint.cpp: version 1.53.2.1 . There has been 6
updates since then. Assuming that this is the reason that is isn't working,
but the demo is????
The part that is confusing me though is: Windows works. Linux isn't
working (maybe cause updates not done to source code).
I have been getting the latest tarballs to work with, then updating to
your gprint.cpp and gprint.h for the fixes. It still hasn't been working in
Linux. Can I assume here that there must be some other file updated that
need? Can't tell, cause I know that the latest wxpython source is 6 updates
behind (last update would be at least 2 weeks, 3 days ago).
Right now, all I can be certain. Is that windows works and Linux doesn't.
----------------------------------------------------------------------
Comment By: David Babcock (decibels)
Date: 2007-05-30 19:19
Message:
Logged In: YES
user_id=464357
Originator: YES
Trying to debug some of this but can't get cout to work. Won't compile.
Error starts off with:
error: no match for 'operator<<' in 'std::operator<<
I've added: #include <iostream>
and tried cout, std::cout <...> std::endl; but still fails to compile.
Any hint on what I am doing wrong or not including.
Example of what trying to do:
wxPrintData *wxHtmlEasyPrinting::GetPrintData()
{
if (m_PrintData == NULL)
m_PrintData = new wxPrintData();
std::cout << "htmprint.cpp GetPrintData()" << std::endl;
std::cout << "address of m_PrintData = " << &m_PrintData <<
std::endl;
std::cout << "value of m_PrintData = " << *m_PrintData << std::endl;
return m_PrintData;
}
Thanks
----------------------------------------------------------------------
Comment By: David Babcock (decibels)
Date: 2007-05-25 17:08
Message:
Logged In: YES
user_id=464357
Originator: YES
Ran into a little problem, apparently the latest
wxPython-src-2.8.4.0.tar.bz2 which just got this morning and compiled
didn't have your changes to gprint.cpp or gprint.h so had to get them or
got those paperid errors you already fixed (note, I got them again, but
something completely different, explained below.
Printing HTML results: (windows and Linux)
** First: According to wxPython in Action: The GetPrintData() method
returns a wx.PrintData object, and GetPageSetupData() returns a
wx.PageSetupDialogData object, both of which are discussed in more detail
in chapter 17.
So I tried in Win2k and Linux. Unless I am doing it wrong, GetPrintData()
should return values I preset. Didn't work in Windows or Linux, with
python2.4.4 and wxpython-2.8.4.0
Also tried GetPageSetupData() and same. So unless I am way off base it
isn't working.
Using Robin's latest PrintFrameworkSample:
Windows & Linux (same results):
(uses: def OnPageSetup from printer framework)
(text) PageSetupDialog: works, orientation, paperid, margins change to new
values.
(html) PageSetupDialog: Couldn't get to work, defaults never change.
(uses: def OnPrintPreview from printer framework)
(text) PrintPreview: works, looks like orientation and margins set to new
values
(html) PrintPreview: Couldn't get to work, defaults never change.
Here is where differs from Windows & Linux.
Windows:
(uses: def OnPrint from printer framework)
(text) Print: works.
(html) Print: Neither Linux or Windows. Couldn't get to work, defaults
never change.
Linux:
(uses: def OnPrint from printer framework)
(text) Print: Not working, get some errors: (this get's weird, trying to
explain)
1) First time call: doesn't work, get default values
2) 2nd time call(same session): orientation changes to new value, nothing
else does. Get these errors:
** (python:7687): WARNING **: Could not find child for option
"PhysicalSize" with id "USLegal"
** (python:7687): WARNING **: Could not set value of "PhysicalSize" to
"USLegal"
(python:7687): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(python:7687): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion
`G_TYPE_CHECK_INSTANCE (instance)' failed
3) 3rd time,...... same. I know, why call, then cancel and call again. I
was testing, but others could cancel and then realize they did want that
dialog.
But it get's stranger:
1) If call the Print first, cancel and then call the PageSetupDialog,
orientation and margins still work, but paperid doesn't. Get these errors:
** (python:7940): WARNING **: Could not find child for option
"PhysicalSize" with id "USLegal"
** (python:7940): WARNING **: Could not set value of "PhysicalSize" to
"USLegal"
Note: same thing happens with USLetter. (Didn't try others)
Summary: Html results same on Linux or Windows, can't change defaults.
Linux has a problem with Print function in the code where as windows
doesn't (same code).
Attaching the printframeworksample code. Hope this helps. I took the html
stuff I was trying out of the attachment.
File Added: printer.py
----------------------------------------------------------------------
Comment By: Robert Roebling (roebling)
Date: 2007-05-25 12:28
Message:
Logged In: YES
user_id=77100
Originator: NO
I have written gprint.cpp myself, but I have never looked at any of the
HTML classes as long as they compiled.
> I CAN test out wxpython in win2k
I just want to know if the problem is platform specific or if it is a HTML
printing bug. So if the problem does not show up unter win2K, I'll try to
find the problem in wxGTK.
----------------------------------------------------------------------
Comment By: David Babcock (decibels)
Date: 2007-05-25 10:58
Message:
Logged In: YES
user_id=464357
Originator: YES
> Does this work under wxMSW?
Well, after finally getting windows completely reinstalled and up. I
realized wxMSW is for C and not python.
I CAN test out wxpython in win2k if you think that might point to problem.
Developing in the windows env is so foreign to me, that by the time I got
somewhere I think you would close this bug. Unless you have some other way
to test this out, I would be better off getting better at my C++ and trying
to see about writing a patch myself in the Linux env.
Geesh, just when I thought got somewhere by you fixing the stuff in
gprint, to find out that htmleasyprinting is my apparently my last obstacle
to finishing my app.
Guess I need to start with trying to find out how htmleasyprinting is
retrieving the wxPrintData values. Any hints?
----------------------------------------------------------------------
Comment By: David Babcock (decibels)
Date: 2007-05-23 07:15
Message:
Logged In: YES
user_id=464357
Originator: YES
Hmmm, I hardly ever boot to windows. Tried yesterday and my Win2k
pagefile.sys crapped out on me and can't get in. So trying to get it to
boot. Then have to install all the stuff to test it out. So will get to it
hopefully today or tomorrow or will recover from a backup and test it out
for ya.
----------------------------------------------------------------------
Comment By: Robert Roebling (roebling)
Date: 2007-05-22 02:40
Message:
Logged In: YES
user_id=77100
Originator: NO
Does this work under wxMSW?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1722634&group_id=9863
More information about the wx-dev
mailing list