Changeset 9cec2dd in sasview
- Timestamp:
- Oct 21, 2011 2:17:13 PM (13 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:
- 3ecaa2b
- Parents:
- 054f004
- Location:
- invariantview/src/sans/perspectives/invariant
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/src/sans/perspectives/invariant/invariant.py
r64b4f0f r9cec2dd 20 20 from sans.guiframe.dataFitting import Data1D 21 21 from sans.guiframe.events import NewPlotEvent 22 from sans.guiframe.events import StatusEvent 22 23 from sans.guiframe.gui_style import GUIFRAME_ID 23 24 from .invariant_state import Reader as reader … … 150 151 receive a list of data and compute invariant 151 152 """ 153 msg = "" 152 154 data = None 153 155 if data_list is None: … … 157 159 data = data_list[0] 158 160 else: 159 msg = "invariant panel does not allow multiple data!\n" 161 data_1d_list = [] 162 data_2d_list = [] 163 error_msg = "" 164 # separate data into data1d and data2d list 165 for data in data_list: 166 if data is not None: 167 if issubclass(data.__class__, Data1D): 168 data_1d_list.append(data) 169 else: 170 error_msg += " %s type %s \n" % (str(data.name), 171 str(data.__class__.__name__)) 172 data_2d_list.append(data) 173 if len(data_2d_list) > 0: 174 msg = "Invariant does not support the following data types:\n" 175 msg += error_msg 176 if len(data_1d_list) == 0: 177 wx.PostEvent(self.parent, 178 StatusEvent(status=msg, info='error')) 179 return 180 msg += "Invariant panel does not allow multiple data!\n" 160 181 msg += "Please select one.\n" 161 182 from invariant_widgets import DataDialog 162 dlg = DataDialog(data_list=data_ list, text=msg)183 dlg = DataDialog(data_list=data_1d_list, text=msg) 163 184 if dlg.ShowModal() == wx.ID_OK: 164 185 data = dlg.get_data() 165 186 if data is None: 187 msg += "invariant receives no data. \n" 188 wx.PostEvent(self.parent, 189 StatusEvent(status=msg, info='error')) 166 190 return 167 if issubclass(data.__class__, Data1D): 191 if not issubclass(data.__class__, Data1D): 192 msg += "invariant cannot be computed for data of " 193 msg += "type %s\n" % (data.__class__.__name__) 194 wx.PostEvent(self.parent, 195 StatusEvent(status=msg, info='error')) 196 return 197 else: 168 198 wx.PostEvent(self.parent, NewPlotEvent(plot=data, 169 199 title=data.title)) … … 171 201 self.compute_helper(data) 172 202 except: 173 msg = " PrviewSet_data: " + str(sys.exc_value)203 msg = "Invariant Set_data: " + str(sys.exc_value) 174 204 wx.PostEvent(self.parent, StatusEvent(status=msg, 175 205 info="error")) -
invariantview/src/sans/perspectives/invariant/invariant_details.py
rf6518f8 r9cec2dd 28 28 FONT_VARIANT = 1 29 29 30 ERROR_COLOR = wx.Colour(255, 0, 0, 128) 31 EXTRAPOLATION_COLOR = wx.Colour(169, 169, 168, 128) 32 INVARIANT_COLOR = wx.Colour(67, 208, 128, 128) 33 30 34 31 35 class InvariantContainer(wx.Object): … … 197 201 198 202 #Default color the extrapolation bar is grey 199 self.extrapolation_color_low = wx.Colour(169, 169, 168, 128)200 self.extrapolation_color_high = wx.Colour(169, 169, 168, 128)201 self.invariant_color = wx.Colour(67, 208, 128, 128)203 self.extrapolation_color_low = EXTRAPOLATION_COLOR 204 self.extrapolation_color_high = EXTRAPOLATION_COLOR 205 self.invariant_color = INVARIANT_COLOR 202 206 #change color of high and low bar when necessary 203 207 self.set_color_bar() … … 420 424 Change the color for low and high bar when necessary 421 425 """ 422 ERROR_COLOR = wx.Colour(255, 0, 0, 128) 426 self.extrapolation_color_low = EXTRAPOLATION_COLOR 427 self.extrapolation_color_high = EXTRAPOLATION_COLOR 428 self.invariant_color = INVARIANT_COLOR 423 429 #warning to the user when the extrapolated invariant is greater than %5 424 430 if self.low_scale >= 0.05 or self.low_scale > 1 or self.low_scale < 0: … … 426 432 if self.high_scale >= 0.05 or self.high_scale > 1 or self.high_scale < 0: 427 433 self.extrapolation_color_high = ERROR_COLOR 428 if self.inv_scale > = 0.05 or self.inv_scale >1 or self.inv_scale < 0:434 if self.inv_scale > 1 or self.inv_scale < 0: 429 435 self.invariant_color = ERROR_COLOR 430 436 431 437 def on_close(self, event): 432 438 """ -
invariantview/src/sans/perspectives/invariant/invariant_widgets.py
r7f14996 r9cec2dd 17 17 18 18 WIDTH = 400 19 HEIGHT = 200 19 HEIGHT = 350 20 21 class DialogPanel(ScrolledPanel): 22 def __init__(self, *args, **kwds): 23 ScrolledPanel.__init__(self, *args, **kwds) 24 self.SetupScrolling() 20 25 21 26 class InvTextCtrl(wx.TextCtrl): … … 96 101 """ 97 102 def __init__(self, data_list, parent=None, text='', *args, **kwds): 103 kwds['size'] = (WIDTH, HEIGHT) 104 kwds['title'] = "Data Selection" 98 105 wx.Dialog.__init__(self, parent, *args, **kwds) 99 self.SetTitle("Data Selection")100 self.SetSize((WIDTH, HEIGHT))101 106 self.list_of_ctrl = [] 102 107 if not data_list: … … 106 111 self._sizer_button = wx.BoxSizer(wx.HORIZONTAL) 107 112 self._choice_sizer = wx.GridBagSizer(5, 5) 108 self._panel = ScrolledPanel(self, style=wx.RAISED_BORDER,109 size=(WIDTH-20, HEIGHT -50))110 self. _panel.SetupScrolling()113 self._panel = DialogPanel(self, style=wx.RAISED_BORDER, 114 size=(WIDTH-20, HEIGHT/3)) 115 self.SetSizer(self._sizer_main) 111 116 self.__do_layout(data_list, text=text) 117 self.Layout() 112 118 113 119 def __do_layout(self, data_list, text=''): … … 121 127 text = "This Perspective does not allow multiple data !\n" 122 128 text += "Please select only one Data.\n" 123 text_ctrl = wx.StaticText(self, -1, str(text)) 124 self._sizer_txt.Add(text_ctrl) 129 text_ctrl = wx.TextCtrl(self, -1, str(text), style=wx.TE_MULTILINE, 130 size=(-1, HEIGHT/3)) 131 text_ctrl.SetEditable(False) 132 self._sizer_txt.Add(text_ctrl , 1, wx.EXPAND|wx.ALL, 10) 125 133 iy = 0 126 134 ix = 0 … … 151 159 static_line = wx.StaticLine(self, -1) 152 160 153 self._sizer_txt.Add(self._panel, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)154 self._sizer_main.Add(self._sizer_txt, 1, wx.EXPAND|wx.ALL, 10)161 self._sizer_txt.Add(self._panel, 0, wx.EXPAND|wx.ALL, 5) 162 self._sizer_main.Add(self._sizer_txt, 0, wx.EXPAND|wx.ALL, 5) 155 163 self._sizer_main.Add(static_line, 0, wx.EXPAND, 0) 156 164 self._sizer_main.Add(self._sizer_button, 0, wx.EXPAND|wx.ALL, 10) 157 self.SetSizer(self._sizer_main) 158 self.Layout() 165 159 166 160 167 def get_data(self):
Note: See TracChangeset
for help on using the changeset viewer.