Changeset 0a2fdca in sasview for guiframe/data_panel.py


Ignore:
Timestamp:
Apr 12, 2011 1:00:08 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
a1a252e
Parents:
f69b5830
Message:

fixing plot panel and control panels focusing problems

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_panel.py

    r1b1bbf9 r0a2fdca  
    255255        wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove) 
    256256         
    257         self.tctrl_perspective = wx.StaticText(self, -1, 'No Active Application') 
     257        self.tctrl_perspective = wx.StaticText(self, -1,  
     258                            'No Active Application', 
     259                        style=wx.SUNKEN_BORDER|wx.ALIGN_LEFT) 
    258260        self.tctrl_perspective.SetToolTipString("Active Application") 
    259         self.tctrl_plotpanel = wx.StaticText(self, -1, 'No Plot panel on focus') 
    260         self.tctrl_plotpanel.SetToolTipString("Active Plot Panel") 
     261        perspective_font = self.tctrl_perspective.GetFont() 
     262        perspective_font.SetWeight(wx.BOLD) 
     263        self.tctrl_perspective.SetFont(perspective_font) 
     264        self.tctrl_perspective.SetClientSize((80,20)) 
     265        self.cb_plotpanel = wx.ComboBox(self, -1,  
     266                                style=wx.CB_READONLY|wx.CB_SORT) 
     267        wx.EVT_COMBOBOX(self.cb_plotpanel,-1, self._on_plot_selection) 
     268        self.cb_plotpanel.Append('None') 
     269        self.cb_plotpanel.SetStringSelection('None') 
     270 
     271        #self.tctrl_plotpanel = wx.StaticText(self, -1, 'No Plot panel on focus') 
     272        #self.tctrl_plotpanel.SetToolTipString("Active Plot Panel") 
    261273     
    262274        ix = 0 
     
    272284                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    273285        ix += 1 
    274         self.sizer3.Add(self.tctrl_plotpanel,(iy, ix),(1,1), 
     286        self.sizer3.Add(self.cb_plotpanel,(iy, ix),(1,1), 
    275287                          wx.EXPAND|wx.ADJUST_MINSIZE, 0)   
    276288        ix = 0           
     
    624636        append plot to plot panel on focus 
    625637        """ 
     638        self._on_plot_selection() 
    626639        data_id, theory_id, state_id = self.set_data_helper() 
    627640        self.parent.plot_data(data_id=data_id,   
     
    662675        """ 
    663676        self.tctrl_perspective.SetLabel(str(name)) 
     677        #perspective_font = self.tctrl_perspective.GetFont() 
     678        #perspective_font.SetWeight(wx.BOLD) 
     679        self.tctrl_perspective.SetClientSize((80,20))#SetFont(perspective_font) 
    664680      
    665681    def set_panel_on_focus(self, name): 
     
    667683        set the plot panel on focus 
    668684        """ 
    669         self.tctrl_plotpanel.SetLabel(str(name)) 
     685        for key, value in self.parent.plot_panels.iteritems(): 
     686            name_plot_panel = str(value.window_caption) 
     687            if name_plot_panel not in self.cb_plotpanel.GetItems(): 
     688                self.cb_plotpanel.Append(name_plot_panel, value) 
     689            self.cb_plotpanel.SetStringSelection(name_plot_panel) 
     690 
    670691  
     692    def _on_plot_selection(self, event = None): 
     693        """ 
     694        On source combobox selection 
     695        """ 
     696        if event != None: 
     697            combo = event.GetEventObject() 
     698            event.Skip() 
     699        else: 
     700            combo = self.cb_plotpanel 
     701        selection = combo.GetSelection() 
     702 
     703        if combo.GetValue() != 'None': 
     704            panel = combo.GetClientData(selection) 
     705            self.parent.on_set_plot_focus(panel)    
     706 
    671707     
    672708 
Note: See TracChangeset for help on using the changeset viewer.