ScolaSync: Fichier source de src/globaldef.py

ScolaSync 5.1 |

globaldef.py
Aller à la documentation de ce fichier.
1 #!/usr/bin/python
2 # $Id: globaldef.py 47 2011-06-13 10:20:14Z georgesk $
3
4 ##
5 #
6 # globaldef.py is part of the package scolasync. This module contains
7 # some definitions which can be reused globally in the application
8 #
9
10 licenceEn="""
11 scolasync version %s:
12
13 a program to manage file transfers between a computer and a collection
14 of USB sticks.
15
16 Copyright (C) 2010 Georges Khaznadar <georgesk@ofset.org>
17
18 This program is free software: you can redistribute it and/or modify
19 it under the terms of the GNU General Public License as published by
20 the Free Software Foundation, either version 3 of the License, or
21 (at your option) any later version.
22
23 This program is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 GNU General Public License for more details.
27
28 You should have received a copy of the GNU General Public License
29 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 """
31
32 import platform, os
33
34 if platform.system()=="Linux":
35 userShareDir="~/.scolasync"
36 logFileName="~/.scolasync/scolasync.log"
37 markFileName="~/.scolasync/marques.py"
38 elif platform.system()=="Windows":
39 # to be implemented
40 userShareDir="??"
41 logFileName="??"
42 markFileName="??"
43
44 ##
45 #
46 # Renvoie le premier répertoire existant d'une liste de propositions
47 # @param l la liste de propositions
48 #
49 def firstdir(l):
50 for d in l:
51 if os.path.isdir(d): return d
52 return None
53
54 ##
55 #
56 # Renvoie le répertoire où trouver telle ou telle ressource
57 # @param which le type de ressource
58 #
59 def _dir(which):
60 if which=="lang":
61 return firstdir(["/usr/share/scolasync/lang", "lang"])
62 elif which=="help":
63 return firstdir(["/usr/share/scolasync/help", "help"])
64 elif which=="share":
65 return firstdir(["/usr/share/scolasync/","share"])
66 return None
67
src.globaldef.firstdir
def firstdir(l)
Renvoie le premier répertoire existant d'une liste de propositions.
Definition: globaldef.py:49