add cross-platform function to open file browser
This commit is contained in:
parent
2a9a7ad07d
commit
d1d71f03ad
1 changed files with 16 additions and 0 deletions
|
@ -35,6 +35,22 @@ def deprecated(func):
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
return new_func
|
return new_func
|
||||||
|
|
||||||
|
def open_file_browser(directory):
|
||||||
|
if sys.platform=='win32':
|
||||||
|
os.startfile(directory)
|
||||||
|
|
||||||
|
elif sys.platform=='darwin':
|
||||||
|
subprocess.Popen(['open', directory])
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
subprocess.Popen(['xdg-open', directory])
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
# er, think of something else to try
|
||||||
|
# xdg-open *should* be supported by recent Gnome, KDE, Xfce
|
||||||
|
|
||||||
|
|
||||||
# # Evaluate a bezier curve for the parameter 0<=t<=1 along its length
|
# # Evaluate a bezier curve for the parameter 0<=t<=1 along its length
|
||||||
# def evaluateBezierPoint(p1, h1, h2, p2, t):
|
# def evaluateBezierPoint(p1, h1, h2, p2, t):
|
||||||
# return ((1 - t)**3) * p1 + (3 * t * (1 - t)**2) * h1 + (3 * (t**2) * (1 - t)) * h2 + (t**3) * p2
|
# return ((1 - t)**3) * p1 + (3 * t * (1 - t)**2) * h1 + (3 * (t**2) * (1 - t)) * h2 + (t**3) * p2
|
||||||
|
|
Loading…
Reference in a new issue