1 | #! /usr/bin/env python |
---|
2 | # |
---|
3 | # Copyright (C) 2008-2010 Marcus Walther (walther@szgrf.bgr.de) |
---|
4 | # |
---|
5 | # This file is part of Seismic Handler eXtended (SHX) |
---|
6 | # Full details can be found at project website http://www.seismic-handler.org/ |
---|
7 | # |
---|
8 | # SHX is free software; you can redistribute it and/or modify |
---|
9 | # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by |
---|
10 | # the Free Software Foundation; either version 3 of the License, or |
---|
11 | # (at your option) any later version. |
---|
12 | # |
---|
13 | # SHX is distributed in the hope that it will be useful, |
---|
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | # GNU Lesser General Public License for more details. |
---|
17 | # |
---|
18 | # You should have received a copy of the GNU Lesser General Public License |
---|
19 | # along with SHX (see license.txt); if not, write to the Free Software |
---|
20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
---|
21 | |
---|
22 | """import SeismicHandler packages""" |
---|
23 | |
---|
24 | import os |
---|
25 | |
---|
26 | # first check if pythonpath already covers installation directory |
---|
27 | # otherwise append path to pythonpath for Seismic Handler imports |
---|
28 | try: |
---|
29 | import SeismicHandler |
---|
30 | del SeismicHandler |
---|
31 | except ImportError: |
---|
32 | import sys |
---|
33 | sys.path.append(os.sep.join(os.path.split(__file__)[0].split(os.sep)[:-1])) |
---|
34 | |
---|
35 | # finally import modules and commands for instant usage |
---|
36 | from SeismicHandler.core.log import logging |
---|
37 | from SeismicHandler.core.commands import * |
---|
38 | from SeismicHandler.core.modules.Variables import System, Symbol |
---|
39 | from SeismicHandler.core.modules.Trace import Traces as xTraces |
---|
40 | from SeismicHandler.core.modules import Tools |
---|
41 | from SeismicHandler.core.modules.Events import Message, MessageService |
---|
42 | |
---|
43 | # access to traces |
---|
44 | Traces = xTraces() |
---|
45 | del xTraces |
---|
46 | |
---|
47 | # just init adopted cmd line interface |
---|
48 | import SeismicHandler.config.init_shell |
---|
49 | |
---|
50 | # check for parameters (e.g. for scripts to run) |
---|
51 | try: |
---|
52 | if len(os.environ["SHXPARAMETERS"]): |
---|
53 | logging.info("start-up parameter found") |
---|
54 | from SeismicHandler.config.options import options |
---|
55 | |
---|
56 | try: |
---|
57 | Run(options.args[0]) |
---|
58 | # After running script from command line, update trace information. |
---|
59 | MessageService.trigger(Message(MessageService.TRACEUPDATE)) |
---|
60 | except IndexError: |
---|
61 | pass |
---|
62 | |
---|
63 | if not options["keepcmdline"]: |
---|
64 | Quit() |
---|
65 | |
---|
66 | del options |
---|
67 | except KeyError: |
---|
68 | pass |
---|
69 | |
---|
70 | del os |
---|