Changeset 0d9dae8 in sasview


Ignore:
Timestamp:
Feb 2, 2009 11:51:27 AM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
2cf2b87
Parents:
00d083c
Message:

add a new module containing common classes that I used often:
sans.guiframe.utils

remove event slicer and add it in sans.guicoom.events,
modified slicer for those events

Location:
guiframe
Files:
3 added
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • guiframe/gui_manager.py

    racb1ad1 r0d9dae8  
    3535    import config 
    3636     
    37 from sans.guicomm.events import EVT_STATUS 
     37from sans.guicomm.events import EVT_STATUS,Model2DPanelEvent 
    3838 
    3939import warnings 
     
    227227        # Register to status events 
    228228        self.Bind(EVT_STATUS, self._on_status_event) 
    229               
     229        
    230230    def build_gui(self): 
    231231        # Set up the layout 
     
    419419            if self.panels[item].window_name.startswith(p.window_name):  
    420420                count += 1 
    421                  
     421                """ 
     422        if p.window_name =="Analytical model 2D ": 
     423            print "guiframe 2D id",ID, p.window_name 
     424            event = Model2DPanelEvent(id= ID, pname=p.window_name) 
     425            for plug in self.plugins: 
     426                if hasattr(plug, fitpanel) 
     427                wx.PostEvent(plug, event) 
     428         """    
    422429        windowname = p.window_name 
    423430        caption = p.window_caption 
     
    450457         
    451458        # Register for showing/hiding the panel 
     459         
    452460        wx.EVT_MENU(self, ID, self._on_view) 
    453461         
     
    488496            if len(pers)>0: 
    489497                n_panels += 1 
    490          
     498        
    491499        if n_panels>1: 
    492500            viewmenu = wx.Menu() 
     
    501509                        if panel.window_name in pers: 
    502510                            plugmenu.Append(int(item), panel.window_caption, "Show %s window" % panel.window_caption) 
     511                            
     512                             
     513                             
    503514                            wx.EVT_MENU(self, int(item), self._on_view) 
    504515                     
     
    551562                for (self.next_id, menu, name) in item.populate_menu(self.next_id, self): 
    552563                    menubar.Append(menu, name) 
    553          
     564                    
    554565 
    555566        menubar.Append(helpmenu, '&Help') 
  • guiframe/local_perspectives/plotting/AnnulusSlicer.py

    r7608cb5 r0d9dae8  
    66# 
    77 
    8   
     8import math 
     9import wx 
     10from copy import deepcopy  
    911# Debug printout 
    10 from sans.guicomm.events import StatusEvent  
    11 from sans.guicomm.events import NewPlotEvent 
     12from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS 
    1213from BaseInteractor import _BaseInteractor 
    13 from copy import deepcopy 
    14 import math 
    15  
    16 import SlicerParameters 
    17 import wx 
     14 
    1815 
    1916class AnnulusInteractor(_BaseInteractor): 
     
    5754         
    5855        # Bind to slice parameter events 
    59         self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
     56        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
    6057         
    6158 
     
    9087        self.inner_circle.clear() 
    9188        #self.base.connect.disconnect() 
    92         self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS) 
     89        self.base.parent.Unbind(EVT_SLICER_PARS) 
    9390         
    9491    def update(self): 
     
    154151        new_plot.detector =self.base.data2D.detector 
    155152        # If the data file does not tell us what the axes are, just assume... 
    156         new_plot.xaxis("\\rm{\phi}", ' ^{o}') 
     153        new_plot.xaxis("\\rm{\phi}", 'rad') 
    157154        new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 
    158155        new_plot.group_id = "SectorPhi"+self.base.data2D.name 
     
    169166         
    170167        # Post paramters 
    171         event = SlicerParameters.SlicerParameterEvent() 
     168        event = SlicerParameterEvent() 
    172169        event.type = self.__class__.__name__ 
    173170        event.params = self.get_params() 
  • guiframe/local_perspectives/plotting/Arc.py

    rcd84dca r0d9dae8  
    1 #from config import printEVT 
     1 
     2import math 
     3import wx  
     4from copy import deepcopy 
     5 
    26from BaseInteractor import _BaseInteractor 
    3 from copy import deepcopy 
    4 import math 
    5  
    6 #from Plotter1D import AddPlotEvent 
    7 import SlicerParameters 
    8 import wx    
    9 #import radii  
    10 #(FunctionRadiusEvent, EVT_FUNC_RAD) = wx.lib.newevent.NewEvent()       
     7from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS 
     8   
     9  
    1110class ArcInteractor(_BaseInteractor): 
    1211    """ 
     
    114113        self.has_move= False 
    115114         
    116         event = SlicerParameters.SlicerParameterEvent() 
     115        event = SlicerParameterEvent() 
    117116        event.type = self.__class__.__name__ 
    118117        event.params = self.get_params() 
  • guiframe/local_perspectives/plotting/AzimutSlicer.py

    r54cc36a r0d9dae8  
    88 
    99# Debug printout 
     10import math 
     11import wx 
     12from copy import deepcopy 
    1013 
    1114from BaseInteractor import _BaseInteractor 
    12 from copy import deepcopy 
    13 import math 
    14  
    15 from sans.guicomm.events import NewPlotEvent, StatusEvent 
    16 import SlicerParameters 
    17 import wx 
     15from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS 
     16 
     17 
    1818 
    1919class SectorInteractor(_BaseInteractor): 
     
    5959        self._post_data() 
    6060        # Bind to slice parameter events 
    61         self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
     61        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
    6262 
    6363 
     
    9696        self.left_edge.clear() 
    9797        #self.base.connect.disconnect() 
    98         self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS) 
     98        self.base.parent.Unbind(EVT_SLICER_PARS) 
    9999         
    100100    def update(self): 
     
    197197         
    198198         # Post paramters 
    199         #event = SlicerParameters.SlicerParameterEvent() 
     199        #event = SlicerParameterEvent() 
    200200        #event.type = self.__class__.__name__ 
    201201        #event.params = self.get_params() 
  • guiframe/local_perspectives/plotting/Edge.py

    re8c96f5 r0d9dae8  
    1 #from config import printEVT 
     1 
     2import math 
     3import wx   
     4from copy import deepcopy 
     5 
    26from BaseInteractor import _BaseInteractor 
    3 from copy import deepcopy 
    4 import math 
     7from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS 
     8    
    59 
    6 #from Plotter1D import AddPlotEvent 
    7 import SlicerParameters 
    8 import wx      
    910 
    10 import wx.lib.newevent 
    1111        
    1212class RadiusInteractor(_BaseInteractor): 
  • guiframe/local_perspectives/plotting/LineSlicer.py

    r54cc36a r0d9dae8  
    88 
    99# Debug printout 
    10 from sans.guicomm.events import StatusEvent  
     10import math 
     11import wx 
     12from copy import deepcopy 
     13 
     14from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS 
    1115from BaseInteractor import _BaseInteractor 
    12 from copy import deepcopy 
    13 import math 
    14  
    15 from sans.guicomm.events import NewPlotEvent 
    16 import SlicerParameters 
    17 import wx 
     16 
     17 
    1818 
    1919class LineInteractor(_BaseInteractor): 
     
    6868         
    6969        # Bind to slice parameter events 
    70         self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
     70        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
    7171         
    7272    def _onEVT_SLICER_PARS(self, event): 
     
    123123        # Unbind panel 
    124124        #self.base.connect.disconnect() 
    125         self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS) 
     125        self.base.parent.Unbind(EVT_SLICER_PARS) 
    126126 
    127127         
     
    241241         
    242242        # Post paramters 
    243         event = SlicerParameters.SlicerParameterEvent() 
     243        event = SlicerParameterEvent() 
    244244        event.type = self.__class__.__name__ 
    245245        event.params = self.get_params() 
  • guiframe/local_perspectives/plotting/Plotter1D.py

    rffd23b5 r0d9dae8  
    1212import wx 
    1313import sys 
     14import pylab 
     15 
    1416import danse.common.plottools 
    1517from danse.common.plottools.PlotPanel import PlotPanel 
    1618from danse.common.plottools.plottables import Graph,Data1D 
    1719from sans.guicomm.events import EVT_NEW_PLOT 
    18 from sans.guicomm.events import StatusEvent ,NewPlotEvent 
    19  
    20  
    21 from SlicerParameters import SlicerEvent 
     20from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent 
     21from sans.guiframe.utils import PanelMenu 
     22 
    2223from binder import BindArtist 
    23 (InternalEvent, EVT_INTERNAL)   = wx.lib.newevent.NewEvent() 
    24 #from SlicerParameters import SlicerEvent 
    25 #(InternalEvent, EVT_INTERNAL)   = wx.lib.newevent.NewEvent() 
     24 
     25 
    2626DEFAULT_QMAX = 0.05 
    27  
    2827DEFAULT_QSTEP = 0.001 
    2928DEFAULT_BEAM = 0.005 
    3029BIN_WIDTH =1 
    31 import pylab 
    32  
    33 class PanelMenu(wx.Menu): 
    34     plots = None 
    35     graph = None 
    36      
    37     def set_plots(self, plots): 
    38         self.plots = plots 
    39      
    40     def set_graph(self, graph): 
    41         self.graph = graph 
     30 
     31 
    4232class ModelPanel1D(PlotPanel): 
    4333    """ 
  • guiframe/local_perspectives/plotting/Plotter2D.py

    r50cbace r0d9dae8  
    1212import wx 
    1313import sys 
     14import pylab 
     15 
    1416import danse.common.plottools 
    1517from danse.common.plottools.PlotPanel import PlotPanel 
    1618from danse.common.plottools.plottables import Graph,Data1D 
    17 from sans.guicomm.events import EVT_NEW_PLOT 
    18 from sans.guicomm.events import StatusEvent ,NewPlotEvent 
    19  
    20  
    21 from SlicerParameters import SlicerEvent 
     19from sans.guicomm.events import EVT_NEW_PLOT,EVT_SLICER_PARS_UPDATE 
     20from sans.guicomm.events import EVT_SLICER_PARS 
     21from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent 
     22from sans.guiframe.utils import PanelMenu 
    2223from binder import BindArtist 
     24from Plotter1D import ModelPanel1D 
    2325(InternalEvent, EVT_INTERNAL)   = wx.lib.newevent.NewEvent() 
    24 #from SlicerParameters import SlicerEvent 
    25 #(InternalEvent, EVT_INTERNAL)   = wx.lib.newevent.NewEvent() 
    26 from Plotter1D import ModelPanel1D 
     26 
     27 
     28 
    2729DEFAULT_QMAX = 0.05 
    28  
    2930DEFAULT_QSTEP = 0.001 
    3031DEFAULT_BEAM = 0.005 
    3132BIN_WIDTH = 1.0 
    32 import pylab 
    33 from Plotter1D import PanelMenu 
    34 #import boxSum 
    35 from sans.guicomm.events import EVT_SLICER_PARS_UPDATE 
     33 
     34 
     35 
     36 
    3637class ModelPanel2D( ModelPanel1D): 
    3738    """ 
     
    8687        self.graph.render(self) 
    8788        #self.Bind(boxSum.EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PARS) 
    88         self.Bind(EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PARS) 
    89    
     89        self.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
     90        self.Bind(EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PANEL) 
     91         
     92         
    9093    def _onEVT_SLICER_PARS(self, event): 
     94        print "paramaters entered on slicer panel", event.type, event.params 
     95        self.slicer.set_params(event.params) 
     96        from sans.guicomm.events import SlicerPanelEvent 
     97        wx.PostEvent(self.parent, SlicerPanelEvent (panel= self.panel_slicer)) 
     98         
     99         
     100    def _onEVT_SLICER_PANEL(self, event): 
    91101        print "box move plotter2D", event.type, event.params 
    92102        self.panel_slicer.set_slicer(event.type, event.params) 
    93103        from sans.guicomm.events import SlicerPanelEvent 
    94         wx.PostEvent(self.parent, SlicerPanelEvent (panel= self.panel_slicer)) 
     104        wx.PostEvent(self.parent, SlicerPanelEvent (panel= self.panel_slicer))  
     105         
    95106    def _onEVT_1DREPLOT(self, event): 
    96107        """ 
     
    406417         
    407418        from slicerpanel import SlicerPanel 
    408         new_panel = SlicerPanel(parent= self.parent,id= -1,type=event.type, 
     419        new_panel = SlicerPanel(parent= self.parent,id= -1,base= self,type=event.type, 
    409420                                 params=event.params, style=wx.RAISED_BORDER) 
    410421        #new_panel.set_slicer(self.slicer.__class__.__name__, 
     
    422433        self.onClearSlicer(event) 
    423434        wx.PostEvent(self.parent, InternalEvent(slicer= BoxInteractorX)) 
    424          
     435        """ 
    425436        from slicerpanel import SlicerPanel 
    426437        new_panel = SlicerPanel(self.parent, -1, style=wx.RAISED_BORDER) 
     
    428439        from sans.guicomm.events import SlicerPanelEvent 
    429440        wx.PostEvent(self.parent, SlicerPanelEvent (panel= new_panel)) 
    430          
     441        """ 
    431442    def onBoxavgY(self,event): 
    432443        from boxSlicer import BoxInteractorY 
    433444        self.onClearSlicer(event) 
    434445        wx.PostEvent(self.parent, InternalEvent(slicer= BoxInteractorY)) 
    435          
     446        """ 
    436447        from slicerpanel import SlicerPanel 
    437448        new_panel = SlicerPanel(self.parent, -1, style=wx.RAISED_BORDER) 
     
    439450        from sans.guicomm.events import SlicerParameterEvent  
    440451        wx.PostEvent(self.parent, SlicerParameterEvent (panel= new_panel)) 
    441           
     452        """ 
    442453    def onClearSlicer(self, event): 
    443454        """ 
  • guiframe/local_perspectives/plotting/SectorSlicer.py

    r54cc36a r0d9dae8  
    88 
    99# Debug printout 
    10 from sans.guicomm.events import StatusEvent  
    11 from sans.guicomm.events import NewPlotEvent 
     10import math 
     11import wx 
     12from copy import deepcopy 
     13 
    1214from BaseInteractor import _BaseInteractor 
    13 from copy import deepcopy 
    14 import math 
    15  
    16  
    17 import SlicerParameters 
    18 import wx 
     15from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS 
     16 
     17 
     18 
     19 
     20 
    1921 
    2022class SectorInteractor(_BaseInteractor): 
     
    6163         
    6264        # Bind to slice parameter events 
    63         self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
     65        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
    6466 
    6567 
     
    9597        self.right_line.clear() 
    9698        #self.base.connect.disconnect() 
    97         self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS) 
     99        self.base.parent.Unbind(EVT_SLICER_PARS) 
    98100         
    99101    def update(self): 
     
    194196         
    195197        # Post paramters 
    196         event = SlicerParameters.SlicerParameterEvent() 
     198        event = SlicerParameterEvent() 
    197199        event.type = self.__class__.__name__ 
    198200        event.params = self.get_params() 
  • guiframe/local_perspectives/plotting/SlicerParameters.py

    r54cc36a r0d9dae8  
    77from copy import deepcopy 
    88 
    9 (SlicerEvent, EVT_SLICER)   = wx.lib.newevent.NewEvent() 
    10 (SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent() 
     9from sans.guiframe.utils import format_number 
     10from sans.guicomm.events import EVT_SLICER,EVT_SLICER_PARS,SlicerParameterEvent 
    1111 
    1212 
    13 def format_number(value, high=False): 
    14     """ 
    15         Return a float in a standardized, human-readable formatted string  
    16     """ 
    17     try:  
    18         value = float(value) 
    19     except: 
    20         return "NaN" 
    21      
    22     if high: 
    23         return "%-6.4g" % value 
    24     else: 
    25         return "%-5.3g" % value 
     13 
    2614 
    2715class SlicerParameterPanel(wx.Dialog): 
  • guiframe/local_perspectives/plotting/boxSlicer.py

    rffd23b5 r0d9dae8  
    1313import math 
    1414 
    15 from sans.guicomm.events import NewPlotEvent, StatusEvent 
     15from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS 
    1616import SlicerParameters 
    1717import wx 
     
    7575         
    7676        # Bind to slice parameter events 
    77         self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
     77        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
    7878 
    7979 
     
    111111        self.bottom_line.clear() 
    112112        #self.base.connect.disconnect() 
    113         self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS) 
     113        self.base.parent.Unbind(EVT_SLICER_PARS) 
    114114         
    115115    def update(self): 
     
    245245         
    246246        # Post paramters 
    247         event = SlicerParameters.SlicerParameterEvent() 
     247        event = SlicerParameterEvent() 
    248248        event.type = self.__class__.__name__ 
    249249        event.params = self.get_params() 
  • guiframe/local_perspectives/plotting/ring.py

    rffd23b5 r0d9dae8  
    88 
    99# Debug printout 
    10 from config import printEVT 
     10import math 
     11import wx 
     12from copy import deepcopy 
     13 
    1114from BaseInteractor import _BaseInteractor 
    12 from copy import deepcopy 
    13 import math 
    14  
    15 from Plotter1D import AddPlotEvent 
    16 import SlicerParameters 
    17 import wx 
     15from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS 
    1816 
    1917class AnnulusInteractor(_BaseInteractor): 
     
    4341         
    4442        # Bind to slice parameter events 
    45         self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
     43        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
    4644 
    4745 
     
    7674        self.inner_circle.clear() 
    7775        #self.base.connect.disconnect() 
    78         self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS) 
     76        self.base.parent.Unbind(EVT_SLICER_PARS) 
    7977         
    8078    def update(self): 
     
    170168         
    171169        # Post paramters 
    172         event = SlicerParameters.SlicerParameterEvent() 
     170        event = SlicerParameterEvent() 
    173171        event.type = self.__class__.__name__ 
    174172        event.params = self.get_params() 
  • guiframe/local_perspectives/plotting/slicerpanel.py

    r1f3655a r0d9dae8  
    77from copy import deepcopy 
    88 
    9 (SlicerEvent, EVT_SLICER)   = wx.lib.newevent.NewEvent() 
    10 (SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent() 
     9from sans.guiframe.utils import format_number 
     10from sans.guicomm.events  import SlicerParameterEvent,EVT_SLICER_PARS,EVT_SLICER 
     11 
     12 
    1113 
    1214class SlicerPanel(wx.Panel): 
     
    2022    CENTER_PANE = False 
    2123     
    22     def __init__(self, parent,id=-1,type=None, params={}, *args, **kwargs): 
     24    def __init__(self, parent,id=-1,type=None,base=None, params={}, *args, **kwargs): 
    2325        wx.Panel.__init__(self, parent,id, *args, **kwargs) 
    24         print "panel created" 
     26        #print "panel created", base 
     27        self.base= base 
    2528        self.params = params 
    2629        self.parent = parent 
     
    2831        self.listeners = [] 
    2932        self.parameters = [] 
     33         
    3034        self.bck = wx.GridBagSizer(5,5) 
    3135        self.SetSizer(self.bck) 
     
    4751            @param event: EVT_SLICER event 
    4852        """ 
    49         print "went here panel" 
     53        #print "went here panel" 
    5054        event.Skip() 
    5155        if event.obj_class==None: 
     
    6266        self.bck.Clear(True)   
    6367        self.type = type   
    64         print "in set slicer", type, params 
     68        #print "in set slicer", type, params 
    6569        if type==None: 
    6670            title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT) 
     
    7882             
    7983            for item in keys: 
    80                 n += 1 
    81                 text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 
    82                 self.bck.Add(text, (n-1,0), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15) 
    83                 ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER) 
     84                if not  item.lower() in ["errors", "count"]: 
     85                    n += 1 
     86                    text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 
     87                    self.bck.Add(text, (n-1,0), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15) 
     88                    ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER) 
     89                    ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item) 
     90                    ctl.SetValue(str(format_number(params[item]))) 
     91                    #ctl.Disable() 
     92                    self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter) 
     93                    ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) 
     94                    self.parameters.append([item, ctl]) 
     95                    self.bck.Add(ctl, (n-1,1), flag=wx.TOP|wx.BOTTOM, border = 0) 
     96            for item in keys: 
     97                if  item.lower() in ["errors", "count"]: 
     98                    n += 1 
     99                    text = wx.StaticText(self, -1, item+": ", style=wx.ALIGN_LEFT) 
     100                    self.bck.Add(text, (n-1,0), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15) 
     101                    ctl = wx.StaticText(self, -1, str(format_number(params[item])), style=wx.ALIGN_LEFT) 
     102                    ctl.SetToolTipString("Result %s" % item) 
     103                    self.bck.Add(ctl, (n-1,1), flag=wx.TOP|wx.BOTTOM, border = 0) 
    84104                 
    85                 ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item) 
    86                  
    87                  
    88                 ctl.SetValue(str(params[item])) 
    89                 ctl.Disable() 
    90                 self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter) 
    91                 ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) 
    92                 self.parameters.append([item, ctl]) 
    93                 self.bck.Add(ctl, (n-1,1), flag=wx.TOP|wx.BOTTOM, border = 0) 
    94105 
    95106        self.bck.Layout() 
     
    97108        self.parent.GetSizer().Layout() 
    98109    def onParamChange(self, evt): 
    99         print "parameters changed" 
     110        #print "parameters changed" 
    100111        evt.Skip() 
    101112        #if evt.type == "UPDATE": 
    102113        for item in self.parameters:               
    103114            if item[0] in evt.params: 
    104                 item[1].SetValue("%-5.3g" %evt.params[item[0]]) 
     115                item[1].SetValue(format_number(evt.params[item[0]])) 
    105116                item[1].Refresh() 
    106          
    107  
    108     def old_onParamChange(self, evt): 
    109         evt.Skip() 
    110         if evt.type == "UPDATE": 
    111             for item in self.parameters:               
    112                 if item[0] in evt.params: 
    113                     item[1].SetValue("%-5.3g" %evt.params[item[0]]) 
    114                     item[1].Refresh() 
     117    
    115118         
    116119    def onTextEnter(self, evt):  
     
    133136        if has_error==False: 
    134137            # Post parameter event 
    135             print "post new param" 
     138            #print "post new param" 
    136139            event = SlicerParameterEvent(type=self.type, params=params) 
    137             wx.PostEvent(self.parent, event) 
    138             print "self parent ", self.parent 
     140            wx.PostEvent(self.base, event) 
     141            #print "panel slicer: self base ", self.base 
    139142         
Note: See TracChangeset for help on using the changeset viewer.