Changeset c5dca87 in sasview for calculatorview/perspectives
- Timestamp:
- May 6, 2010 11:44:57 AM (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:
- e6093db
- Parents:
- 85e665e
- Location:
- calculatorview/perspectives/calculator
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/perspectives/calculator/collimation_editor.py
r85e665e rc5dca87 69 69 collimation_name_txt.SetToolTipString(hint_collimation_txt) 70 70 self.collimation_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 71 wx.EVT_COMBOBOX(self.collimation_cbox, -1, self.on_select_collimation) 71 72 hint_collimation_name_txt = 'Name of collimations.' 72 73 self.collimation_cbox.SetToolTipString(hint_collimation_name_txt) … … 229 230 self.enable_collimation() 230 231 self.bt_add_aperture.Enable() 232 self.fill_aperture_combox() 233 self.enable_aperture() 231 234 self.set_values() 232 235 … … 258 261 self.enable_aperture() 259 262 263 def on_select_collimation(self, event): 264 """ 265 fill the control on the panel according to the current selected collimation 266 """ 267 self.set_values() 268 self.fill_aperture_combox() 269 self.enable_aperture() 270 260 271 def enable_collimation(self): 261 272 """ … … 366 377 n_aperture = self.aperture_cbox.GetCount() 367 378 aperture_hint_txt = 'apertures available: %s '%str(n_aperture) 368 if len(collimation.aperture) > 1:379 if len(collimation.aperture) > 0: 369 380 self.bt_remove_aperture.Enable() 370 381 else: … … 393 404 fill the current combobox with the available aperture 394 405 """ 406 self.aperture_cbox.Clear() 395 407 collimation, _, _ = self.get_current_collimation() 396 408 if collimation is None or not collimation.aperture: 397 409 return 398 399 410 for aperture in collimation.aperture: 400 411 pos = self.aperture_cbox.Append(str(aperture.name)) -
calculatorview/perspectives/calculator/data_editor.py
r0c0d458 rc5dca87 14 14 from sans.guicomm.events import StatusEvent 15 15 16 _BOX_WIDTH = 76 16 17 17 _QMIN_DEFAULT = 0.001 18 18 _QMAX_DEFAULT = 0.13 … … 23 23 PANEL_HEIGTH = 350 24 24 FONT_VARIANT = 0 25 _BOX_WIDTH = 51 25 26 ON_MAC = False 26 27 else: 28 _BOX_WIDTH = 76 27 29 PANEL_WIDTH = 550 28 30 PANEL_HEIGTH = 400 … … 194 196 Do the layout for the button widgets 195 197 """ 196 self.bt_summary = wx.Button(self, -1, "View", size=(_BOX_WIDTH *2/3,-1))198 self.bt_summary = wx.Button(self, -1, "View", size=(_BOX_WIDTH,-1)) 197 199 self.bt_summary.SetToolTipString("View final changes on data.") 198 200 self.bt_summary.Bind(wx.EVT_BUTTON, self.on_click_view) 199 201 200 self.bt_save = wx.Button(self, -1, "Save As", size=(_BOX_WIDTH *2/3,-1))202 self.bt_save = wx.Button(self, -1, "Save As", size=(_BOX_WIDTH,-1)) 201 203 self.bt_save.SetToolTipString("Save changes in a file.") 202 204 self.bt_save.Bind(wx.EVT_BUTTON, self.on_click_save) 203 205 204 self.bt_apply = wx.Button(self, -1, "Apply", size=(_BOX_WIDTH *2/3,-1))206 self.bt_apply = wx.Button(self, -1, "Apply", size=(_BOX_WIDTH,-1)) 205 207 self.bt_apply.SetToolTipString("Save changes into the imported data.") 206 208 self.bt_apply.Bind(wx.EVT_BUTTON, self.on_click_apply) 207 209 208 self.bt_reset = wx.Button(self, -1,'Reset', size=(_BOX_WIDTH *2/3,-1))210 self.bt_reset = wx.Button(self, -1,'Reset', size=(_BOX_WIDTH,-1)) 209 211 self.bt_reset.Bind(wx.EVT_BUTTON, self.on_click_reset) 210 212 self.bt_reset.SetToolTipString("Reset data to its initial state.") 211 213 212 self.bt_close = wx.Button(self, -1,'Close', size=(_BOX_WIDTH *2/3,-1))214 self.bt_close = wx.Button(self, -1,'Close', size=(_BOX_WIDTH,-1)) 213 215 self.bt_close.Bind(wx.EVT_BUTTON, self.on_close) 214 216 self.bt_close.SetToolTipString("Close this panel.") … … 555 557 Save change into a file 556 558 """ 557 data, data_name, position = self.get_current_data() 558 if data is None: 559 if not self._data: 559 560 return 560 561 self.on_change_run(event=None) 561 562 self.on_change_title(event=None) 562 563 if issubclass(data.__class__, Data2D):564 msg = "No conventional writing format for \n\n"565 msg += "Data2D at this time.\n"566 dlg = wx.MessageDialog(None, msg, 'Error Loading File',567 wx.OK | wx.ICON_EXCLAMATION)568 dlg.ShowModal()569 return570 571 563 path = None 572 564 wildcard = "CanSAS 1D files(*.xml)|*.xml" … … 574 566 self._default_save_location, "",wildcard , wx.SAVE) 575 567 576 if dlg.ShowModal() == wx.ID_OK: 577 path = dlg.GetPath() 578 mypath = os.path.basename(path) 579 loader = Loader() 580 format = ".xml" 581 if os.path.splitext(mypath)[1].lower() ==format: 582 loader.save( path, data, format) 583 try: 584 self._default_save_location = os.path.dirname(path) 585 except: 586 pass 587 dlg.Destroy() 568 for data in self._data: 569 if issubclass(data.__class__, Data2D): 570 msg = "No conventional writing format for \n\n" 571 msg += "Data2D at this time.\n" 572 dlg = wx.MessageDialog(None, msg, 'Error Loading File', 573 wx.OK | wx.ICON_EXCLAMATION) 574 dlg.ShowModal() 575 else: 576 if dlg.ShowModal() == wx.ID_OK: 577 path = dlg.GetPath() 578 mypath = os.path.basename(path) 579 loader = Loader() 580 format = ".xml" 581 if os.path.splitext(mypath)[1].lower() ==format: 582 loader.save( path, data, format) 583 try: 584 self._default_save_location = os.path.dirname(path) 585 except: 586 pass 587 dlg.Destroy() 588 588 589 589 def on_click_view(self, event):
Note: See TracChangeset
for help on using the changeset viewer.