Ignore:
Timestamp:
Jul 19, 2016 11:08:42 AM (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:
bf23693
Parents:
a027549
Message:

Add source metadata

File:
1 edited

Legend:

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

    ra027549 r55bc56bc  
    1313from sas.sasgui.perspectives.file_converter.meta_panels import DetectorPanel 
    1414from sas.sasgui.perspectives.file_converter.meta_panels import SamplePanel 
     15from sas.sasgui.perspectives.file_converter.meta_panels import SourcePanel 
    1516from sas.sasgui.guiframe.events import StatusEvent 
    1617from sas.sasgui.guiframe.dataFitting import Data1D 
     
    2021from sas.sascalc.dataloader.data_info import Detector 
    2122from sas.sascalc.dataloader.data_info import Sample 
     23from sas.sascalc.dataloader.data_info import Source 
    2224from sas.sascalc.dataloader.data_info import Vector 
    2325 
     
    5961            'instrument': None, 
    6062            'detector': [Detector()], 
    61             'sample': Sample() 
     63            'sample': Sample(), 
     64            'source': Source() 
    6265        } 
    6366 
     
    186189        sample_frame.Show(True) 
    187190 
     191    def show_source_window(self, event): 
     192        if self.meta_frames != []: 
     193            for frame in self.meta_frames: 
     194                frame.panel.on_close() 
     195        source_frame = MetadataWindow(SourcePanel, 
     196            parent=self.parent.manager.parent, manager=self, 
     197            metadata=self.metadata['source'], title="Source Metadata") 
     198        self.meta_frames.append(source_frame) 
     199        self.parent.manager.put_icon(source_frame) 
     200        source_frame.Show(True) 
     201 
    188202    def on_collapsible_pane(self, event): 
    189203        self.Freeze() 
     
    289303 
    290304        y = 0 
     305        windows = ['detector', 'sample', 'source'] 
    291306        for item in self.metadata.keys(): 
    292             if item == 'detector' or item == 'sample': continue 
     307            if item in windows: continue 
    293308            label_txt = item.replace('_', ' ').capitalize() 
    294309            label = wx.StaticText(metadata_pane, -1, label_txt, 
     
    317332        y += 1 
    318333 
     334        source_label = wx.StaticText(metadata_pane, -1, "Source: ") 
     335        metadata_grid.Add(source_label, (y,0), (1,1), wx.ALL | wx.EXPAND, 5) 
     336        source_btn = wx.Button(metadata_pane, -1, "Enter Source Metadata") 
     337        source_btn.Bind(wx.EVT_BUTTON, self.show_source_window) 
     338        metadata_grid.Add(source_btn, (y,1), (1,1), wx.ALL | wx.EXPAND, 5) 
     339        y += 1 
     340 
    319341        metadata_pane.SetSizer(metadata_grid) 
    320342 
Note: See TracChangeset for help on using the changeset viewer.