Ignore:
Timestamp:
Jul 14, 2016 12:19:22 PM (8 years ago)
Author:
lewis
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
Message:

Start adding sample metadata window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/file_converter/meta_panels.py

    rde0df2c r2a7722b  
    6363 
    6464    def __init__(self, parent, detector, base=None, *args, **kwargs): 
    65         MetadataPanel.__init__(self, parent, detector, base, *args, **kwargs) 
    66  
    6765        if detector.name is None: 
    6866            detector.name = '' 
     67 
     68        MetadataPanel.__init__(self, parent, detector, base, *args, **kwargs) 
    6969 
    7070        self._do_layout() 
     
    166166        self.SetSizer(vbox) 
    167167 
     168class 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 
    168232class MetadataWindow(widget.CHILD_FRAME): 
    169233 
Note: See TracChangeset for help on using the changeset viewer.