def __init__(self, fname=None, db=None):
        wx.Frame.__init__(self, parent=None,
                          title=self.title, size=(650, 650))
        self.fname = fname
        self.db    = db
        menuBar = wx.MenuBar()
        fmenu = wx.Menu()
        add_menu(self, fmenu, "E&xit\tAlt-X", "Exit this Program",
                      action=self.onClose)

        menuBar.Append(fmenu, "&File")
        self.SetMenuBar(menuBar)
        self.CreateStatusBar(1, wx.CAPTION|wx.THICK_FRAME)

        splitter  = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)
        splitter.SetMinimumPaneSize(150)

        self.top_panel = wx.Panel(splitter) # top
        self.bot_panel = wx.Panel(splitter) # bottom
        self.filename  = wx.StaticText(self.bot_panel, -1, label='')
        self.fileview  = wx.TextCtrl(self.bot_panel, size=(175, 175),
                                     style=wx.TE_READONLY|wx.TE_MULTILINE|wx.HSCROLL)

        self.fileview.SetBackgroundColour(wx.Colour(250, 250, 250))

        bot_sizer = wx.BoxSizer(wx.VERTICAL)
        bot_sizer.Add(self.filename, 0, wx.ALIGN_TOP|wx.ALIGN_CENTER_VERTICAL, 5)
        bot_sizer.Add(self.fileview, 1, wx.ALIGN_TOP|wx.GROW|wx.ALL, 5)
        pack(self.bot_panel, bot_sizer)

        top_sizer = wx.BoxSizer(wx.VERTICAL)

        title_row   = wx.Panel(self.top_panel)
        title_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.top_label = Title(title_row, 'Data from File:', colour=(200,20,20))
        self.save_btn = add_btn(title_row, "Import Data",  action=self.onImport)

        title_sizer.Add(self.top_label, 1, wx.ALIGN_LEFT|wx.ALL, 3)
        title_sizer.Add(self.save_btn,  0, wx.ALIGN_RIGHT|wx.GROW|wx.ALL, 3)

        pack(title_row, title_sizer)

        self.nb = wx.Notebook(self.top_panel, size=(600, 275))

        self.buildDataPanel()
        self.buildBeamlinePanel()
        self.buildSamplePanel()

        top_sizer.Add(title_row, 0, wx.ALIGN_LEFT|wx.GROW|wx.ALL, 1)
        top_sizer.Add(self.nb,   1, wx.ALIGN_CENTER|wx.GROW|wx.ALL, 1)


        pack(self.top_panel, top_sizer)
        splitter.SplitHorizontally(self.top_panel, self.bot_panel, -1)

        framesizer = wx.BoxSizer(wx.VERTICAL)
        framesizer.Add(splitter, 1, wx.GROW|wx.ALL, 5)

        self.SetSizer(framesizer)

        if fname is not None:
            self.ShowFile(fname)
        self.Show()
        self.Raise()
예제 #2
0
    def __init__(self, fname=None, db=None):
        wx.Frame.__init__(self, parent=None, title=self.title, size=(650, 650))
        self.fname = fname
        self.db = db
        menuBar = wx.MenuBar()
        fmenu = wx.Menu()
        add_menu(self,
                 fmenu,
                 "E&xit\tAlt-X",
                 "Exit this Program",
                 action=self.onClose)

        menuBar.Append(fmenu, "&File")
        self.SetMenuBar(menuBar)
        self.CreateStatusBar(1, wx.CAPTION | wx.THICK_FRAME)

        splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)
        splitter.SetMinimumPaneSize(150)

        self.top_panel = wx.Panel(splitter)  # top
        self.bot_panel = wx.Panel(splitter)  # bottom
        self.filename = wx.StaticText(self.bot_panel, -1, label='')
        self.fileview = wx.TextCtrl(self.bot_panel,
                                    size=(175, 175),
                                    style=wx.TE_READONLY | wx.TE_MULTILINE
                                    | wx.HSCROLL)

        self.fileview.SetBackgroundColour(wx.Colour(250, 250, 250))

        bot_sizer = wx.BoxSizer(wx.VERTICAL)
        bot_sizer.Add(self.filename, 0,
                      wx.ALIGN_TOP | wx.ALIGN_CENTER_VERTICAL, 5)
        bot_sizer.Add(self.fileview, 1, wx.ALIGN_TOP | wx.GROW | wx.ALL, 5)
        pack(self.bot_panel, bot_sizer)

        top_sizer = wx.BoxSizer(wx.VERTICAL)

        title_row = wx.Panel(self.top_panel)
        title_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.top_label = Title(title_row,
                               'Data from File:',
                               colour=(200, 20, 20))
        self.save_btn = add_btn(title_row, "Import Data", action=self.onImport)

        title_sizer.Add(self.top_label, 1, wx.ALIGN_LEFT | wx.ALL, 3)
        title_sizer.Add(self.save_btn, 0, wx.ALIGN_RIGHT | wx.GROW | wx.ALL, 3)

        pack(title_row, title_sizer)

        self.nb = wx.Notebook(self.top_panel, size=(600, 275))

        self.buildDataPanel()
        self.buildBeamlinePanel()
        self.buildSamplePanel()

        top_sizer.Add(title_row, 0, wx.ALIGN_LEFT | wx.GROW | wx.ALL, 1)
        top_sizer.Add(self.nb, 1, wx.ALIGN_CENTER | wx.GROW | wx.ALL, 1)

        pack(self.top_panel, top_sizer)
        splitter.SplitHorizontally(self.top_panel, self.bot_panel, -1)

        framesizer = wx.BoxSizer(wx.VERTICAL)
        framesizer.Add(splitter, 1, wx.GROW | wx.ALL, 5)

        self.SetSizer(framesizer)

        if fname is not None:
            self.ShowFile(fname)
        self.Show()
        self.Raise()
예제 #3
0
    def create_frame(self):
        "create top level frame"
        # Create the menubar
        menuBar = wx.MenuBar()
        fmenu = wx.Menu()
        add_menu(self, fmenu, "Open Library",
                      "Open Existing XAS Data Library",
                      action = self.onReadXDLFile)

        add_menu(self, fmenu, "New Library",
                      "Create New XAS Data Library",
                      action=self.OpenNewXDLFile)

        fmenu.AppendSeparator()
        add_menu(self, fmenu, "Import Spectra",
                      "Read Spectra from ASCII File",
                      action=self.ImportSpectra)
        add_menu(self, fmenu, "Export Spectra",
                      "Write Spectra to ASCII (XDI) File",
                      action=self.ExportSpectra)
        fmenu.AppendSeparator()
        add_menu(self, fmenu, "E&xit\tAlt-X", "Exit this Program",
                      action=self.onClose)

        omenu = wx.Menu()
        add_menu(self, omenu, "Suites of Spectra",
                 "Manage Suites of Spectra",
                 action=self.onSuiteManager)
        add_menu(self, omenu, "Samples",
                 "Manage Samples",
                 action=self.onSampleManager)
        add_menu(self, omenu, "People",
                 "Manage People Adding to Library",
                 action=self.onPersonManager)
        add_menu(self, omenu, "Beamlines",
                 "Manage Beamline",
                 action=self.onBeamlineManager)

        # and put the menu on the menubar
        menuBar.Append(fmenu, "&File")
        menuBar.Append(omenu, "&Tables")
        self.SetMenuBar(menuBar)
        self.CreateStatusBar(1, wx.CAPTION|wx.THICK_FRAME)

        # Now create the Main Panel to put the other controls on.
        #  SelectFilter | CurrentFilter | SpectraList
        #  ------------------------------------------
        #    Spectra details
        #  ------------------------------------------
        topsection = wx.Panel(self)
        self.filterchoice = wx.Choice(topsection, size=(-1,-1),
                                     choices = self.filters)
        self.filterchoice.SetStringSelection(self.current_filter)
        self.filterchoice.Bind(wx.EVT_CHOICE, self.onFilterChoice)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(wx.StaticText(topsection,
                                label='Filter Spectra by:'),
                  0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.GROW|wx.ALL, 4)
        sizer.Add(self.filterchoice, 0, wx.ALIGN_LEFT|wx.GROW|wx.ALL, 0)

        pack(topsection, sizer)

        splitter1  = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)
        splitter1.SetMinimumPaneSize(200)

        self.top_panel = wx.Panel(splitter1)  # top
        self.bot_panel = SpectraPanel(splitter1)  # bottom

        splitter2 = wx.SplitterWindow(self.top_panel, style=wx.SP_LIVE_UPDATE)
        splitter2.SetMinimumPaneSize(200)

        # left hand side -- filter
        self.left_panel   = wx.Panel(splitter2)
        self.selection_list  = wx.ListBox(self.left_panel)
        self.selection_label = wx.StaticText(self.left_panel,
                                             label=self.current_filter)
        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer.Add(self.selection_label, 0, wx.ALIGN_LEFT|wx.ALL, 1)
        sizer.Add(self.selection_list, 1, wx.ALIGN_LEFT|wx.GROW|wx.ALL, 1)

        pack(self.left_panel, sizer)

        # right hand side -- filtered spectra
        self.right_panel   = wx.Panel(splitter2)
        self.spectra_list  = wx.ListBox(self.right_panel)
        self.spectra_label = wx.StaticText(self.right_panel,
                                             label='Spectra')
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.spectra_label, 0, wx.ALIGN_LEFT|wx.ALL, 1)
        sizer.Add(self.spectra_list, 1, wx.ALIGN_LEFT|wx.GROW|wx.ALL, 1)

        pack(self.right_panel, sizer)

        self.selection_list.SetBackgroundColour(wx.Colour(255, 250, 250))
        self.spectra_list.SetBackgroundColour(wx.Colour(250, 250, 240))

        self.selection_list.Clear()
        # for name in ('Fe Compounds, GSECARS', 'As standards'):
        # self.selection_list.Append(name)

        self.spectra_list.Clear()
        # 'FeCO3', 'Fe metal', 'maghemite'):
        for name in ('Fe metal', 'Fe2O3', 'FeO'):
            self.spectra_list.Append(name)

        self.selection_list.Bind(wx.EVT_LISTBOX, self.onSelectionSelect)
        self.spectra_list.Bind(wx.EVT_LISTBOX, self.onSpectraSelect)

        splitter2.SplitVertically(self.left_panel, self.right_panel, 0)

        sizer2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer2.Add(splitter2, 1, wx.GROW|wx.ALL, 5)
        pack(self.top_panel, sizer2)

        splitter1.SplitHorizontally(self.top_panel, self.bot_panel, 1)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(topsection, 0, wx.ALL|wx.GROW, 1)
        sizer.Add(splitter1, 1, wx.GROW|wx.ALL, 1)
        pack(self, sizer)