def buildFrame(self):
        # Now create the Panel to put the other controls on.
        splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)
        splitter.SetMinimumPaneSize(200)
        self.rowlist = wx.ListBox(splitter)
        self.rowlist.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.rowlist.Bind(wx.EVT_LISTBOX, self.onShow)
        self.rightpanel = wx.Panel(splitter)

        self.set_rowlist()

        rpanel = self.rightpanel
        rsizer = wx.BoxSizer(wx.VERTICAL)

        self.toplabel = wx.StaticText(rpanel, label='')
        rsizer.Add(self.toplabel, 0, wx.ALIGN_CENTRE | wx.ALL, 2)
        rowpanel = self.build_rowpanel(rpanel)
        rsizer.Add(rowpanel, 1, wx.ALIGN_CENTRE | wx.ALL, 2)

        btn_save = add_btn(rpanel, "Save Changes", action=self.onSave)
        btn_remove = add_btn(rpanel,
                             "Remove This %s" % self.tablename,
                             action=self.onRemove)

        brow = wx.BoxSizer(wx.HORIZONTAL)
        brow.Add(btn_save, 0, wx.ALIGN_LEFT | wx.ALL, 10)
        brow.Add(btn_remove, 0, wx.ALIGN_LEFT | wx.ALL, 10)

        rsizer.Add(brow, 0, wx.ALIGN_LEFT | wx.ALL, 4)
        pack(rpanel, rsizer)

        splitter.SplitVertically(self.rowlist, self.rightpanel, 1)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(splitter, 1, wx.GROW | wx.ALL, 5)
        pack(self, sizer)
        self.show_row()
        self.Show()
        self.Raise()
    def buildFrame(self):
        # Now create the Panel to put the other controls on.
        splitter  = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)
        splitter.SetMinimumPaneSize(200)
        self.rowlist  = wx.ListBox(splitter)
        self.rowlist.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.rowlist.Bind(wx.EVT_LISTBOX, self.onShow)
        self.rightpanel = wx.Panel(splitter)

        self.set_rowlist()

        rpanel = self.rightpanel
        rsizer =  wx.BoxSizer(wx.VERTICAL)

        self.toplabel = wx.StaticText(rpanel, label='')
        rsizer.Add(self.toplabel, 0, wx.ALIGN_CENTRE|wx.ALL, 2)
        rowpanel = self.build_rowpanel(rpanel)
        rsizer.Add(rowpanel, 1, wx.ALIGN_CENTRE|wx.ALL, 2)

        btn_save   = add_btn(rpanel, "Save Changes",  action=self.onSave)
        btn_remove = add_btn(rpanel, "Remove This %s" % self.tablename,
                             action=self.onRemove)

        brow = wx.BoxSizer(wx.HORIZONTAL)
        brow.Add(btn_save,   0, wx.ALIGN_LEFT|wx.ALL, 10)
        brow.Add(btn_remove, 0, wx.ALIGN_LEFT|wx.ALL, 10)

        rsizer.Add(brow,     0, wx.ALIGN_LEFT|wx.ALL, 4)
        pack(rpanel, rsizer)

        splitter.SplitVertically(self.rowlist, self.rightpanel, 1)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(splitter, 1, wx.GROW|wx.ALL, 5)
        pack(self, sizer)
        self.show_row()
        self.Show()
        self.Raise()
示例#3
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()
    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()