added missing files
[swftools.git] / wx / gpdf2swf.py
1 #!/usr/bin/env python
2 # -*- coding: UTF-8 -*-
3 #
4 # gpdf2swf.py
5 # graphical user interface for pdf2swf
6 #
7 # Part of the swftools package.
8
9 # Copyright (c) 2008,2009 Matthias Kramm <kramm@quiss.org> 
10 #
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
24
25 from __future__ import division
26 import __builtin__
27 import os
28 import sys
29 import imp
30
31 def main_is_frozen():
32     return (hasattr(sys, "frozen") or # new py2exe
33             hasattr(sys, "importers") # old py2exe
34             or imp.is_frozen("__main__")) # tools/freeze
35
36 #if not main_is_frozen():
37 #    try:
38 #        import wxversion
39 #        wxversion.select("2.6")
40 #    except:
41 #        wxversion.select("2.8")
42
43 def get_main_dir():
44     if main_is_frozen():
45         return os.path.dirname(sys.executable)
46     return os.path.dirname(os.path.abspath(__file__))
47 __builtin__.get_main_dir = get_main_dir
48 __builtin__.GPDF2SWF_BASEDIR = get_main_dir()
49
50 pyver = "".join(map(str, sys.version_info[0:2]))
51 #print >>sys.stderr, pyver
52 if main_is_frozen():
53     sys.path.insert(0, os.path.join("..", "python%s" % pyver))
54 else:
55     sys.path.insert(0, os.path.join("..", "lib", "python"))
56     sys.path.insert(1, os.path.join("..", "python%s" % pyver))
57
58 import wx
59 #print >>sys.stderr, wx.VERSION
60 from lib.app import Pdf2Swf
61
62 if __name__ == "__main__":
63     app = wx.App(False)
64     app.SetAppName(u"gpdf2swf")
65     Pdf2Swf()
66     app.MainLoop()
67