moved page selection logic to class
This commit is contained in:
@@ -22,8 +22,7 @@ class DAQFrame(wx.Frame):
|
||||
notebook.AddPage(panel_static, "Static")
|
||||
notebook.AddPage(panel_scan, "Scan")
|
||||
|
||||
last_page = notebook.GetPageCount() - 1 # start on last page (Scan)
|
||||
notebook.SetSelection(last_page)
|
||||
panel_main.SetSelection(-1) # start on last page (Scan)
|
||||
|
||||
# make sure the window is large enough
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
@@ -26,6 +26,12 @@ class NotebookPanel(wx.Panel): #TODO: This needs work
|
||||
sizer.Add(notebook)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
def SetSelection(self, num):
|
||||
nb = self.notebook
|
||||
ntotal = nb.GetPageCount()
|
||||
num %= ntotal # allow counting from the back using negative numbers
|
||||
nb.SetSelection(num)
|
||||
|
||||
# def __getattr__(self, name):
|
||||
# return getattr(self.notebook, name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user