Changeset 5e8e615 in sasview
- Timestamp:
- Apr 28, 2011 12:22:37 PM (14 years ago)
- 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:
- 7a955a9
- Parents:
- bd5ac39
- Location:
- guiframe
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_panel.py
rea4dfe0 r5e8e615 117 117 self.tree_ctrl_theory = None 118 118 self.perspective_cbox = None 119 self.at_least_on_check = True 120 119 121 120 self.owner = None 122 121 self.do_layout() … … 144 143 145 144 self.sizer2 = wx.BoxSizer(wx.VERTICAL) 146 #self.sizer3 = wx.GridBagSizer(5,5)147 145 self.sizer3 = wx.FlexGridSizer(5, 2, 0, 0) 148 146 self.sizer4 = wx.BoxSizer(wx.HORIZONTAL) … … 177 175 self.enable_selection() 178 176 179 def layout_perspective(self, list_of_perspective=[]): 180 """ 181 Layout widgets related to the list of plug-ins of the gui_manager 182 """ 183 if len(list_of_perspective)==0: 184 return 185 w, h = self.parent.GetSize() 186 box_description_2= wx.StaticBox(self, -1, "Set Active Perspective") 187 self.boxsizer_2 = wx.StaticBoxSizer(box_description_2, wx.HORIZONTAL) 188 self.sizer_perspective = wx.GridBagSizer(5,5) 189 self.boxsizer_2.Add(self.sizer_perspective) 190 self.sizer2.Add(self.boxsizer_2,1, wx.ALL, 10) 191 self.list_of_perspective = list_of_perspective 192 self.sizer_perspective.Clear(True) 193 self.list_rb_perspectives = [] 194 195 nb_active_perspective = 0 196 if list_of_perspective: 197 ix = 0 198 iy = 0 199 for perspective_name, is_active in list_of_perspective: 200 201 if is_active: 202 nb_active_perspective += 1 203 if nb_active_perspective == 1: 204 rb = wx.RadioButton(self, -1, perspective_name, 205 style=wx.RB_GROUP) 206 rb.SetToolTipString("Data will be applied to this perspective") 207 rb.SetValue(is_active) 208 else: 209 rb = wx.RadioButton(self, -1, perspective_name) 210 rb.SetToolTipString("Data will be applied to this perspective") 211 #only one perpesctive can be active 212 rb.SetValue(False) 213 214 self.Bind(wx.EVT_RADIOBUTTON, self.on_set_active_perspective, 215 id=rb.GetId()) 216 self.list_rb_perspectives.append(rb) 217 self.sizer_perspective.Add(rb,(iy, ix),(1,1), 218 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 219 iy += 1 220 else: 221 rb = wx.RadioButton(self, -1, 'No Perspective', 222 style=wx.RB_GROUP) 223 rb.SetValue(True) 224 rb.Disable() 225 ix = 0 226 iy = 0 227 self.sizer_perspective.Add(rb,(iy, ix),(1,1), 228 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 229 177 230 178 def _on_selection_type(self, event): 231 179 """ … … 250 198 if option == 'Select all Data': 251 199 self.tree_ctrl.CheckItem(data_ctrl, True) 252 self.at_least_on_check = True253 200 elif option == 'Unselect all Data': 254 201 self.tree_ctrl.CheckItem(data_ctrl, False) 255 self.at_least_on_check = False256 202 elif option == 'Select all Data 1D': 257 203 if data_class == 'Data1D': 258 204 self.tree_ctrl.CheckItem(data_ctrl, True) 259 self.at_least_on_check = True260 205 elif option == 'Unselect all Data 1D': 261 206 if data_class == 'Data1D': … … 264 209 if data_class == 'Data1D': 265 210 self.tree_ctrl.CheckItem(data_ctrl, True) 266 self.at_least_on_check = True267 211 elif option == 'Select all Data 2D': 268 212 if data_class == 'Data2D': 269 213 self.tree_ctrl.CheckItem(data_ctrl, True) 270 self.at_least_on_check = True271 214 elif option == 'Unselect all Data 2D': 272 215 if data_class == 'Data2D': … … 278 221 #self.enable_remove() 279 222 280 def on_set_active_perspective(self, event):281 """282 Select the active perspective283 """284 ctrl = event.GetEventObject()285 286 223 def layout_button(self): 287 224 """ … … 314 251 self.bt_freeze.SetToolTipString("To trigger freeze a theory") 315 252 wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze) 316 317 253 318 #self.tctrl_perspective.SetToolTipString("Active Application")319 #perspective_font = self.tctrl_perspective.GetFont()320 #perspective_font.SetWeight(wx.BOLD)321 #self.tctrl_perspective.SetFont(perspective_font)322 #self.tctrl_perspective.SetClientSize((80,20))323 324 254 self.cb_plotpanel = wx.ComboBox(self, -1, size=(CBOX_WIDTH, -1), 325 255 style=wx.CB_READONLY|wx.CB_SORT) 326 256 wx.EVT_COMBOBOX(self.cb_plotpanel,-1, self._on_plot_selection) 327 self.cb_plotpanel.Append('None') 328 self.cb_plotpanel.SetStringSelection('None') 257 self.cb_plotpanel.Disable() 329 258 330 #self.tctrl_plotpanel = wx.StaticText(self, -1, 'No Plot panel on focus')331 #self.tctrl_plotpanel.SetToolTipString("Active Plot Panel")332 333 334 259 self.sizer3.AddMany([(self.bt_add), 335 260 ((10, 10)), … … 343 268 self.sizer3.AddGrowableCol(1, 1) 344 269 345 """346 ix = 0347 iy = 0348 self.sizer3.Add(self.bt_add,( iy, ix),(1,1),349 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)350 #ix += 1351 #self.sizer3.Add(self.bt_remove,( iy, ix),(1,1),352 # wx.EXPAND|wx.ADJUST_MINSIZE, 0)353 ix = 0354 iy += 1355 self.sizer3.Add(self.bt_import,( iy, ix),(1,1),356 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)357 358 ix += 1359 self.sizer3.Add(self.perspective_cbox,(iy, ix),(1,1),360 wx.EXPAND|wx.ADJUST_MINSIZE, 0)361 ix = 0362 iy += 1363 self.sizer3.Add(self.bt_append_plot,( iy, ix),(1,1),364 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)365 ix += 1366 self.sizer3.Add(self.cb_plotpanel,(iy, ix),(1,1),367 wx.EXPAND|wx.ADJUST_MINSIZE, 0)368 ix = 0369 iy += 1370 self.sizer3.Add(self.bt_plot,( iy, ix),(1,1),371 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)372 ix = 0373 iy += 1374 self.sizer3.Add(self.bt_freeze,( iy, ix),(1,1),375 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)376 """377 270 #self.enable_remove() 378 271 self.enable_import() … … 426 319 item = event.GetItem() 427 320 item.Check(not item.IsChecked()) 428 if item.IsChecked():429 self.at_least_on_check = True430 321 self.enable_append() 431 322 self.enable_freeze() … … 519 410 data_ctrl, _, _, _,_, _ = item 520 411 self.tree_ctrl.CheckItem(data_ctrl, False) 521 self.at_least_on_check = False522 412 self.enable_append() 523 413 self.enable_freeze() … … 838 728 if event != None: 839 729 event.Skip() 840 841 730 # send parent to update menu with no show nor hide action 842 731 self.parent.show_data_panel(action=False) 843 732 844 845 733 def on_freeze(self, event): 846 734 """ … … 868 756 break 869 757 self.enable_append() 870 758 871 759 def _on_perspective_selection(self, event=None): 872 760 """ … … 885 773 if event != None: 886 774 combo = event.GetEventObject() 887 event.Skip()775 #event.Skip() 888 776 else: 889 777 combo = self.cb_plotpanel … … 937 825 else: 938 826 self.bt_plot.Enable() 939 940 827 self.enable_append() 828 941 829 def enable_append(self): 942 830 """ … … 945 833 n_t = 0 946 834 n_t_t = 0 947 if not self.at_least_on_check:948 self.bt_append_plot.Disable()949 self.cb_plotpanel.Disable()950 else:951 self.bt_append_plot.Enable()952 self.cb_plotpanel.Enable()953 835 if self.tree_ctrl != None: 954 836 n_t = self.tree_ctrl.GetCount() … … 958 840 self.bt_append_plot.Disable() 959 841 self.cb_plotpanel.Disable() 960 elif self.cb_plotpanel.GetValue() == 'None': 961 self.bt_append_plot.Disable() 962 if self.cb_plotpanel.GetCount() <= 1: 842 elif self.cb_plotpanel.GetCount() <= 0: 963 843 self.cb_plotpanel.Disable() 964 else: 965 self.cb_plotpanel.Ensable() 844 self.bt_append_plot.Disable() 966 845 else: 967 846 self.bt_append_plot.Enable() … … 980 859 n_t_t = self.tree_ctrl_theory.GetCount() 981 860 n_l = len(self.list_cb_theory) 982 if (n_t_t + n_l > 0) and self.at_least_on_check:861 if (n_t_t + n_l > 0): 983 862 self.bt_freeze.Enable() 984 863 else: … … 1030 909 self.panel.load_data_list(list=list) 1031 910 1032 def layout_perspective(self, list_of_perspective=[]): 1033 """ 1034 """ 1035 self.panel.layout_perspective(list_of_perspective=list_of_perspective) 1036 1037 1038 911 1039 912 1040 913 from dataFitting import Data1D … … 1141 1014 window = DataFrame(list=data_list) 1142 1015 window.load_data_list(list=data_list) 1143 #window.layout_perspective(list_of_perspective=list_of_perspective)1144 1016 window.Show(True) 1145 1017 window.load_data_list(list=temp_data_list) -
guiframe/gui_manager.py
rea4dfe0 r5e8e615 2133 2133 self.panel_on_focus = panel 2134 2134 self.set_panel_on_focus(None) 2135 print " on_set_plot_focus" 2136 2135 2137 2136 def _onDrawIdle(self, *args, **kwargs): 2138 2137 """
Note: See TracChangeset
for help on using the changeset viewer.