add platform utility functions

svn: r12765
This commit is contained in:
Benny Malengier 2009-07-06 09:54:30 +00:00
parent 0d7c048052
commit f7efb09734

View File

@ -47,7 +47,7 @@ import gen.lib
import Errors
from GrampsLocale import codeset
from const import TEMP_DIR, USER_HOME, WINDOWS
from const import TEMP_DIR, USER_HOME, WINDOWS, MACOS, LINUX
from TransUtils import sgettext as _
#-------------------------------------------------------------------------
@ -210,6 +210,37 @@ def family_upper_name(family, db):
name = mother.get_primary_name().get_upper_name()
return name
#-------------------------------------------------------------------------
#
# Platform determination functions
#
#-------------------------------------------------------------------------
def lin():
"""
Return True if a linux system
Note: Normally do as linux in else statement of a check !
"""
if platform.system() in LINUX:
return True
return False
def mac():
"""
Return True if a Macintosh system
"""
if platform.system() in MACOS:
return True
return False
def win():
"""
Return True if a windows system
"""
if platform.system() in WINDOWS:
return True
return False
#-------------------------------------------------------------------------
#
# String Encoding functions