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