Changeset e95614e in sasview for calculatorview/src
- Timestamp:
- Jul 12, 2012 3:50:52 PM (12 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:
- be1ec9f
- Parents:
- 699df7f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/resolution_calculator_panel.py
rb025572 re95614e 26 26 from sans.calculator.resolution_calculator import ResolutionCalculator 27 27 from sans.guiframe.events import StatusEvent 28 from calculator_widgets import OutputTextCtrl29 from calculator_widgets import InputTextCtrl28 from sans.perspectives.calculator.calculator_widgets import OutputTextCtrl 29 from sans.perspectives.calculator.calculator_widgets import InputTextCtrl 30 30 from wx.lib.scrolledpanel import ScrolledPanel 31 31 from math import fabs … … 63 63 64 64 def __init__(self, parent, *args, **kwds): 65 kwds["size"] = (PANEL_WIDTH * 2, PANEL_HEIGHT)66 kwds["style"] = wx.FULL_REPAINT_ON_RESIZE65 kwds["size"] = (PANEL_WIDTH * 2, PANEL_HEIGHT) 66 kwds["style"] = wx.FULL_REPAINT_ON_RESIZE 67 67 ScrolledPanel.__init__(self, parent, *args, **kwds) 68 68 self.SetupScrolling() … … 83 83 self.image = None 84 84 # results of sigmas 85 self.sigma_strings = ' '85 self.sigma_strings = ' ' 86 86 #Font size 87 87 self.SetWindowVariant(variant=FONT_VARIANT) … … 149 149 source_list.sort() 150 150 for idx in range(len(source_list)): 151 self.source_cb.Append(source_list[idx], idx)151 self.source_cb.Append(source_list[idx], idx) 152 152 self.source_cb.SetStringSelection("Neutron") 153 wx.EVT_COMBOBOX(self.source_cb, -1, self._on_source_selection)153 wx.EVT_COMBOBOX(self.source_cb, -1, self._on_source_selection) 154 154 155 155 # combo box for color … … 161 161 self.wave_color_cb.Append('TOF') 162 162 self.wave_color_cb.SetStringSelection("Monochromatic") 163 wx.EVT_COMBOBOX(self.wave_color_cb, -1, self._on_source_color)163 wx.EVT_COMBOBOX(self.wave_color_cb, -1, self._on_source_color) 164 164 165 165 source_hint = "Source Selection: Affect on" … … 273 273 wx.LEFT, 15), 274 274 (self.source_aperture_tcl, 0, wx.LEFT, 15), 275 (source_aperture_unit_txt,0, wx.LEFT, 10)])275 (source_aperture_unit_txt, 0, wx.LEFT, 10)]) 276 276 277 277 … … 297 297 wx.LEFT, 15), 298 298 (self.sample_aperture_tcl, 0, wx.LEFT, 15), 299 (sample_aperture_unit_txt,0, wx.LEFT, 10)])299 (sample_aperture_unit_txt, 0, wx.LEFT, 10)]) 300 300 301 301 … … 366 366 sample2detector_distance_hint) 367 367 self.sample2detector_distance_sizer.AddMany([\ 368 369 370 368 (sample2detector_distance_txt, 0, wx.LEFT, 15), 369 (self.sample2detector_distance_tcl, 0, wx.LEFT, 15), 370 (sample2detector_distance_unit_txt,0, wx.LEFT, 10)]) 371 371 372 372 def _layout_detector_size(self): … … 688 688 self._layout_image() 689 689 # Add a vertical static line 690 self.main_sizer.Add( wx.StaticLine(self, -1, (2, 2),690 self.main_sizer.Add( wx.StaticLine(self, -1, (2, 2), 691 691 (2,PANEL_HEIGHT * 0.94), style = wx.LI_VERTICAL)) 692 692 # Add the plot to main sizer … … 718 718 wx.CallAfter(self.on_compute_call, event) 719 719 720 def on_compute_call(self, event =None):720 def on_compute_call(self, event=None): 721 721 """ 722 722 Execute the computation of resolution … … 776 776 sample2sample_distance = self._string2list(sample2sample_distance) 777 777 self.resolution.set_sample2sample_distance(sample2sample_distance) 778 sample2detector_distance = self.sample2detector_distance_tcl.GetValue() 779 sample2detector_distance = self._string2list(sample2detector_distance) 780 self.resolution.set_sample2detector_distance(sample2detector_distance) 778 sample2detector_distance = \ 779 self.sample2detector_distance_tcl.GetValue() 780 sample2detector_distance = \ 781 self._string2list(sample2detector_distance) 782 self.resolution.set_sample2detector_distance(\ 783 sample2detector_distance) 781 784 detector_size = self.detector_size_tcl.GetValue() 782 785 detector_size = self._string2list(detector_size) … … 827 830 # Compute and get the image plot 828 831 try: 829 from sans.perspectives.calculator.resolcal_thread import CalcRes as thread 832 from sans.perspectives.calculator.resolcal_thread \ 833 import CalcRes as thread 830 834 self.sigma_strings = '\nResolution: Computation is finished. \n' 831 835 cal_res = thread(func = self._map_func, … … 847 851 except: 848 852 raise 849 msg = "An error occured during the resolution computation."850 msg += "Please check your inputs..."851 status_type = 'stop'852 self._status_info(msg, status_type)853 wx.MessageBox(msg, 'Warning')854 853 855 854 def complete(self, image, elapsed=None): … … 911 910 detector_qy_max = self.resolution.detector_qy_max 912 911 else: 913 qx_min, qx_max, qy_min, qy_max = self.resolution.get_detector_qrange() 912 qx_min, qx_max, qy_min, qy_max = \ 913 self.resolution.get_detector_qrange() 914 914 # detector range 915 915 detector_qx_min = self.resolution.qxmin_limit … … 988 988 self.det_coordinate) 989 989 # record sigmas 990 self.sigma_strings += " At Qx = %s, Qy = %s; \n"% (qx_value, qy_value)990 self.sigma_strings += " At Qx = %s, Qy = %s; \n"% (qx_value, qy_value) 991 991 self._sigma_strings() 992 992 return image … … 1170 1170 : return new_string: string like list 1171 1171 """ 1172 new_string = []1172 #new_string = [] 1173 1173 msg = "Wrong format of intputs." 1174 1174 try: … … 1206 1206 # wx.MessageBox(msg, 'Warning') 1207 1207 1208 def _on_xy_coordinate(self, event=None):1208 def _on_xy_coordinate(self, event=None): 1209 1209 """ 1210 1210 Set the detector coordinate for sigmas to x-y coordinate … … 1218 1218 self._onparamEnter() 1219 1219 1220 def _on_rp_coordinate(self, event=None):1220 def _on_rp_coordinate(self, event=None): 1221 1221 """ 1222 1222 Set the detector coordinate for sigmas to polar coordinate … … 1244 1244 self.compute_button.SetToolTipString(label) 1245 1245 if self.parent.parent != None: 1246 1246 wx.PostEvent(self.parent.parent, 1247 1247 StatusEvent(status = msg, type = type )) 1248 1248 … … 1316 1316 """ 1317 1317 if event != None: 1318 combo = event.GetEventObject()1318 #combo = event.GetEventObject() 1319 1319 event.Skip() 1320 1320 else: … … 1339 1339 except: 1340 1340 raise 1341 msg = "Failed to load the spectrum data file."1342 wx.MessageBox(msg, 'Warning')1343 raise ValueError, "Invalid spectrum file..."1344 1341 1345 1342 self.resolution.set_spectrum(self.spectrum_dic[selection]) … … 1349 1346 open a dialog file to select a customized spectrum 1350 1347 """ 1351 import os1352 1348 dlg = wx.FileDialog(self, 1353 1349 "Choose a wavelength spectrum file: Intensity vs. wavelength", 1354 self.parent.parent. _default_save_location, "",1350 self.parent.parent.get_save_location() , "", 1355 1351 "*.*", wx.OPEN) 1356 1352 path = None … … 1368 1364 """ 1369 1365 try: 1370 if path ==None:1366 if path == None: 1371 1367 wx.PostEvent(self.parent.parent, StatusEvent(status=\ 1372 1368 " Selected Distribution was not loaded: %s"%path)) … … 1394 1390 1395 1391 class ResolutionWindow(wx.Frame): 1392 """ 1393 Resolution Window 1394 """ 1396 1395 def __init__(self, parent = None, title = "SANS Resolution Estimator", 1397 1396 size=(PANEL_WIDTH * 2, PANEL_HEIGHT), *args, **kwds):
Note: See TracChangeset
for help on using the changeset viewer.