2011-08-23 05:28:58 -04:00
|
|
|
import os, sys
|
|
|
|
import platform
|
2011-08-11 04:17:53 -04:00
|
|
|
from PyQt4.QtGui import QDesktopServices
|
|
|
|
|
|
|
|
def isOSX():
|
2011-08-23 05:28:58 -04:00
|
|
|
return sys.platform == "darwin"
|
2011-08-11 04:17:53 -04:00
|
|
|
|
|
|
|
def isWin32():
|
2011-08-23 05:28:58 -04:00
|
|
|
return sys.platform == "win32"
|
|
|
|
|
|
|
|
def isLinux():
|
|
|
|
return sys.platform.startswith("linux")
|
2011-08-11 04:17:53 -04:00
|
|
|
|
|
|
|
def isOSXBundle():
|
2011-08-23 05:28:58 -04:00
|
|
|
return isOSX() and (os.path.abspath('.').find(".app") != -1)
|
|
|
|
|
|
|
|
def osVer():
|
|
|
|
if isWin32():
|
|
|
|
return " ".join(platform.win32_ver())
|
|
|
|
elif isOSX():
|
|
|
|
ret = ""
|
|
|
|
for i in platform.mac_ver():
|
|
|
|
if type(i) == type(tuple()):
|
|
|
|
for j in i:
|
|
|
|
ret += " %s" % (j)
|
|
|
|
else:
|
|
|
|
ret += " %s" % (i)
|
|
|
|
return ret[1:]
|
|
|
|
elif isLinux():
|
|
|
|
return " ".join(platform.linux_distribution())
|
2011-08-11 04:17:53 -04:00
|
|
|
|
|
|
|
def getDataDir():
|
|
|
|
if isOSX():
|
2011-08-23 05:28:58 -04:00
|
|
|
return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/")
|
2011-08-11 04:17:53 -04:00
|
|
|
else:
|
|
|
|
return ''
|