[pygtk] gtkunixprint.Printer Issue
Vamsi Krishna Davuluri
vamsi.davuluri at gmail.com
Thu Jun 25 21:20:05 WST 2009
Hi all,
I'm in the process of writing a python program to do printing
by setting up a source file (pdf or ps) and using gtkunixprint
for it.
It's just test code:
So when i try to run this, the interpreter complains like this:
File "printscript.py", line 37, in __init__
gtkunixprint.Printer.__init__(self)
NotImplementedError: GetPrinter is an abstract widget
How do I get over this?
I cant create objects for that class, but this is standard,
can anyone tell me how I should Proceed?
My code is like this:
_PAGE_SETUP = None
_PRINT_SETTINGS = None
class PageSetup(gtk.Dialog):
def __init__(self, title=None,):
printDialog = gtkunixprint.PageSetupUnixDialog('Page Setup',
gtk.Window())
printDialog.show_all()
printDialog.connect('response',self.processResponse)
def processResponse(self, widget, settings):
_PAGE_SETUP = widget.get_page_setup()
widget.destroy()
class GetPrinter(gtkunixprint.Printer):
def __init__(self, title=None):
gtkunixprint.Printer.__init__(self)
self.connect('details-acquired',self.getPrinterName)
def getPrinterName(self,obj,settings):
pass#print self.get_name()
class PrinterSetup(gtk.Dialog):
def __init__(self, title=None):
printDialog = gtkunixprint.PrintUnixDialog('Printer Settings',
gtk.Window())
printDialog.show_all()
printDialog.connect('response',self.processResponse)
def processResponse(self, widget, settings):
_PRINT_SETTINGS = widget.get_settings()
widget.destroy()
if settings == -5:
PrintJobObj = PrintJob()
class PrintJob:
def __init__(self, title=None, printer=None, settings=None,
page_setup=None):
PrinterOb = GetPrinter()
printJob = gtkunixprint.PrintJob('lolcode',printer,
_PRINT_SETTINGS,
_PAGE_SETUP)
printJob.set_source_file('/home/iwikiwi/cupsinfo.txt')
Thanks,
Vamsi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090625/783d6fd9/attachment.htm
More information about the pygtk
mailing list