|
 |
e5e577e |
From b18336db6e109d381d1e265475adb85c8ba82357 Mon Sep 17 00:00:00 2001
|
|
 |
e5e577e |
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
|
 |
e5e577e |
Date: Fri, 29 May 2015 10:28:17 +0200
|
|
 |
e5e577e |
Subject: [PATCH] Replace direct calls to Nautilus and Dolphin with xdg-open
|
|
 |
e5e577e |
|
|
 |
e5e577e |
This will still work in GNOME and KDE, but will also enable
|
|
 |
e5e577e |
the functions for other Linux desktop environments, such as Xfce or MATE
|
|
 |
e5e577e |
---
|
|
 |
e5e577e |
Cura/util/explorer.py | 16 +++++-----------
|
|
 |
e5e577e |
1 file changed, 5 insertions(+), 11 deletions(-)
|
|
 |
e5e577e |
|
|
 |
e5e577e |
diff --git a/Cura/util/explorer.py b/Cura/util/explorer.py
|
|
 |
e5e577e |
index 1e2a5a0..8726c56 100644
|
|
 |
e5e577e |
--- a/Cura/util/explorer.py
|
|
 |
e5e577e |
+++ b/Cura/util/explorer.py
|
|
 |
e5e577e |
@@ -13,9 +13,7 @@ def hasExplorer():
|
|
 |
e5e577e |
if sys.platform == 'win32' or sys.platform == 'cygwin' or sys.platform == 'darwin':
|
|
 |
e5e577e |
return True
|
|
 |
e5e577e |
if sys.platform == 'linux2':
|
|
 |
e5e577e |
- if os.path.isfile('/usr/bin/nautilus'):
|
|
 |
e5e577e |
- return True
|
|
 |
e5e577e |
- if os.path.isfile('/usr/bin/dolphin'):
|
|
 |
e5e577e |
+ if os.path.isfile('/usr/bin/xdg-open'):
|
|
 |
e5e577e |
return True
|
|
 |
e5e577e |
return False
|
|
 |
e5e577e |
|
|
 |
e5e577e |
@@ -27,10 +25,8 @@ def openExplorer(filename):
|
|
 |
e5e577e |
subprocess.Popen(['open', '-R', filename])
|
|
 |
e5e577e |
if sys.platform.startswith('linux'):
|
|
 |
e5e577e |
#TODO: On linux we cannot seem to select a certain file, only open the specified path.
|
|
 |
e5e577e |
- if os.path.isfile('/usr/bin/nautilus'):
|
|
 |
e5e577e |
- subprocess.Popen(['/usr/bin/nautilus', os.path.split(filename)[0]])
|
|
 |
e5e577e |
- elif os.path.isfile('/usr/bin/dolphin'):
|
|
 |
e5e577e |
- subprocess.Popen(['/usr/bin/dolphin', os.path.split(filename)[0]])
|
|
 |
e5e577e |
+ if os.path.isfile('/usr/bin/xdg-open'):
|
|
 |
e5e577e |
+ subprocess.Popen(['/usr/bin/xdg-open', os.path.split(filename)[0]])
|
|
 |
e5e577e |
|
|
 |
e5e577e |
def openExplorerPath(filename):
|
|
 |
e5e577e |
"""Open a file dialog inside a directory, without selecting any file."""
|
|
 |
e5e577e |
@@ -39,8 +35,6 @@ def openExplorerPath(filename):
|
|
 |
e5e577e |
if sys.platform == 'darwin':
|
|
 |
e5e577e |
subprocess.Popen(['open', filename])
|
|
 |
e5e577e |
if sys.platform.startswith('linux'):
|
|
 |
e5e577e |
- if os.path.isfile('/usr/bin/nautilus'):
|
|
 |
e5e577e |
- subprocess.Popen(['/usr/bin/nautilus', filename])
|
|
 |
e5e577e |
- elif os.path.isfile('/usr/bin/dolphin'):
|
|
 |
e5e577e |
- subprocess.Popen(['/usr/bin/dolphin', filename])
|
|
 |
e5e577e |
+ if os.path.isfile('/usr/bin/xdg-open'):
|
|
 |
e5e577e |
+ subprocess.Popen(['/usr/bin/xdg-open', filename])
|
|
 |
e5e577e |
|