List Info

Thread: printing in a PyObjC Document-based app




printing in a PyObjC Document-based app
user name
2006-11-30 14:06:42
I have a PyObjC Document-based Application set up by Xcode
(2.4).   
When I build the default project, but and then change the
document  
window to contain an NSTableView, the app prints the data
from the  
TableView.  I would like to take charge of the print
operation to  
print a modified version of the view.

According to the docs, for a Cocoa app, my "NSDocument
subclass must  
override printShowingPrintPanel: to create and run the print
 
operation for the document."  A Cocoa Document-based
Application will  
not print if you don't do this, whereas the PyObjC one
doesn't need  
to do this (and in fact won't call the method if I do
override it in  
my NSDocument subclass).

I thought of adding a modified Print item to the File menu,
but I  
don't know how to connect the new menu item to my NSDocument
 
subclass.  In MainMenu.nib, File's Owner's class is
NSApplication.  I  
can set my NSDocument to be the App delegate, but there
doesn't seem  
to be an appropriate delegate method for printing.

I thought of trying to put my document at the front of the
responder  
chain, but I can't get to the window.  File's owner in the  
document.nib file has an outlet set to the window, but when
I do  
"print self.window" from the document I get
"None."

What's the right way to do this?

Thanks.

Tom Elliott
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )