johnf wrote:
> On Friday 27 March 2009 10:16:14 am Paul McNett wrote:
>> johnf wrote:
>>> I'm not sure what you mean by "the dialog won't dismiss".  On my linux
>>> systems (test on several) the printer names are not available via wx
>>> tools.  But you are saying that the fact the bug or bugs exist is not the
>>> reason the dialog was not wrapped.  OK then let's do it.  I'm sure it
>>> would help with report writer ability to print to a printer.  Tell me
>>> what I need to do and I'll do it.
>> As far as I can tell, you don't get printer names from the wx.PrintDialog;
>> you get a wx.PrintDC to draw on.
>>
>> Report Writer "prints" to a pdf file, so I don't think it'll help here
>> unless I switch report writer to no longer use reportlab but to draw onto
>> wx DC's instead.
>>
>> I wouldn't know what to tell you to do until I'm almost doing it myself, at
>> which point I may as well just do it myself. ;)
>>
>> Paul
> 
> Maybe we aren't on the page in this discussion.  Yes it true that you can't 
> get printer names from the wx.PrintDialog.  It is the data associated with 
> the wx.PrintDialog that has the printer names which is wx.PrintDialogData.  
> So as I understand it wx.PrintDialog.GetPrintDialogData() will return the 
> data 
> from the dialog.  And that does not contain the printer name on linux but 
> does from windows.
> 
> That said.  PDF's are universal today.  On most linux distro's I've worked 
> with (they use CUPS) sending PDF file to "lp" will print the PDF correctly.  
> I believe this is also true for windows both XP and Vista.  I do not know how 
> MAC's handle the direct printing of PDF's.  So as I see it you could just use 
> the native print dialog and pass the PDF as the file to print.  
> 
> I would be interested in how a MAC prints PDF's.
> 
> Try below and let me know the results
> def testPrint(self):
>         data = wx.PrintDialogData()
>         data.EnableSelection(True)
>         data.EnablePrintToFile(True)
>         data.EnablePageNumbers(True)
>         data.SetMinPage(1)
>         data.SetMaxPage(5)
>         data.SetAllPages(True)
> 
>         dlg = wx.PrintDialog(self, data)
> 
>         if dlg.ShowModal() == wx.ID_OK:
>             data = dlg.GetPrintDialogData()
>             mytest=data.GetPrintData()
>             print mytest.GetPrinterName()
> 
>         dlg.Destroy()

Here's a working test:

{{{
import wx
a = wx.App(False)

def testPrint():
         data = wx.PrintDialogData()
         data.EnableSelection(True)
         data.EnablePrintToFile(True)
         data.EnablePageNumbers(True)
         data.SetMinPage(1)
         data.SetMaxPage(5)
         data.SetAllPages(True)

         dlg = wx.PrintDialog(None, data)

         result = dlg.ShowModal()
         print result, result == wx.ID_OK
         if result == wx.ID_OK:
             data = dlg.GetPrintDialogData()
             mytest=data.GetPrintData()
             print mytest.GetPrinterName()

         dlg.Destroy()

testPrint()
}}}

No printer name on Mac.

Paul

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to