1 |
#! /usr/bin/python |
# Copyright (C) 2001, 2002, 2003 by Intevation GmbH |
|
# Copyright (C) 2001, 2002 by Intevation GmbH |
|
2 |
# Authors: |
# Authors: |
3 |
# Jan-Oliver Wagner <[email protected]> |
# Jan-Oliver Wagner <[email protected]> |
4 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> |
15 |
import sys |
import sys |
16 |
|
|
17 |
from application import ThubanApplication |
from application import ThubanApplication |
18 |
|
import Thuban.version |
|
from wxPython.wx import wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER,\ |
|
|
wxPlatform |
|
|
import wxproj |
|
|
|
|
19 |
|
|
20 |
def main(): |
def main(): |
21 |
"""Instantiate the application object and run the application""" |
"""Instantiate the application object and run the application""" |
24 |
app = ThubanApplication(0) |
app = ThubanApplication(0) |
25 |
if len(sys.argv) > 1: |
if len(sys.argv) > 1: |
26 |
app.OpenSession(sys.argv[1]) |
app.OpenSession(sys.argv[1]) |
|
#app.top.ShowSessionTree() |
|
|
app.top.ShowLegend() |
|
27 |
app.MainLoop() |
app.MainLoop() |
28 |
|
# sys.excepthook is set in ThubanApplication.OnInit() |
29 |
|
sys.excepthook = sys.__excepthook__ |
|
def wxCHECK_VERSION(major,minor,release): \ |
|
|
return (wxMAJOR_VERSION > (major) or \ |
|
|
(wxMAJOR_VERSION == (major) \ |
|
|
and wxMINOR_VERSION > (minor)) or \ |
|
|
(wxMAJOR_VERSION == (major) \ |
|
|
and wxMINOR_VERSION == (minor) \ |
|
|
and wxRELEASE_NUMBER >= (release))) |
|
30 |
|
|
31 |
def verify_versions(): |
def verify_versions(): |
32 |
"""Check some library versions. |
"""Check some library versions. |
33 |
|
|
34 |
Print a message containing any libraries which are wrong. |
Print a message containing any libraries which are wrong. |
35 |
Return True if everything is OK, otherwise False. |
Return True if everything is OK, otherwise False. |
|
|
|
|
Specifically, check the following libraries: |
|
|
|
|
|
wxPython >= v2.4.0 |
|
|
Python >= v2.2.1 |
|
|
proj >= v4.4.5 |
|
|
gtk > v1.2.0 |
|
36 |
""" |
""" |
37 |
|
|
38 |
errors = [] |
errors = Thuban.version.verify_versions() |
|
|
|
|
if not wxCHECK_VERSION(2, 4, 0): |
|
|
errors.append("wxPython < 2.4.0") |
|
|
|
|
|
if sys.hexversion < 0x0202010f: |
|
|
errors.append("Python < 2.2.1") |
|
|
|
|
|
# |
|
|
# This only tells someone that they COMPILED thuban with the wrong |
|
|
# version of proj. If they are running prebuilt binaries |
|
|
# check_version should always return true. |
|
|
# |
|
|
if not wxproj.check_version(4, 4, 5): |
|
|
errors.append("proj < 4.4.5") |
|
|
|
|
|
if wxPlatform == "__WXGTK__": |
|
|
if not wxproj.check_version_gtk(1, 2, 0): |
|
|
errors.append("gtk < 1.2") |
|
39 |
|
|
40 |
if len(errors) > 0: |
if len(errors) > 0: |
41 |
msg = " The following version errors were detected:" |
msg = " The following version errors were detected:" |