From 494311f234ea78d35c457cf3e1e3cd0d5298eec3 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Mon, 6 Jul 2009 17:36:36 +0000 Subject: [PATCH] 3089: clipboard drop broken in Mac port svn: r12767 --- src/Utils.py | 33 ++++++++++++++++++++++++++++++++- src/const.py.in | 10 ++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/Utils.py b/src/Utils.py index 071271056..9d217f50c 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -50,7 +50,7 @@ import gen.lib import Errors from QuestionDialog import WarningDialog, ErrorDialog -from const import TEMP_DIR, USER_HOME +from const import TEMP_DIR, USER_HOME, WINDOWS, MACOS, LINUX import shutil #------------------------------------------------------------------------- @@ -256,6 +256,37 @@ def add_menuitem(menu, msg, obj, func): item.show() menu.append(item) +#------------------------------------------------------------------------- +# +# 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 + #------------------------------------------------------------------------- # # diff --git a/src/const.py.in b/src/const.py.in index 20f462256..f59438349 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -193,6 +193,16 @@ XMLFILE = "data.gramps" NO_SURNAME = "(%s)" % _("none") NO_GIVEN = "(%s)" % _("none") +#------------------------------------------------------------------------- +# +# Platforms +# Never test on LINUX, handle Linux in the else statement as default +# +#------------------------------------------------------------------------- +LINUX = ["Linux", "linux"] +MACOS = ["Darwin", "darwin"] +WINDOWS = ["Windows", "win32"] + #------------------------------------------------------------------------- # # Options Constants