ScolaSync 1.0
globaldef.py
Aller à la documentation de ce fichier.
00001 #!/usr/bin/python
00002 # -*- coding: utf-8 -*-
00003 #       $Id: globaldef.py 47 2011-06-13 10:20:14Z georgesk $    
00004 
00005 ##
00006 # 
00007 # globaldef.py is part of the package scolasync. This module contains
00008 # some definitions which can be reused globally in the application
00009 # 
00010 
00011 licenceEn="""
00012     scolasync version %s:
00013 
00014     a program to manage file transfers between a computer and a collection
00015     of USB sticks.
00016     
00017     Copyright (C) 2010 Georges Khaznadar <georgesk@ofset.org>
00018 
00019     This program is free software: you can redistribute it and/or modify
00020     it under the terms of the GNU General Public License as published by
00021     the Free Software Foundation, either version 3 of the License, or
00022     (at your option) any later version.
00023 
00024     This program is distributed in the hope that it will be useful,
00025     but WITHOUT ANY WARRANTY; without even the implied warranty of
00026     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00027     GNU General Public License for more details.
00028 
00029     You should have received a copy of the GNU General Public License
00030     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00031 """
00032 
00033 import platform, os
00034 
00035 if platform.system()=="Linux":
00036     userShareDir="~/.scolasync"
00037     logFileName="~/.scolasync/scolasync.log"
00038     markFileName="~/.scolasync/marques.py"
00039 elif platform.system()=="Windows":
00040     # to be implemented
00041     userShareDir="??"
00042     logFileName="??"
00043     markFileName="??"
00044     
00045 ##
00046 # 
00047 #     Renvoie le premier répertoire existant d'une liste de propositions
00048 #     @param l la liste de propositions
00049 #     
00050 def firstdir(l):
00051     for d in l:
00052         if os.path.isdir(d): return d
00053     return None
00054    
00055 ##
00056 # 
00057 #     Renvoie le répertoire où trouver telle ou telle ressource
00058 #     @param which le type de ressource
00059 #     
00060 def _dir(which):
00061     if which=="lang":
00062         return firstdir(["/usr/share/scolasync/lang", "lang"])
00063     elif which=="help":
00064         return firstdir(["/usr/share/scolasync/help", "help"])
00065     elif which=="share":
00066         return firstdir(["/usr/share/scolasync/","share"])
00067     return None
00068 
00069 
 Tout Classes Espaces de nommage Fichiers Fonctions Variables