source: SHX/trunk/src/SeismicHandler/startup.py @ 153

Revision 153, 2.3 KB checked in by marcus, 14 years ago (diff)
  • final renaming Events to Messages
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Rev Id Date
Line 
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
24import os
25
26# first check if pythonpath already covers installation directory
27# otherwise append path to pythonpath for Seismic Handler imports
28try:
29    import SeismicHandler
30    del SeismicHandler
31except 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
36from SeismicHandler.core.log import logging
37from SeismicHandler.core.commands import *
38from SeismicHandler.core.modules.Variables import System, Symbol
39from SeismicHandler.core.modules.Trace import Traces as xTraces
40from SeismicHandler.core.modules import Tools
41from SeismicHandler.core.modules.Messages import Message, MessageService
42
43# access to traces
44Traces = xTraces()
45del xTraces
46
47# just init adopted cmd line interface
48import SeismicHandler.config.init_shell
49
50# check for parameters (e.g. for scripts to run)
51try:
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
67except KeyError:
68    pass
69
70del os
Note: See TracBrowser for help on using the repository browser.