Changeset 894


Ignore:
Timestamp:
12/21/2012 04:00:38 PM (11 years ago)
Author:
marcus
Message:
  • working on trace attributes
Location:
SHX/trunk/SeismicHandler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • SHX/trunk/SeismicHandler/modules/wx_.py

    r892 r894  
    1010import math 
    1111from SeismicHandler.basics.messages import msgs, subscribe_ui_event, \ 
    12                                                        log_message, get_runtime 
     12                                            log_message, get_runtime, get_style 
    1313from SeismicHandler.core import Traces 
    1414from SeismicHandler.basics.codes import NAME, VERSION 
     15from SeismicHandler.basics.tools import AttributeBlock 
    1516from obspy.core import read, UTCDateTime 
    1617from obspy.sh.core import fromUTCDateTime 
     
    6263        self.space = None 
    6364        self.interactive = "trace_time" 
     65 
     66        self.ppi = wx.ScreenDC().GetPPI() 
    6467 
    6568        self._setup() 
     
    8487#        msgs.subscribe(self.OnNotifyTraceOrder, 'GUI.traceorder') 
    8588#        msgs.subscribe(self.OnNotifyTimeAxis, 'GUT.timeaxis') 
     89        msgs.subscribe(self.__runtime_changer, "setruntime") 
    8690 
    8791        # init 
    8892        self.OnPaint(None) 
    8993        self.SetFocus() 
     94 
     95    def __runtime_changer(self, name, value): 
     96        """ 
     97        Helper method for acting on certain runtime events. Called via message 
     98        system. 
     99        """ 
     100        if name != "RUNTIME:styles": 
     101            return 
     102        margins = value.get("MARGINS", None) 
     103 
     104        if not margins: 
     105            return 
     106 
     107        # convert inch values to pixels 
     108        margins = [ 
     109            margins[0] * self.ppi[1], 
     110            margins[1] * self.ppi[0], 
     111            margins[2] * self.ppi[1], 
     112            margins[3] * self.ppi[0] 
     113        ] 
     114 
     115        global MARGINS 
     116        if MARGINS != margins: 
     117            MARGINS = margins 
    90118 
    91119    # event processing 
     
    351379        # horizontal plotting 
    352380        if self.traceOrder in [0, 1]: 
    353             timepos -= STATION_INFO + MARGIN[1] 
     381            timepos -= STATION_INFO + MARGINS[1] 
    354382        # vertical plotting 
    355383        elif self.traceOrder == 2: 
     
    372400 
    373401        return t 
    374  
    375402 
    376403    def ScreenToTraceAndTime(self, x, y): 
     
    729756                                                   theight - line[3], line[2]]) 
    730757 
     758            # get color, etc. attribute 
     759#            import pdb; pdb.set_trace() 
     760            attrib = t.get_info("attrib") 
     761            try: 
     762                style = get_style(attrib) 
     763            except KeyError: 
     764                style = AttributeBlock() 
     765            print style 
    731766            buffer.BeginDrawing() 
    732767            buffer.DrawLineList(ImageData) 
  • SHX/trunk/SeismicHandler/patches/obspy_.py

    r886 r894  
    342342 
    343343    self.stats.sh.ZOOM = get_runtime("zoom", 1.) 
    344     self.stats.sh.ATTRIB = get_runtime("attrib", 0) 
     344    self.stats.sh.ATTRIB = '0' 
    345345    self.stats.sh.REDUCTION = get_runtime("reduction", 1) 
    346346    self.stats.sh.NORM = get_runtime("norm", 0.5) 
Note: See TracChangeset for help on using the changeset viewer.