bilder, buxfixes
[multilist] / src / multilist
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3   
4 """
5     This file is part of Multilist.
6
7     Multilist is free software: you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation, either version 3 of the License, or
10     (at your option) any later version.
11
12     Multilist is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with Multilist.  If not, see <http://www.gnu.org/licenses/>.
19     
20     Copyright (C) 2008 Christoph Würstle
21 """
22
23 import os
24 import sys
25                         
26 if __name__ == "__main__":
27         
28         try:
29                 import tempfile
30                 import gtk
31                 tmpdir=tempfile.gettempdir()
32                 
33                 os.mkdir(os.path.join(tmpdir, "multilist_lock"))
34         except OSError:
35                 ## Failed: another instance is running
36                 
37                 mbox=gtk.MessageDialog(None,gtk.DIALOG_MODAL,gtk.MESSAGE_ERROR,gtk.BUTTONS_YES_NO,"Multilist already runnging.Start anyway? (Could result in db problems!)") 
38                 response=mbox.run() 
39                 mbox.hide() 
40                 mbox.destroy() 
41                 if response==gtk.RESPONSE_NO:
42                         sys.exit()
43
44         try:
45                 
46                 from multilistclasses import libmultilist
47                 #print dir(eggtimerclasses)
48                 app = libmultilist.multilistclass() 
49                 app.main() 
50    
51         finally:
52                 ## Remove the PID file
53                 # (...)
54                 ## Delete directory
55                 os.rmdir(os.path.join(tmpdir, "multilist_lock"))
56                 
57