-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhotoImport.py
More file actions
executable file
·72 lines (64 loc) · 2.49 KB
/
Copy pathPhotoImport.py
File metadata and controls
executable file
·72 lines (64 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
################################################################################
# Copyright 2010 Andreas Neustifter (andreas.neustifter@gmail.com)
#
# This file is part of PhotoImport.
#
# PhotoImport is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# PhotoImport is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# PhotoImport. If not, see <http://www.gnu.org/licenses/>.
################################################################################
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Sun Nov 7 01:10:24 2010
"""
The main class for the PhotoImport project.
"""
import wx
from ConfigFrame import ConfigFrame
import logging
import LoggingHandler
class PhotoImport(wx.App):
"""
This is the main class for the PhotoImport project.
"""
def OnInit(self):
"""
The OnInit function of an wx.App initialises everything. In this case it
also fires up the startup frame.
"""
wx.InitAllImageHandlers()
self.cfgfrm = ConfigFrame(None, -1, "")
self.SetTopWindow(self.cfgfrm)
self.cfgfrm.Show()
return 1
def SetLogHandler(self, loghandler):
self.cfgfrm.loghandler = loghandler
# end of class PhotoImport
if __name__ == "__main__":
logfilename = 'PhotoImport.log'
logformat = '%(asctime)s:%(levelname)s:%(module)s:%(lineno)d:%(message)s'
logdatefmt = '%Y%m%d %H:%M:%S'
logging.basicConfig(filename=logfilename, level=logging.DEBUG, format=logformat, datefmt=logdatefmt)
loghandler = LoggingHandler.LoggingStream()
logStream = logging.StreamHandler(loghandler)
logStream.setLevel(logging.ERROR)
logStream.setFormatter(logging.Formatter(fmt='%(levelname)s: %(message)s' , datefmt=logdatefmt))
logging.getLogger().addHandler(logStream)
logging.debug("------------------ Starting log. ------------------")
try:
photoimport = PhotoImport()
photoimport.SetLogHandler(loghandler)
photoimport.MainLoop()
except:
import sys
logging.error("Unexpected error:", sys.exc_info()[0])
raise