#coding:utf-8

import wx

from ui.CameraArea import CameraArea

'''
定义主窗体
'''

class MainWindow():
    def __init__(self):
        self.app = None
        self.frame = None

        self.main()

    def main(self):
        self.app = wx.App()
        self.frame = wx.Frame(None,-1, title='云镜模拟器',size = wx.Size(1100,700))
        self.createMainPanel()

    #####################################################
    #                   显示窗体
    #####################################################
    def show(self):
        self.frame.Show()
        # import wx.lib.inspection
        # wx.lib.inspection.InspectionTool().Show()
        self.app.MainLoop()

    #####################################################
    #                   创建主窗体的布局面板
    #####################################################
    def createMainPanel(self):
        mainPanel = wx.Panel(self.frame)
        boxSizer = wx.BoxSizer(wx.VERTICAL)

        nodeBook = wx.Notebook(mainPanel)
        cameraArea1 = CameraArea(nodeBook)
        page1 = cameraArea1.create()
        nodeBook.AddPage(page1,"摄像头1")

        cameraArea2 = CameraArea(nodeBook)
        cameraArea2.setChannel(2)
        page2 = cameraArea2.create()
        nodeBook.AddPage(page2, "摄像头2")

        cameraArea3 = CameraArea(nodeBook)
        cameraArea3.setChannel(3)
        page3 = cameraArea3.create()
        nodeBook.AddPage(page3, "摄像头3")
        page4 = wx.Panel(nodeBook)
        nodeBook.AddPage(page4, "转码工具")
        page5 = wx.Panel(nodeBook)
        nodeBook.AddPage(page5, "告警与其他功能")
        boxSizer.Add(nodeBook, 1, flag=wx.EXPAND | wx.ALL)

        mainPanel.SetSizer(boxSizer)


if __name__ == "__main__":
    MainWindow().show()