1#!/usr/bin/python
2# -*- coding: utf-8 -*-
3#
4# PhotoFilmStrip - Creates movies out of your pictures.
5#
6# Copyright (C) 2008 Jens Goepfert
7#
8
9import os
10import tempfile
11import sys
12
13from photofilmstrip.AppMixin import AppMixin
14from photofilmstrip.ux.Ux import UxService, UxPreventStartupSignal
15from photofilmstrip import Constants
16
17
18class GuiApp(AppMixin):
19
20    def _OnStart(self):
21        import wx
22        assert wx.VERSION[0] == 4
23
24        from photofilmstrip.ux.Ux import UxService
25        UxService.GetInstance().Initialize()
26
27        from photofilmstrip.gui.PhotoFilmStripApp import PhotoFilmStripApp
28        app = PhotoFilmStripApp(0)
29        app.MainLoop()
30
31    def _GetLogFilename(self):
32        if getattr(sys, 'frozen', None) == "windows_exe":
33            sys.stderr = sys.stdout
34            return os.path.join(tempfile.gettempdir(), Constants.APP_NAME + ".log")
35        else:
36            return None
37
38
39def main():
40    guiApp = GuiApp()
41    try:
42        UxService.GetInstance().Start()
43    except UxPreventStartupSignal:
44        return
45
46    guiApp.Start()
47
48
49if __name__ == "__main__":
50    main()
51