PDF viewer detection incorrect in OSX

Bug #501330 reported by Xavier (Open ERP)
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo GTK Client (MOVED TO GITHUB)
Status tracked in Trunk
4.2
Won't Fix
Undecided
Unassigned
5.0
Fix Released
Medium
Unassigned
Trunk
Fix Released
Medium
Unassigned

Bug Description

In the printer module (printer/printer.py), the PDF file opener is defined as `os.system('/usr/bin/open -a Preview '`. This is incorrect when the user does *not* want to open PDF files with Preview and configured his OS otherwise.

/usr/bin/open without any argument but the file name explicitly uses the default (os default or file default) application for the file, the viewer therefore shouldn't be hardcoded to Preview.

Also, specifying the full path to open shouldn't be necessary.

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

The OS detection routine is also incorrect: it should use sys.platform whose behavior is clearly documented (and includes osx as 'darwin') instead of os.uname(). Furthermore sys.platform is available under Windows so the os.name != 'nt' wouldn't be necessary anymore

Revision history for this message
Samantha (samantha-z-mathews) wrote :

whathas been fixed and committed?
please clarify.

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

printer.py has been modified to call `open` on the PDF file without mandating preview (it was `open -a Preview` before) and removing the `/usr/bin` prefix which shouldn't be useful, the test is now performed on `platform.system()` instead of combinations of `os.name` and `os.uname()`.

On 5.0 this is part of 5.0.12.

Also, for 6.x, the Linux detection/opening was altered: it now calls xdg-open, gnome-open and see (in that order) to try to get the system's default PDF reader (in the fashion of Window's `startfile` or OSX's `open`).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.