Changeset 275


Ignore:
Timestamp:
21.09.2010 18:25:54 (10 years ago)
Author:
marcus
Message:

minor refactoring

Location:
SHX/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • SHX/trunk/src/SeismicHandler/basics/command.py

    r256 r275  
    1616#    along with SHX.  If not, see <http://www.gnu.org/licenses/>. 
    1717 
    18 from SeismicHandler.modules.log import logging 
     18from SeismicHandler.modules.log import getLogger 
    1919from SeismicHandler.modules.messages import MessageService, Message 
    2020from SeismicHandler.core import history 
     
    4545        # init logger 
    4646        if not self.logger: 
    47             self.logger = logging.getLogger("command.run") 
     47            self.logger = getLogger("command.run") 
    4848 
    4949        # transfer known qualifiers 
     
    112112            raise NotImplementedError("Command not implemented!") 
    113113 
    114         MessageService.trigger(Message(MessageService.COMMANDRUN)) 
     114        MessageService.trigger(Message(Message.COMMANDRUN)) 
    115115 
    116116    def help(self): 
  • SHX/trunk/src/SeismicHandler/basics/error.py

    r256 r275  
    2222"""module for SHX exceptions""" 
    2323 
    24 from SeismicHandler.modules.log import logging 
     24from SeismicHandler.modules.log import getLogger 
    2525 
    2626class Error(Exception): 
     
    2929    def __init__(self): 
    3030        if not self.logger: 
    31             self.logger = logging.getLogger("core.error") 
     31            self.logger = getLogger("core.error") 
    3232 
    3333        self.logger.debug(self.__class__.__name__) 
  • SHX/trunk/src/SeismicHandler/core/__init__.py

    r257 r275  
    2626from SeismicHandler.modules.runtime import runtime 
    2727 
     28from obspy.core.utcdatetime import UTCDateTime 
    2829from obspy.core import read as obspy_read 
    2930 
  • SHX/trunk/src/SeismicHandler/modules/log.py

    r270 r275  
    2424from SeismicHandler.basics import Singleton 
    2525from SeismicHandler.modules.runtime import runtime 
     26 
    2627import logging 
    2728import os 
     
    116117        return logging.getLogger(name) 
    117118 
     119def getLogger(name): 
     120    """ 
     121    Helper function for initializing a new logger instance. 
     122    """ 
     123    return Logging().newLogger(name) 
     124 
    118125if __name__ == "__main__": 
    119126    a = Logging().newLogger("test") 
  • SHX/trunk/src/SeismicHandler/modules/messages.py

    r256 r275  
    2525""" 
    2626 
    27 from SeismicHandler.basics.error import Error 
    28 from SeismicHandler.modules.log import logging 
    29  
    30 class NotifierNotCallableError(Error): 
    31     def __init__(self): 
    32         Error.__init__(self) 
    33  
    34     def __str__(self): 
    35         return "notifier must be callable!" 
     27from SeismicHandler.modules.log import getLogger 
    3628 
    3729class Message(object): 
    38     """Event class. 
     30    """ 
     31    Event class. 
    3932 
    4033    Implemented as multiton, so that equal id's are represented by identical 
     
    4336 
    4437    _instances = {} 
     38 
     39    # standard events 
     40    TRACEUPDATE = "traceupdate" 
     41    REDRAW = "redraw" 
     42    COMMANDRUN = "cmdrun" 
     43    METAUPDATE = "metaupdate" 
    4544 
    4645    def __new__(cls, id): 
     
    5554 
    5655class MessageController(object): 
    57     """Events manager 
     56    """ 
     57    Events manager. 
    5858 
    5959    Subscribing to events: 
     
    109109    """ 
    110110 
    111     # standard events 
    112     TRACEUPDATE = "traceupdate" 
    113     REDRAW = "redraw" 
    114     COMMANDRUN = "cmdrun" 
    115     INFOIDXUPDATE = "infoindexupdate" 
    116  
    117111    events = {} 
    118112    blocked = set() 
     
    120114 
    121115    def __init__(self): 
    122         self.logger = logging.getLogger("modules.events") 
     116        self.logger = getLogger("modules.events") 
    123117 
    124118    def subscribe(self, events, notify): 
     
    129123 
    130124        if not callable(notify): 
    131             raise NotifierNotCallableError 
     125            raise AttributeError("Notifier must be callable!") 
    132126 
    133127        # change type to list if not iterable 
  • SHX/trunk/src/SeismicHandler/shx.conf

    r273 r275  
    1010 
    1111[main] 
     12# path to command procedures 
    1213scripts = [SHX]/scripts/,[PRIVATE]/scripts/ 
     14# path to filter files 
    1315filters = [SHX]/filters/,[PRIVATE]/filters/ 
     16# path to station information files 
    1417stations = [SHX]/stations/,[PRIVATE]/stations/ 
    1518 
    1619[logging] 
    17 # possible values: debug, info, warning, error, critical 
     20# There are two stages of logging: file and screen. 
     21 
     22# Possible values: debug, info, warning, error, critical 
    1823# also see http://docs.python.org/library/logging.html#logging-levels 
     24 
    1925level_file = debug 
    2026level_screen = error 
    2127 
    2228[miniseed] 
     29# All miniseed backends may have an own configuration section (see below). 
    2330backend = bgrszo,sfd 
    2431 
     
    4148# Any include statement will be treated last regardless of it's position 
    4249# in the section! 
    43 include = [PRIVATE]/graphics.cfg, [PRIVATE]/graphics2.cfg 
    4450# If the included configuration file is not found, the error will be 
    4551# passed silently. 
     52include = [PRIVATE]/graphics.cfg, [PRIVATE]/graphics2.cfg 
    4653 
    47 [layout] 
     54[readdialog] 
    4855# You are able to define variables. All definitions are globally no 
    4956# matter where they are defined. Substitution will be done as last step 
     
    5158$grsn = WET,FUR,BSEG 
    5259$grf = GRA1 
    53 read01 = MOX,$grsn,$grf 
     60read01 = MOX,$grsn,$grf,---,BFO 
     61 
     62[tracedisplay] 
     63# possible values: bottomup, topdown, bottomright, topright, bottomleft, topleft 
     64order = bottomup 
     65# "absolute" vs. "relative" 
     66time = absolute 
     67# currently this is the only one supported (XXX). 
     68annotations = STATION-STREAM-COMPONENT 
  • SHX/trunk/src/sandbox/plot/plot6.py

    r264 r275  
    318318 
    319319    app = wx.PySimpleApp() 
    320     frame = wx.Frame(None, -1, title='MultiPlotter and PlotProxy Test', size=(500,500)) 
     320    frame = wx.Frame(None, -1, title='MultiPlotter and PlotProxy Test', size=(1024,768)) 
    321321    frame.CreateStatusBar() 
    322322    sizer = wx.BoxSizer(wx.VERTICAL) 
     
    345345        timer.Start(timeout) 
    346346 
    347     timeout = 2 
     347    timeout = 50 
    348348    timer = wx.PyTimer(OnNotify) 
    349349    timer.Start(timeout) 
Note: See TracChangeset for help on using the changeset viewer.