Changeset b0ab6cb in sasview for calculatorview/perspectives/calculator/slit_length_calculator_panel.py
- Timestamp:
- Oct 27, 2010 2:41:30 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:
- 6cda91f
- Parents:
- c4d6900
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/perspectives/calculator/slit_length_calculator_panel.py
r74b1770 rb0ab6cb 13 13 import os 14 14 15 from DataLoader.readers.ascii_reader import Reader15 #from DataLoader.readers.ascii_reader import Reader 16 16 from sans.guicomm.events import StatusEvent 17 17 from sans.calculator.slit_length_calculator import SlitlengthCalculator 18 from calculator_widgets import OutputTextCtrl, InterActiveOutputTextCtrl 18 from calculator_widgets import OutputTextCtrl 19 from calculator_widgets import InterActiveOutputTextCtrl 19 20 20 21 _BOX_WIDTH = 76 … … 40 41 CENTER_PANE = True 41 42 42 def __init__(self, parent, id=-1,*args, **kwds):43 wx.Panel.__init__(self, parent, id=id,*args, **kwds)43 def __init__(self, parent, *args, **kwds): 44 wx.Panel.__init__(self, parent, *args, **kwds) 44 45 #Font size 45 46 self.SetWindowVariant(variant=FONT_VARIANT) … … 70 71 """ 71 72 data_name_txt = wx.StaticText(self, -1, 'Data: ') 72 self.data_name_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH*4,-1)) 73 self.data_name_tcl = OutputTextCtrl(self, -1, 74 size=(_BOX_WIDTH*4, -1)) 73 75 data_hint = "Loaded data" 74 76 self.data_name_tcl.SetToolTipString(data_hint) … … 87 89 """ 88 90 slit_size_txt = wx.StaticText(self, -1, 'Slit Size (FWHM/2): ') 89 self.slit_size_tcl = InterActiveOutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 91 self.slit_size_tcl = InterActiveOutputTextCtrl(self, -1, 92 size=(_BOX_WIDTH, -1)) 90 93 slit_size_hint = " Estimated full slit size" 91 94 self.slit_size_tcl.SetToolTipString(slit_size_hint) 92 95 slit_size_unit_txt = wx.StaticText(self, -1, 'Unit: ') 93 self.slit_size_unit_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 96 self.slit_size_unit_tcl = OutputTextCtrl(self, -1, 97 size=(_BOX_WIDTH, -1)) 94 98 slit_size_unit_hint = "Full slit size's unit" 95 99 self.slit_size_unit_tcl.SetToolTipString(slit_size_unit_hint) … … 97 101 (self.slit_size_tcl, 0, wx.LEFT, 10), 98 102 (slit_size_unit_txt, 0, wx.LEFT, 10), 99 103 (self.slit_size_unit_tcl, 0, wx.LEFT, 10)]) 100 104 101 105 def _layout_hint(self): … … 145 149 wildcard = "SAXSess Data 1D (*.DAT, *.dat)|*.DAT" 146 150 147 dlg = wx.FileDialog(self, "Choose a file", location,"", wildcard, wx.OPEN) 151 dlg = wx.FileDialog(self, "Choose a file", location, 152 "", wildcard, wx.OPEN) 148 153 if dlg.ShowModal() == wx.ID_OK: 149 154 path = dlg.GetPath() … … 177 182 self.reader.stop() 178 183 if self.parent.parent is not None: 179 wx.PostEvent(self.parent.parent, StatusEvent(status="Loading...", 184 wx.PostEvent(self.parent.parent, 185 StatusEvent(status="Loading...", 180 186 type="progress")) 181 187 self.reader = DataReader(path=path, … … 186 192 if self.parent.parent is None: 187 193 return 188 msg = "Slit Length Calculator: %s"%(sys.exc_value) 189 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, type='stop')) 194 msg = "Slit Length Calculator: %s" % (sys.exc_value) 195 wx.PostEvent(self.parent.parent, 196 StatusEvent(status=msg, type='stop')) 190 197 return 191 198 … … 198 205 return 199 206 msg = "Slit Length cannot be computed for 2D Data" 200 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, type='stop')) 207 wx.PostEvent(self.parent.parent, 208 StatusEvent(status=msg, type='stop')) 201 209 return 202 210 self.data_name_tcl.SetValue(str(data.filename)) … … 206 214 y = data.y 207 215 if x == [] or x is None or y == [] or y is None: 208 209 216 msg = "The current data is empty please check x and y" 217 raise ValueError, msg 210 218 slit_length_calculator = SlitlengthCalculator() 211 219 slit_length_calculator.set_data(x=x, y=y) … … 214 222 if self.parent.parent is None: 215 223 return 216 msg = "Slit Size Calculator: %s"%(sys.exc_value) 217 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, type='stop')) 224 msg = "Slit Size Calculator: %s" % (sys.exc_value) 225 wx.PostEvent(self.parent.parent, 226 StatusEvent(status=msg, type='stop')) 218 227 return 219 228 self.slit_size_tcl.SetValue(str(slit_length)) … … 225 234 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, type='stop')) 226 235 236 227 237 class SlitLengthCalculatorWindow(wx.Frame): 228 def __init__(self, parent=None, id=1, title="Slit Size Calculator"): 229 wx.Frame.__init__(self, parent, id, title, size=(PANEL_WIDTH,PANEL_HEIGHT)) 238 """ 239 """ 240 def __init__(self, parent=None, title="Slit Size Calculator"): 241 """ 242 """ 243 wx.Frame.__init__(self, parent, title, 244 size=(PANEL_WIDTH,PANEL_HEIGHT)) 230 245 self.parent = parent 231 246 self.panel = SlitLengthCalculatorPanel(parent=self)
Note: See TracChangeset
for help on using the changeset viewer.