Changeset 2a7722b in sasview
- Timestamp:
- Jul 14, 2016 12:19:22 PM (8 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 1aad14e
- Parents:
- de0df2c
- Location:
- src/sas/sasgui/perspectives/file_converter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/file_converter/converter_panel.py
rde0df2c r2a7722b 12 12 from sas.sasgui.perspectives.file_converter.meta_panels import MetadataWindow 13 13 from sas.sasgui.perspectives.file_converter.meta_panels import DetectorPanel 14 from sas.sasgui.perspectives.file_converter.meta_panels import SamplePanel 14 15 from sas.sasgui.guiframe.events import StatusEvent 15 16 from sas.sasgui.guiframe.dataFitting import Data1D … … 17 18 from sas.sascalc.dataloader.readers.cansas_reader import Reader as CansasReader 18 19 from sas.sascalc.dataloader.data_info import Detector 20 from sas.sascalc.dataloader.data_info import Sample 19 21 from sas.sascalc.dataloader.data_info import Vector 20 22 … … 55 57 'run_name': None, 56 58 'instrument': None, 57 'detector': [Detector()] 59 'detector': [Detector()], 60 'sample': Sample() 58 61 } 59 62 self.vectors = ['offset', 'orientation', 'pixel_size', 'beam_center'] … … 194 197 detector_frame.Show(True) 195 198 199 def show_sample_window(self, event): 200 if self.meta_frames != []: 201 for frame in self.meta_frames: 202 frame.panel.on_close() 203 sample_frame = MetadataWindow(SamplePanel, 204 parent=self.parent.manager.parent, manager=self, 205 metadata=self.metadata['sample'], title='Sample Metadata') 206 self.meta_frames.append(sample_frame) 207 self.parent.manager.put_icon(sample_frame) 208 sample_frame.Show(True) 209 196 210 def metadata_changed(self, event): 197 211 event.Skip() … … 300 314 y += 1 301 315 316 sample_label = wx.StaticText(metadata_pane, -1, "Sample: ") 317 metadata_grid.Add(sample_label, (y,0), (1,1), wx.ALL | wx.EXPAND, 5) 318 sample_btn = wx.Button(metadata_pane, -1, "Enter Sample Metadata") 319 metadata_grid.Add(sample_btn, (y,1), (1,1), wx.ALL | wx.EXPAND, 5) 320 sample_btn.Bind(wx.EVT_BUTTON, self.show_sample_window) 321 y += 1 322 302 323 metadata_pane.SetSizer(metadata_grid) 303 324 -
src/sas/sasgui/perspectives/file_converter/meta_panels.py
rde0df2c r2a7722b 63 63 64 64 def __init__(self, parent, detector, base=None, *args, **kwargs): 65 MetadataPanel.__init__(self, parent, detector, base, *args, **kwargs)66 67 65 if detector.name is None: 68 66 detector.name = '' 67 68 MetadataPanel.__init__(self, parent, detector, base, *args, **kwargs) 69 69 70 70 self._do_layout() … … 166 166 self.SetSizer(vbox) 167 167 168 class SamplePanel(MetadataPanel): 169 170 def __init__(self, parent, sample, base=None, *args, **kwargs): 171 MetadataPanel.__init__(self, parent, sample, base, *args, **kwargs) 172 173 self._do_layout() 174 self.SetAutoLayout(True) 175 self.Layout() 176 177 def on_close(self, event=None): 178 MetadataPanel.on_close(self, event) 179 180 self.parent.manager.metadata['sample'] = self.metadata 181 self.parent.on_close(event) 182 183 def _do_layout(self): 184 vbox = wx.BoxSizer(wx.VERTICAL) 185 186 section = wx.StaticBox(self, -1, "Sample") 187 section_sizer = wx.StaticBoxSizer(section, wx.VERTICAL) 188 section_sizer.SetMinSize((_STATICBOX_WIDTH, -1)) 189 190 input_grid = wx.GridBagSizer(5, 5) 191 192 y = 0 193 name_label = wx.StaticText(self, -1, "Name: ") 194 input_grid.Add(name_label, (y,0), (1,1), wx.ALL, 5) 195 name_input = wx.TextCtrl(self, -1, name="name") 196 input_grid.Add(name_input, (y,1), (1,1)) 197 name_input.Bind(wx.EVT_TEXT, self.on_change) 198 y += 1 199 200 id_label = wx.StaticText(self, -1, "ID: ") 201 input_grid.Add(id_label, (y,0), (1,1), wx.ALL, 5) 202 id_input = wx.TextCtrl(self, -1, name="ID") 203 input_grid.Add(id_input, (y,1), (1,1)) 204 id_input.Bind(wx.EVT_TEXT, self.on_change) 205 y += 1 206 207 thickness_label = wx.StaticText(self, -1, "Thickness (mm): ") 208 input_grid.Add(thickness_label, (y,0), (1,1), wx.ALL, 5) 209 thickness_input = wx.TextCtrl(self, -1, name="thickness") 210 input_grid.Add(thickness_input, (y,1), (1,1)) 211 thickness_input.Bind(wx.EVT_TEXT, self.on_change) 212 self._to_validate.append(thickness_input) 213 y += 1 214 215 name_input.SetValue(self.metadata.name) 216 id_input.SetValue(self.metadata.ID) 217 thickness = self.metadata.thickness 218 if thickness is None: 219 thickness = '' 220 thickness_input.SetValue(str(thickness)) 221 222 done_btn = wx.Button(self, -1, "Done") 223 input_grid.Add(done_btn, (y,0), (1,1), wx.ALL, 5) 224 done_btn.Bind(wx.EVT_BUTTON, self.on_close) 225 226 section_sizer.Add(input_grid) 227 vbox.Add(section_sizer, flag=wx.ALL, border=10) 228 229 vbox.Fit(self) 230 self.SetSizer(vbox) 231 168 232 class MetadataWindow(widget.CHILD_FRAME): 169 233
Note: See TracChangeset
for help on using the changeset viewer.