Changeset de0df2c in sasview for src/sas/sasgui/perspectives/file_converter
- Timestamp:
- Jul 14, 2016 11:59:05 AM (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:
- 2a7722b
- Parents:
- af84162
- git-author:
- Lewis O'Driscoll <lewis.o'driscoll@…> (07/14/16 11:38:21)
- git-committer:
- Lewis O'Driscoll <lewis.o'driscoll@…> (07/14/16 11:59:05)
- Location:
- src/sas/sasgui/perspectives/file_converter
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/file_converter/converter_panel.py
raf84162 rde0df2c 10 10 from sas.sasgui.perspectives.calculator import calculator_widgets as widget 11 11 from sas.sasgui.perspectives.file_converter.converter_widgets import VectorInput 12 from sas.sasgui.perspectives.file_converter.detector_panel import DetectorWindow 12 from sas.sasgui.perspectives.file_converter.meta_panels import MetadataWindow 13 from sas.sasgui.perspectives.file_converter.meta_panels import DetectorPanel 13 14 from sas.sasgui.guiframe.events import StatusEvent 14 15 from sas.sasgui.guiframe.dataFitting import Data1D … … 42 43 self.base = base 43 44 self.parent = parent 44 self. detector_frame = None45 self.meta_frames = [] 45 46 46 47 self.q_input = None … … 183 184 184 185 def show_detector_window(self, event): 185 if self.detector_frame is not None: 186 self.detector_frame.panel.on_close() 187 return 188 self.detector_frame = DetectorWindow(self.parent.manager.parent, 189 manager=self, detector=self.metadata['detector'][0]) 190 self.parent.manager.put_icon(self.detector_frame) 191 self.detector_frame.Show(True) 186 if self.meta_frames != []: 187 for frame in self.meta_frames: 188 frame.panel.on_close() 189 detector_frame = MetadataWindow(DetectorPanel, 190 parent=self.parent.manager.parent, manager=self, 191 metadata=self.metadata['detector'][0], title='Detector Metadata') 192 self.meta_frames.append(detector_frame) 193 self.parent.manager.put_icon(detector_frame) 194 detector_frame.Show(True) 192 195 193 196 def metadata_changed(self, event): -
src/sas/sasgui/perspectives/file_converter/meta_panels.py
raf84162 rde0df2c 20 20 FONT_VARIANT = 1 21 21 22 class DetectorPanel(ScrolledPanel, PanelBase):22 class MetadataPanel(ScrolledPanel, PanelBase): 23 23 24 def __init__(self, parent, detector, base=None, *args, **kwargs):24 def __init__(self, parent, metadata, base=None, *args, **kwargs): 25 25 ScrolledPanel.__init__(self, parent, *args, **kwargs) 26 26 PanelBase.__init__(self) … … 28 28 self.SetWindowVariant(variant=FONT_VARIANT) 29 29 30 if detector.name is None:31 detector.name = ''32 33 30 self.base = base 34 31 self.parent = parent 35 self.detector = detector36 32 self._to_validate = [] 37 33 self._vectors = [] 38 39 self._do_layout() 40 self.SetAutoLayout(True) 41 self.Layout() 34 self.metadata = metadata 42 35 43 36 def on_change(self, event): … … 45 38 value = ctrl.GetValue() 46 39 if value == '': value = None 47 setattr(self. detector, ctrl.GetName(), value)40 setattr(self.metadata, ctrl.GetName(), value) 48 41 49 42 def on_close(self, event=None): … … 65 58 StatusEvent(status=msg, info='error')) 66 59 return 67 setattr(self. detector, vector_in.GetName(), vector_in.GetValue())60 setattr(self.metadata, vector_in.GetName(), vector_in.GetValue()) 68 61 62 class DetectorPanel(MetadataPanel): 63 64 def __init__(self, parent, detector, base=None, *args, **kwargs): 65 MetadataPanel.__init__(self, parent, detector, base, *args, **kwargs) 66 67 if detector.name is None: 68 detector.name = '' 69 70 self._do_layout() 71 self.SetAutoLayout(True) 72 self.Layout() 73 74 def on_close(self, event=None): 75 MetadataPanel.on_close(self, event) 76 77 self.parent.manager.metadata['detector'] = [self.metadata] 69 78 self.parent.on_close(event) 70 79 … … 140 149 vbox.Add(section_sizer, flag=wx.ALL, border=10) 141 150 142 name_input.SetValue(self. detector.name)143 distance = self. detector.distance151 name_input.SetValue(self.metadata.name) 152 distance = self.metadata.distance 144 153 if distance is None: distance = '' 145 154 elif '.' not in distance: distance += '.0' 146 155 distance_input.SetValue(str(distance)) 147 offset_input.SetValue(self. detector.offset)148 orientation_input.SetValue(self. detector.orientation)149 pixel_input.SetValue(self. detector.pixel_size)150 beam_input.SetValue(self. detector.beam_center)151 slit_len = self. detector.slit_length156 offset_input.SetValue(self.metadata.offset) 157 orientation_input.SetValue(self.metadata.orientation) 158 pixel_input.SetValue(self.metadata.pixel_size) 159 beam_input.SetValue(self.metadata.beam_center) 160 slit_len = self.metadata.slit_length 152 161 if slit_len is None: slit_len = '' 153 162 elif '.' not in slit_len: slit_len += '.0' … … 157 166 self.SetSizer(vbox) 158 167 159 class DetectorWindow(widget.CHILD_FRAME):168 class MetadataWindow(widget.CHILD_FRAME): 160 169 161 def __init__(self, parent=None, title='Detector Metadata', base=None,162 manager=None, size=(PANEL_SIZE, PANEL_SIZE*0.8), detector=None,170 def __init__(self, PanelClass, parent=None, title='', base=None, 171 manager=None, size=(PANEL_SIZE, PANEL_SIZE*0.8), metadata=None, 163 172 *args, **kwargs): 164 173 kwargs['title'] = title … … 167 176 168 177 self.manager = manager 169 self.panel = DetectorPanel(self, detector, base=None)178 self.panel = PanelClass(self, metadata, base=None) 170 179 self.Bind(wx.EVT_CLOSE, self.on_close) 171 180 172 181 def on_close(self, event): 173 182 if self.manager is not None: 174 self.manager.detector_frame = None 175 self.manager.metadata['detector'] = [self.panel.detector] 183 self.manager.meta_frames.remove(self) 176 184 self.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.