Proposed changes to pdfViewer (viewer.py)

Hello,

I'd like to offer some enhancements to pdfViewer (wx/lib/pdfViewer/viewer.py*). The overall objective is to enable "quick printing" or "silent printing" as it is sometimes called.

Currently the API for this method takes no args: pdfViewer.Print(self)

For my projects I need the following capabilities added to pdfViewer.Print():

- Ability to set prompt=False so the print dialog does not appear. API would now look like:
    pdfViewer(prompt=True) # set True to keep current behavior intact

- Ability to set (programmatically) which printer the output would be sent to. API would now look like:
    pdfViewer(prompt=True, printer_name=None) # current behavior if no printer name given

- Ability to set the orientation of the printout. API would now look like:
    pdfViewer(prompt=True, printer_name=None, orientation=None) # current behavior if no orientation given

Would such additions be acceptable? Or is this heading toward stacking too many arguments for the Print() call?

Additionally, I'd like to make a change to pdfViewer.LoadFile(). It currently only accepts a string path name which it then opens as a file(). I'd like to change it to also accept a file-like object for direct use. This would allow pdf printouts to be created entirely in memory and then passed to pdfViewer and never have to access the filesystem (improves performance and security).

Would this be acceptable?

Overall, should I submit one patch or multiple?

* I notice that the pdfViewer subdir does not appear at http://trac.wxwidgets.org/browser/wxPython/trunk/wx/lib . Has it been moved?

Thanks,
Michael Hipp

Hello,

I'd like to offer some enhancements to pdfViewer
(wx/lib/pdfViewer/viewer.py*). The overall objective is to enable "quick
printing" or "silent printing" as it is sometimes called.

Currently the API for this method takes no args: pdfViewer.Print(self)

For my projects I need the following capabilities added to
pdfViewer.Print():

- Ability to set prompt=False so the print dialog does not appear. API
would now look like:
pdfViewer(prompt=True) # set True to keep current behavior intact

- Ability to set (programmatically) which printer the output would be
sent to. API would now look like:
pdfViewer(prompt=True, printer_name=None) # current behavior if no
printer name given

- Ability to set the orientation of the printout. API would now look like:
pdfViewer(prompt=True, printer_name=None, orientation=None) # current
behavior if no orientation given

Would such additions be acceptable? Or is this heading toward stacking
too many arguments for the Print() call?

Additionally, I'd like to make a change to pdfViewer.LoadFile(). It
currently only accepts a string path name which it then opens as a
file(). I'd like to change it to also accept a file-like object for
direct use. This would allow pdf printouts to be created entirely in
memory and then passed to pdfViewer and never have to access the
filesystem (improves performance and security).

Would this be acceptable?

It sounds good to me, but it's up to David Hughes as it's his code. You should go ahead and implement the changes and create a Trac ticket for it. Be sure to mention the ticket number here so David will know where it is so he can review it.

Overall, should I submit one patch or multiple?

I would do one for the printing-related changes and another for LoadFile.

* I notice that the pdfViewer subdir does not appear at
wxTrac has been migrated to GitHub Issues - wxWidgets . Has it been
moved?

It is located here: wxTrac has been migrated to GitHub Issues - wxWidgets and it is referenced from wx/lib using a svn:externals property.

···

On 9/29/11 11:30 AM, Michael Hipp wrote:

--
Robin Dunn
Software Craftsman

That's fine by me. I'm only too pleased to hear someone is actually using it!

As Robin says, a separate patch for each topic would be best.

···

On 29/09/2011 19:30, Michael Hipp wrote:

Hello,

I'd like to offer some enhancements to pdfViewer (wx/lib/pdfViewer/viewer.py*). The overall objective is to enable "quick printing" or "silent printing" as it is sometimes called.

Currently the API for this method takes no args: pdfViewer.Print(self)

For my projects I need the following capabilities added to pdfViewer.Print():

- Ability to set prompt=False so the print dialog does not appear. API would now look like:
   pdfViewer(prompt=True) # set True to keep current behavior intact

- Ability to set (programmatically) which printer the output would be sent to. API would now look like:
   pdfViewer(prompt=True, printer_name=None) # current behavior if no printer name given

- Ability to set the orientation of the printout. API would now look like:
   pdfViewer(prompt=True, printer_name=None, orientation=None) # current behavior if no orientation given

Would such additions be acceptable? Or is this heading toward stacking too many arguments for the Print() call?

Additionally, I'd like to make a change to pdfViewer.LoadFile(). It currently only accepts a string path name which it then opens as a file(). I'd like to change it to also accept a file-like object for direct use. This would allow pdf printouts to be created entirely in memory and then passed to pdfViewer and never have to access the filesystem (improves performance and security).

Would this be acceptable?

Overall, should I submit one patch or multiple?

* I notice that the pdfViewer subdir does not appear at wxTrac has been migrated to GitHub Issues - wxWidgets . Has it been moved?

Thanks,
Michael Hipp

--
Regards

David Hughes
Forestfield Software

Thanks!

pdfViewer will be a big help to me. I have created a ticket with patch here for the changes to Print():

http://trac.wxwidgets.org/ticket/13548

Should I create tickets for my other proposed changes as well or wait for this one?

Thanks,
Michael

···

On 9/30/2011 2:41 AM, David Hughes wrote:

That's fine by me. I'm only too pleased to hear someone is actually using it!

As Robin says, a separate patch for each topic would be best.

I have created a ticket with patch here for the changes to Print():

wxTrac has been migrated to GitHub Issues - wxWidgets

I have applied your patch to my installed copy of wx 2.9.2.2, tested, and it all looks fine. Waiting now for Robin to admit it.

Should I create tickets for my other proposed changes as well or wait for this one?

May as well go ahead so they can be committed in one go.

Thanks,
Michael

Robin. I also want to look at including the Cairo changes you put into 2.9.2.2

···

On 08/10/2011 23:34, Michael Hipp wrote:

--
Regards

David Hughes
Forestfield Software

Thanks, David.

Here's the ticket for it:
http://trac.wxwidgets.org/ticket/13551

Michael

···

On 10/10/2011 4:00 AM, David Hughes wrote:

May as well go ahead so they can be committed in one go.