← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~openerp-community/openobject-client/zehk_use-of-xdg-open into lp:openobject-client

 

Zehk' has proposed merging lp:~openerp-community/openobject-client/zehk_use-of-xdg-open into lp:openobject-client.

Requested reviews:
  OpenERP sa GTK client R&D (openerp-dev-gtk)

For more details, see:
https://code.launchpad.net/~openerp-community/openobject-client/zehk_use-of-xdg-open/+merge/77333

Add the use of xdg-open, gnome-open and kde-open to the method used to determine which program should be launched to print the data of a Binary fields.

-- 
https://code.launchpad.net/~openerp-community/openobject-client/zehk_use-of-xdg-open/+merge/77333
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-client/zehk_use-of-xdg-open.
=== modified file 'bin/printer/printer.py'
--- bin/printer/printer.py	2011-03-17 12:59:55 +0000
+++ bin/printer/printer.py	2011-09-28 14:34:42 +0000
@@ -150,6 +150,18 @@
         except:
             pass
 
+        if not app_to_run and os.name == 'posix':
+            def app_exists(app_name):
+                for path in os.environ['PATH'].split(os.pathsep):
+                    app_path = os.path.join(path, app_name)
+                    if os.path.exists(app_path) and os.access(app_path, os.X_OK):
+                        return app_path
+                return None
+            for app in ['xdg-open', 'gnome-open', 'kde-open']:
+                if app_exists(app):
+                    app_to_run = app
+                    break
+
         if app_to_run:
             def open_file(cmd, filename):
                 cmd = cmd.split()


Follow ups