Changeset 9df6a03 in sasview for src/sas


Ignore:
Timestamp:
Jul 13, 2015 11:13:47 AM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
24386b9
Parents:
a12c0a6
Message:

fix toolbar on bumps/tools graphs. Fixes #452

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/perspectives/fitting/resultpanel.py

    r2f4b430 r9df6a03  
    99import wx.lib.newevent 
    1010from wx.aui import AuiNotebook as Notebook 
     11 
     12from bumps.gui.convergence_view import ConvergenceView 
     13from bumps.gui.uncertainty_view import UncertaintyView, CorrelationView, TraceView 
     14from bumps.dream.stats import var_stats, format_vars 
    1115 
    1216from sas.guiframe.panel_base import PanelBase 
     
    5559        result = event.result[0][0] 
    5660        if hasattr(result, 'convergence'): 
    57             from bumps.gui.convergence_view import ConvergenceView 
    5861            best, pop = result.convergence[:, 0], result.convergence[:, 1:] 
    59             self.get_panel(ConvergenceView).update(best, pop) 
     62            self._get_view(ConvergenceView).update(best, pop) 
     63        else: 
     64            self._del_view(ConvergenceView) 
    6065        if hasattr(result, 'uncertainty_state'): 
    61             from bumps.gui.uncertainty_view import UncertaintyView, CorrelationView, TraceView 
    62             from bumps.dream.stats import var_stats, format_vars 
    6366            stats = var_stats(result.uncertainty_state.draw()) 
    6467            msg = format_vars(stats) 
    65             self.get_panel(CorrelationView).update(result.uncertainty_state) 
    66             self.get_panel(UncertaintyView).update((result.uncertainty_state, stats)) 
    67             self.get_panel(TraceView).update(result.uncertainty_state) 
     68            self._get_view(CorrelationView).update(result.uncertainty_state) 
     69            self._get_view(UncertaintyView).update((result.uncertainty_state, stats)) 
     70            self._get_view(TraceView).update(result.uncertainty_state) 
    6871            # TODO: stats should be stored in result rather than computed in bumps UncertaintyView 
    6972            wx.PostEvent(self.frame.parent, 
    7073                         StatusEvent(status=msg, info="info")) 
    71             print 
     74        else: 
     75            for view in (CorrelationView, UncertaintyView, TraceView): 
     76                self._del_view(view) 
    7277 
    7378    def get_frame(self): 
    7479        return self.frame 
    7580 
    76     def add_panel(self, panel): 
    77         self.AddPage(panel, panel.title) 
    78  
    79     def get_panel(self, panel_class): 
     81    def _get_view(self, view_class): 
    8082        for idx in range(self.PageCount): 
    81             if self.GetPageText(idx) == panel_class.title: 
     83            if self.GetPageText(idx) == view_class.title: 
    8284                return self.GetPage(idx) 
    8385        else: 
    84             panel = panel_class(self) 
    85             self.add_panel(panel) 
     86            panel = view_class(self) 
     87            self.AddPage(panel, panel.title) 
    8688            return panel 
     89 
     90    def _del_view(self, view_class): 
     91        for idx in range(self.PageCount): 
     92            if self.GetPageText(idx) == view_class.title: 
     93                self.DeletePage(idx) 
     94 
Note: See TracChangeset for help on using the changeset viewer.