Ejemplo n.º 1
0
    def test_lib_agw_customtreectrlSetWindow(self):
        tree = CT.CustomTreeCtrl(self.frame,
                                 agwStyle=CT.TR_DEFAULT_STYLE
                                 | CT.TR_HAS_VARIABLE_ROW_HEIGHT)
        root = tree.AddRoot('root item')
        c1 = tree.AppendItem(root, 'c1')
        c2 = tree.AppendItem(root, 'c2')

        window = wx.TextCtrl(tree, -1, 'Hello World')
        tree.SetItemWindow(c2, window)

        other = tree.GetItemWindow(c2)
        self.assertTrue(window == other)

        tree.DeleteAllItems()
        self.assertTrue(tree.GetCount() == 0)
        if sys.platform == 'darwin':
            # On Mac the scrollbars and the gripper between them on
            # ScrolledWindows are also wx widgets, so they are in the
            # children list.
            self.assertEqual(len(tree.GetChildren()), 3)
        else:
            self.assertEqual(len(tree.GetChildren()), 0)
Ejemplo n.º 2
0
    def __init__(self, parent, id, rootDir):
        wx.Panel.__init__(self, parent, id)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.ListDir = rootDir

        self.rootNote = os.path.split(self.ListDir)[-1]
        self.rootPathPrefix = os.path.split(self.ListDir)[:-1]
        #print self.rootPathPrefix
        self.custom_tree = custom_tree = CT.CustomTreeCtrl(
            self, id=GL.TreeID, size=(-1, -1), agwStyle=wx.TR_DEFAULT_STYLE)

        self.custom_tree.SetBackgroundColour("white")

        self.rootShow = self.rootNote + " (" + self.ListDir + ") "
        self.root = custom_tree.AddRoot(self.rootShow)
        sizer.Add(custom_tree, 1, flag=wx.EXPAND)
        #self.ListDir = ListDir
        il = wx.ImageList(16, 16)
        self.fldridx = fldridx = il.Add(
            wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16, 16)))
        self.fldropenidx = fldropenidx = il.Add(
            wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, (16, 16)))
        self.fileidx = il.Add(
            wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER,
                                     (16, 16)))
        custom_tree.SetImageList(il)
        custom_tree.SetItemImage(self.root, fldridx, wx.TreeItemIcon_Normal)
        custom_tree.SetItemImage(self.root, fldropenidx,
                                 wx.TreeItemIcon_Expanded)
        self.AllFileDiect = {}
        #appenDir(custom_tree,root,"d:\\all_source\\usport")

        #self.AppenDir(custom_tree,self.root,self.ListDir)
        self.AppenDirThread(custom_tree, self.root, self.ListDir)

        #custom_tree.Expand(self.root)
        self.SetSizerAndFit(sizer)
Ejemplo n.º 3
0
    def test_lib_agw_customtreectrlItemCheck(self):

        tree = CT.CustomTreeCtrl(self.frame)
        root = tree.AddRoot('root item')

        # Checkboxes, there can be more than one checked at the same level
        c1 = tree.AppendItem(root, 'c1', ct_type=1)
        c2 = tree.AppendItem(root, 'c2', ct_type=1)

        tree.CheckItem(c1)
        tree.CheckItem(c2)

        self.assertTrue(tree.IsItemChecked(c1))
        self.assertTrue(tree.IsItemChecked(c2))

        # RadioButtons, there can NOT be more than one checked at the same level
        c1 = tree.AppendItem(root, 'c1', ct_type=2)
        c2 = tree.AppendItem(root, 'c2', ct_type=2)

        tree.CheckItem(c1)
        tree.CheckItem(c2)

        self.assertTrue(not tree.IsItemChecked(c1))
        self.assertTrue(tree.IsItemChecked(c2))
Ejemplo n.º 4
0
 def __init__(self, parent):
     wx.Panel.__init__(self, parent)
     self.Title = "Plugins Browser"
     self.Size = wx.Size(200, 800)
     self.Sizer = wx.BoxSizer(wx.VERTICAL)
     #Game ID Field
     self.dirs = CT.CustomTreeCtrl(self)
     self.dirs.AddRoot('Plugins:')
     self.dirs.AssignImageList(self.Parent.il)
     self.root = self.dirs.GetRootItem()
     self.dirs.SetItemImage(self.root, self.Parent.il.fldridx,
                            CT.TreeItemIcon_Normal)
     self.dirs.SetItemImage(self.root, self.Parent.il.fldropenidx,
                            CT.TreeItemIcon_Expanded)
     self.dirs.Bind(CT.EVT_TREE_ITEM_CHECKED, self.OnItemCheck)
     self.Sizer.Add(self.dirs, 1, wx.EXPAND | wx.ALL, 0)
     #Bottom item
     self.autoreload = wx.CheckBox(self, -1, "Auto Reload template ?")
     self.autoreload.SetValue(True)
     self.Sizer.Add(self.autoreload, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
     self.reload = wx.Button(self, -1, "Reload plugins list")
     self.reload.Bind(wx.EVT_BUTTON, self.OnReload)
     self.Sizer.Add(self.reload, 0, wx.EXPAND | wx.ALL, 0)
     self.OnReload(None)
Ejemplo n.º 5
0
 def test_lib_agw_customtreectrlCtor(self):
     tree = CT.CustomTreeCtrl(self.frame)
     self.assertEqual(tree.GetAGWWindowStyleFlag(), CT.TR_DEFAULT_STYLE)
     self.assertEqual(tree.GetCount(), 0)
     self.assertEqual(tree.GetRootItem(), None)
Ejemplo n.º 6
0
    def __init__(self):
        global serverIp, serverPort
        serverPort = 6789
        serverIp = '127.0.0.1'

        # 初始化定义窗口属性(背景色,按钮,大小,位置)和线程

        # 设置主窗口,这里定义的是一个超类
        wx.Frame.__init__(self, parent=None, title='micro_Q', size=(600, 400))
        # 创建智能拉伸窗口
        panel = wx.Panel(self)
        panel.SetBackgroundColour((0, 153, 255))

        # 进行是否有选择的断言
        # 断言是否有选择文件框
        self.isChoosedFile = False
        self.dataOfChoosedFile = None
        self.fileName = None

        # 用户部分
        # 属性结构的全选或取消
        self.UserListTree = CT.CustomTreeCtrl(parent=panel,
                                              pos=(10, 10),
                                              size=(280, 300),
                                              style=wx.TR_FULL_ROW_HIGHLIGHT)
        # 创建根目录,添加的为根的名称
        self.rootID = self.UserListTree.AddRoot("已登录用户")
        # 设置背景色
        self.UserListTree.SetBackgroundColour((224, 255, 255))
        # 添加子节点
        self.UserListTree.AppendItem(self.rootID, '第一个子节点')
        self.UserListTree.AppendItem(self.rootID, '第二个子节点')
        # 展开所有节点
        self.UserListTree.ExpandAll()
        self.UserList = []
        # 构建说明按钮
        self.info = wx.Button(parent=panel,
                              pos=(100, 315),
                              size=(80, 40),
                              label="说明")
        # 设置背景色
        self.info.SetBackgroundColour((224, 255, 255))

        # 操作部分
        # 文本输入框
        # 创建文本控件对象,设置前景颜色即文本颜色
        inputTip = wx.TextCtrl(parent=panel,
                               pos=(300, 10),
                               size=(130, 20),
                               value="请输入你要发送的信息",
                               style=wx.TE_READONLY)
        # 设置背景颜色
        inputTip.SetBackgroundColour((224, 255, 255))
        # 设置分割线
        self.input = wx.TextCtrl(parent=panel, pos=(300, 30), size=(130, 50))
        self.input.SetForegroundColour((0, 153, 255))
        self.input.SetBackgroundColour((224, 255, 255))

        # 文件选择框
        self.fileChooser = wx.Button(parent=panel,
                                     pos=(440, 10),
                                     size=(130, 70),
                                     label="选择文件")
        self.fileChooser.SetBackgroundColour((224, 255, 255))

        # 发送按钮
        self.send = wx.Button(parent=panel,
                              pos=(300, 100),
                              size=(275, 50),
                              label="发送")
        self.send.SetBackgroundColour((224, 255, 255))
        # 中间分割线
        separation = wx.TextCtrl(parent=panel, pos=(290, 170), size=(300, 2))
        separation.SetBackgroundColour((224, 255, 255))
        # 接收消息框
        receivedTip = wx.TextCtrl(parent=panel,
                                  pos=(300, 190),
                                  size=(135, 20),
                                  value="发送/接收到的消息列表",
                                  style=wx.TE_READONLY)
        receivedTip.SetForegroundColour((0, 153, 255))
        receivedTip.SetBackgroundColour((224, 255, 255))
        # 设置文本框的滚动方式style
        self.messageList = wx.TextCtrl(parent=panel,
                                       size=(275, 120),
                                       pos=(300, 210),
                                       style=(wx.TE_MULTILINE | wx.HSCROLL
                                              | wx.TE_READONLY))
        self.messageList.SetBackgroundColour((224, 255, 255))
        self.messageList.SetForegroundColour((0, 153, 255))

        # 处理要发送的信息,进行初始值定义
        self.sendMessage = ''

        # 创建线程
        childThraed = Thread(target=self.socketHander)
        childThraed.setDaemon(True)
        childThraed.start()

        # 绑定按钮事件
        self.Bind(wx.EVT_BUTTON, self.OnInfoClicked, self.info)
        self.Bind(wx.EVT_BUTTON, self.OnSendClicked, self.send)
        self.Bind(wx.EVT_BUTTON, self.OnFileChooseClicked, self.fileChooser)
Ejemplo n.º 7
0
    def InitUI(self):
        """Build and place UI componants"""
        self.currentDirectory = os.getcwd()

        # Split Panels #
        splitter = wx.SplitterWindow(self, -1)
        splitter.SetMinimumPaneSize(30)
        splitter.SetSashGravity(0.2)

        # Left Panel
        panLeft = wx.Panel(splitter, -1)
        self.custom_tree = CT.CustomTreeCtrl(panLeft, -1)

        # Add Tree Items
        root = self.custom_tree.AddRoot("Filters", data="employmentLength")
        root.Expand()
        employment = self.custom_tree.AppendItem(root,
                                                 "Employment Length ",
                                                 ct_type=1,
                                                 data="employmentLength")
        self.custom_tree.AppendItem(employment,
                                    "1 Year ",
                                    ct_type=1,
                                    data="'1'")
        self.custom_tree.AppendItem(employment,
                                    "2 Year ",
                                    ct_type=1,
                                    data="'2'")
        self.custom_tree.AppendItem(employment,
                                    "3 Year ",
                                    ct_type=1,
                                    data="'3'")
        self.custom_tree.AppendItem(employment,
                                    "4 Year ",
                                    ct_type=1,
                                    data="'4'")
        self.custom_tree.AppendItem(employment,
                                    "5 Year ",
                                    ct_type=1,
                                    data="'5'")

        homeShip = self.custom_tree.AppendItem(root,
                                               "Home Ownership ",
                                               ct_type=1,
                                               data="homeOwnership")
        self.custom_tree.AppendItem(homeShip, "Own", ct_type=1, data="'OWN'")
        self.custom_tree.AppendItem(homeShip,
                                    "Mortgage",
                                    ct_type=1,
                                    data="'MORTGAGE'")
        self.custom_tree.AppendItem(homeShip, "Rent", ct_type=1, data="'RENT'")
        self.custom_tree.AppendItem(homeShip,
                                    "Other",
                                    ct_type=1,
                                    data="'OTHER'")

        loanLength = self.custom_tree.AppendItem(root,
                                                 "Loan Length",
                                                 ct_type=1,
                                                 data="loanLength")
        self.custom_tree.AppendItem(loanLength,
                                    "36 Months",
                                    ct_type=1,
                                    data="'36 months'")
        self.custom_tree.AppendItem(loanLength,
                                    "60 Months",
                                    ct_type=1,
                                    data="'60 months'")

        inquiries = self.custom_tree.AppendItem(root,
                                                "Inquiries in Six Months",
                                                ct_type=1,
                                                data="inquiriesSixMonths")
        self.custom_tree.AppendItem(inquiries, "1", ct_type=1, data="'1'")
        self.custom_tree.AppendItem(inquiries, "2", ct_type=1, data="'2'")
        self.custom_tree.AppendItem(inquiries, "3", ct_type=1, data="'3'")
        self.custom_tree.AppendItem(inquiries, "4", ct_type=1, data="'4'")
        self.custom_tree.AppendItem(inquiries, "5", ct_type=1, data="'5'")

        credit = self.custom_tree.AppendItem(root,
                                             "Credit Grade",
                                             ct_type=1,
                                             data="creditGrade")
        self.custom_tree.AppendItem(credit, "A", ct_type=1, data="'A'")
        self.custom_tree.AppendItem(credit, "B", ct_type=1, data="'B'")
        self.custom_tree.AppendItem(credit, "C", ct_type=1, data="'C'")
        self.custom_tree.AppendItem(credit, "D", ct_type=1, data="'D'")
        self.custom_tree.AppendItem(credit, "E", ct_type=1, data="'E'")
        self.custom_tree.AppendItem(credit, "F", ct_type=1, data="'F'")
        self.custom_tree.AppendItem(credit, "G", ct_type=1, data="'G'")

        fico = self.custom_tree.AppendItem(root,
                                           "FICO Range",
                                           ct_type=1,
                                           data="ficoRange")
        self.custom_tree.AppendItem(fico,
                                    "640-675",
                                    ct_type=1,
                                    data="'640-675'")
        self.custom_tree.AppendItem(fico,
                                    "676-700",
                                    ct_type=1,
                                    data="'676-700'")
        self.custom_tree.AppendItem(fico,
                                    "701-725",
                                    ct_type=1,
                                    data="'701-725'")
        self.custom_tree.AppendItem(fico,
                                    "726-750",
                                    ct_type=1,
                                    data="'726-750'")
        self.custom_tree.AppendItem(fico,
                                    "751-775",
                                    ct_type=1,
                                    data="'751-775'")
        self.custom_tree.AppendItem(fico,
                                    "776-800",
                                    ct_type=1,
                                    data="'776-800'")
        self.custom_tree.AppendItem(fico,
                                    "801-825",
                                    ct_type=1,
                                    data="'801-825'")
        self.custom_tree.AppendItem(fico,
                                    "826-850",
                                    ct_type=1,
                                    data="'826-850'")

        self.Bind(CT.EVT_TREE_ITEM_CHECKED, self.itemChecked)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.custom_tree, -1, wx.EXPAND)
        panLeft.SetSizerAndFit(sizer)
        sizer.Layout()

        self.loadPreferences()

        # Right Panels
        panRight = wx.Panel(splitter, -1)
        vbox = wx.BoxSizer(wx.VERTICAL)
        panTop = wx.Panel(panRight)
        panTop.SetBackgroundColour('#eeeeee')
        panBottom = wx.Panel(panRight)
        panBottom.SetBackgroundColour('#555555')
        vbox.Add(panTop, 1, wx.EXPAND | wx.ALL, 10)
        vbox.Add(panBottom, 1, wx.EXPAND | wx.ALL, 10)
        panRight.SetSizer(vbox)

        splitter.SplitVertically(panLeft, panRight)
        splitter.SetSashPosition(200)

        # Top Button Set
        self.btnGenerate = wx.Button(panTop, -1, "Generate")
        self.btnGenerate.Bind(wx.EVT_BUTTON, self.onGenerate)
        self.btnAbort = wx.Button(panTop, -1, "Abort")
        self.btnAbort.Bind(wx.EVT_BUTTON, self.onAbort)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(self.btnGenerate, 0, wx.ALL, 5)
        hsizer.Add(self.btnAbort, 0, wx.ALL, 5)
        panTop.SetSizer(hsizer)

        # File Menu #
        fileMenu = wx.Menu()
        quit_mi = wx.MenuItem(fileMenu, APP_EXIT, '&Quit\tCtrl+Q')
        open_csv_mi = wx.MenuItem(fileMenu, APP_OPEN_CSV, '&Open CSV')
        open_db_mi = wx.MenuItem(fileMenu, APP_OPEN_DB, '&Open DB')

        fileMenu.AppendItem(open_csv_mi)
        fileMenu.AppendItem(open_db_mi)
        fileMenu.AppendItem(quit_mi)

        self.Bind(wx.EVT_MENU, self.onQuit, quit_mi)
        self.Bind(wx.EVT_MENU, self.onOpenCSV, open_csv_mi)
        self.Bind(wx.EVT_MENU, self.onOpenDb, open_db_mi)

        # Menu Bar #
        menubar = wx.MenuBar()
        menubar.Append(fileMenu, '&File')
        self.SetMenuBar(menubar)

        # Status Bar #
        self.statusbar = self.CreateStatusBar()
        self.statusbar.SetStatusText('Ready')
        self.statusbar.Show()
Ejemplo n.º 8
0
    def __init__(self, parent, id, title, pos=wx.DefaultPosition):
        wx.Frame.__init__(self, parent, id, title, pos)

        self.info = Info(self)
        self.SetTitle(self.info.GetName())
        self.SetIcon(wx.Icon(LOGO_ICON, wx.BITMAP_TYPE_PNG))

        self.apiUrl = 'http://' + CONF['server']['host'] + ':' + str(
            CONF['server']['port'])

        self.interface = SqlmapInterface(self.apiUrl,
                                         CONF['server']['headers'])
        self.addOptions = None

        self.taskID = None

        self.saved = True
        self.scanThread = None
        self.options = dict()

        self.auiMgr = aui.AuiManager()
        self.auiMgr.SetManagedWindow(self)
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)

        #====================#
        # menus and menu bar #
        #====================#

        self.menuFile = wx.Menu()
        self.menuFile.Append(ID_MENU_SAVE, '&Save\tCtrl-S',
                             'Save scan results')
        self.menuFile.AppendSeparator()
        self.menuFile.Append(ID_MENU_EXIT, 'E&xit', 'Exit the Application')
        self.menuFile.Enable(ID_MENU_SAVE, False)

        self.menuScan = wx.Menu()
        self.menuScan.Append(ID_MENU_NEW_SCAN, '&New Scan\tCtrl-N',
                             'Start a new scan.')
        self.menuScan.AppendSeparator()
        self.menuScan.Append(ID_MENU_OPTIONS, '&Options\tCtrl-O',
                             'Set scan options')
        self.menuScan.Enable(ID_MENU_OPTIONS, False)

        menuHelp = wx.Menu()
        menuHelp.Append(ID_MENU_ABOUT, '&About...')

        self.Bind(wx.EVT_MENU, self.OnSave, id=ID_MENU_SAVE)
        self.Bind(wx.EVT_MENU, self.OnExit, id=ID_MENU_EXIT)
        self.Bind(wx.EVT_MENU, self.OnNewScan, id=ID_MENU_NEW_SCAN)
        self.Bind(wx.EVT_MENU, self.OnOptions, id=ID_MENU_OPTIONS)
        self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_MENU_ABOUT)

        menuBar = wx.MenuBar()
        menuBar.Append(self.menuFile, "&File")
        menuBar.Append(self.menuScan, "&Scan")
        menuBar.Append(menuHelp, "&Help")
        self.SetMenuBar(menuBar)

        #============================#
        # panel top : target, inputs #
        #============================#

        sizerPnlTop = wx.BoxSizer(wx.VERTICAL)
        pnlTop = wx.Panel(self, -1)

        self.sizerPnlTarget = wx.BoxSizer(wx.HORIZONTAL)
        pnlTarget = wx.Panel(pnlTop, -1)

        self.lTarget = wx.StaticText(pnlTarget, -1, label='target-url: ')
        self.tcTarget = wx.TextCtrl(pnlTarget, -1)
        self.tcTarget.Enable(False)
        self.tcTarget.Bind(wx.EVT_TEXT, self.set_tree_target)

        self.sizerPnlTarget.Add(self.lTarget, flag=wx.ALIGN_CENTRE_VERTICAL)
        self.sizerPnlTarget.Add(self.tcTarget, 1, wx.EXPAND)
        pnlTarget.SetSizerAndFit(self.sizerPnlTarget)

        # self.tcTarget.SetValue('http://www.beispiel.com/?id=1')

        #========================================================#
        # panel top: button panel: create buttons bind functions #
        #========================================================#

        sizerPnlButtons = wx.BoxSizer(wx.HORIZONTAL)
        pnlButtons = wx.Panel(pnlTop, -1)

        self.btnPanel = bp.ButtonPanel(pnlButtons,
                                       -1,
                                       agwStyle=bp.BP_DEFAULT_STYLE)
        self.btnPanel.GetBPArt().SetMetric(bp.BP_PADDING_SIZE, wx.Size(4, 4))
        self.btnPanel.GetBPArt().SetMetric(bp.BP_MARGINS_SIZE, wx.Size(4, 4))
        self.btnPanel.GetBPArt().GetFont(bp.BP_BUTTONTEXT_FONT)\
                                .SetPointSize(8)

        self.btnStop = bp.ButtonInfo(self.btnPanel,
                                     -1,
                                     self.get_icon('stop'),
                                     text='Stop',
                                     shortHelp='Stop the current scan')
        self.btnStop.Enable(False)

        self.btnStart = bp.ButtonInfo(self.btnPanel,
                                      -1,
                                      self.get_icon('target'),
                                      text='Start',
                                      shortHelp='Start the customized scan')

        self.btnSetOptions = bp.ButtonInfo(self.btnPanel,
                                           -1,
                                           self.get_icon('options'),
                                           text='Options',
                                           shortHelp='Set scan options')

        self.btnGetDBs = bp.ButtonInfo(self.btnPanel,
                                       -1,
                                       self.get_icon('db'),
                                       text='Get DBs',
                                       shortHelp='Enumerate DBMS databases')

        self.btnGetTbls = bp.ButtonInfo(
            self.btnPanel,
            -1,
            self.get_icon('tbl'),
            text='Get Tables',
            shortHelp='Enumerate DBMS database tables')

        self.btnGetCols = bp.ButtonInfo(
            self.btnPanel,
            -1,
            self.get_icon('col'),
            text='Get Columns',
            shortHelp='Enumerate DBMS database table columns')

        self.btnGetData = bp.ButtonInfo(
            self.btnPanel,
            -1,
            self.get_icon('tblDump'),
            text='Get Data',
            shortHelp='Dump DBMS database table entries')

        self.btnOutput = bp.ButtonInfo(self.btnPanel,
                                       -1,
                                       self.get_icon('view'),
                                       text='View Output',
                                       shortHelp='View data output')

        self.btnSave = bp.ButtonInfo(self.btnPanel,
                                     -1,
                                     self.get_icon('save'),
                                     text=' Save ',
                                     shortHelp='save scan results')
        self.btnCloseAll = bp.ButtonInfo(self.btnPanel,
                                         -1,
                                         self.get_icon('closeTab'),
                                         text='Close Tabs',
                                         shortHelp='Close all tabs')
        self.btnCloseAll.Enable(False)

        self.Bind(wx.EVT_BUTTON, self.stop_scan, self.btnStop)
        self.Bind(wx.EVT_BUTTON, self.run_custom, self.btnStart)
        self.Bind(wx.EVT_BUTTON, self.OnOptions, self.btnSetOptions)
        self.Bind(wx.EVT_BUTTON, self.run_get_dbs, self.btnGetDBs)
        self.Bind(wx.EVT_BUTTON, self.run_get_tables, self.btnGetTbls)
        self.Bind(wx.EVT_BUTTON, self.run_get_columns, self.btnGetCols)
        self.Bind(wx.EVT_BUTTON, self.run_get_data, self.btnGetData)
        self.Bind(wx.EVT_BUTTON, self.OnShowOutput, self.btnOutput)
        self.Bind(wx.EVT_BUTTON, self.OnSave, self.btnSave)
        self.Bind(wx.EVT_BUTTON, self.OnDeletePages, self.btnCloseAll)

        self.btnPanel.AddButton(self.btnStop)
        self.btnPanel.AddSeparator()
        self.btnPanel.AddButton(self.btnStart)
        self.btnPanel.AddSeparator()
        self.btnPanel.AddButton(self.btnSetOptions)
        self.btnPanel.AddSeparator()
        self.btnPanel.AddButton(self.btnGetDBs)
        self.btnPanel.AddButton(self.btnGetTbls)
        self.btnPanel.AddButton(self.btnGetCols)
        self.btnPanel.AddButton(self.btnGetData)
        self.btnPanel.AddSeparator()
        self.btnPanel.AddButton(self.btnOutput)
        self.btnPanel.AddSeparator()
        self.btnPanel.AddButton(self.btnSave)
        self.btnPanel.AddSeparator()
        self.btnPanel.AddButton(self.btnCloseAll)
        self.btnPanel.DoLayout()

        self.scanBtns = [
            self.btnStart, self.btnGetDBs, self.btnGetTbls, self.btnGetCols,
            self.btnGetData, self.btnOutput, self.btnSave, self.btnSetOptions
        ]

        sizerPnlButtons.Add(self.btnPanel, 1, wx.EXPAND)
        pnlButtons.SetSizerAndFit(sizerPnlButtons)

        self.enable_scan_inputs(False)

        sizerPnlTop.Add(pnlTarget, 0, wx.EXPAND | wx.LEFT | wx.TOP, 2)
        sizerPnlTop.Add(pnlButtons, 0, wx.EXPAND)
        pnlTop.SetSizerAndFit(sizerPnlTop)

        #==============================================#
        # panel center: aui notebook, grid data output #
        #==============================================#

        sizerPnlCenter = wx.BoxSizer(wx.VERTICAL)
        self.pnlCenter = wx.Panel(self, -1)

        self.nb = aui.AuiNotebook(
            self.pnlCenter,
            -1,
            style=aui.AUI_NB_CLOSE_ON_ALL_TABS | aui.AUI_NB_WINDOWLIST_BUTTON
            | aui.AUI_NB_TAB_SPLIT | aui.AUI_NB_TAB_MOVE
            | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_SCROLL_BUTTONS)

        self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.OnPageClosed, self.nb)

        sizerPnlCenter.Add(self.nb, 1, wx.EXPAND)
        self.pnlCenter.SetSizerAndFit(sizerPnlCenter)

        #==========================#
        # panel left: tree control #
        #==========================#

        self.sizerPnlTree = wx.BoxSizer(wx.HORIZONTAL)
        pnlTree = wx.Panel(self, -1)

        self.tree = ct.CustomTreeCtrl(
            pnlTree,
            -1,
            agwStyle=ct.TR_HAS_BUTTONS | ct.TR_AUTO_CHECK_PARENT
            | ct.TR_AUTO_CHECK_CHILD | ct.TR_HAS_VARIABLE_ROW_HEIGHT)
        self.Bind(ct.EVT_TREE_ITEM_CHECKED, self.OnCheckTree, self.tree)
        self.sizerPnlTree.Add(self.tree, 1, wx.EXPAND)

        # creating image list and assigning list to tree
        # (target, db, table and column icon)
        il = wx.ImageList(16, 16)

        for k in TREE_ICONS.keys():
            TREE_ICONS[k] = il.Add(TREE_ICONS[k].Scale(16,
                                                       16).ConvertToBitmap())

        self.tree.AssignImageList(il)

        self.treeRoot = self.tree.AddRoot('', image=TREE_ICONS['target'])
        self.treeDBs = None
        self.treeTbls = None
        self.treeData = dict()
        self.set_tree_target(None)
        self.tree.Layout()
        pnlTree.SetSizerAndFit(self.sizerPnlTree)

        #========================#
        # pane bottom: scan logs #
        #========================#

        self.tcLog = wx.TextCtrl(self,
                                 -1,
                                 style=wx.TE_MULTILINE | wx.TE_READONLY)

        #=================================================#
        # adding panels and components to the aui manager #
        #=================================================#

        self.auiMgr.AddPane(
            pnlTop,
            aui.AuiPaneInfo().Name('inputs').Top().DockFixed().CaptionVisible(
                False).PaneBorder(False).CloseButton(False))

        self.auiMgr.AddPane(
            pnlTree,
            aui.AuiPaneInfo().Name('tree').Caption(
                'Target Schema').Left().BestSize(wx.Size(160, 500)).PaneBorder(
                    False).MaximizeButton(True).CloseButton(False))

        self.auiMgr.AddPane(
            self.pnlCenter,
            aui.AuiPaneInfo().Name('center').Caption('Table Dumps').Center().
            PaneBorder(False).MaximizeButton(True).CloseButton(False))

        self.auiMgr.AddPane(
            self.tcLog,
            aui.AuiPaneInfo().Name('log').Caption(
                'Scan Log').Bottom().BestSize(wx.Size(600, 140)).PaneBorder(
                    False).MaximizeButton(True).CloseButton(False))

        self.CreateStatusBar()
        self.SetStatusText(self.info.GetName())
 def __init__(self, parent, window, controller, debug):
     wx.Panel.__init__(self, name='PouInstanceTreePanel', 
             parent=parent, pos=wx.Point(0, 0), 
             size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
     
     self.ParentButton = wx.lib.buttons.GenBitmapButton(self,
           bitmap=GetBitmap("top"), size=wx.Size(28, 28), style=wx.NO_BORDER)
     self.ParentButton.SetToolTipString(_("Parent instance"))
     self.Bind(wx.EVT_BUTTON, self.OnParentButtonClick, 
             self.ParentButton)
     
     self.InstanceChoice = wx.ComboBox(self, style=wx.CB_READONLY)
     self.Bind(wx.EVT_COMBOBOX, self.OnInstanceChoiceChanged,
             self.InstanceChoice)
     self.InstanceChoice.Bind(wx.EVT_LEFT_DOWN, self.OnInstanceChoiceLeftDown)
     
     self.DebugButton = wx.lib.buttons.GenBitmapButton(self, 
           bitmap=GetBitmap("debug_instance"), size=wx.Size(28, 28), style=wx.NO_BORDER)
     self.ParentButton.SetToolTipString(_("Debug instance"))
     self.Bind(wx.EVT_BUTTON, self.OnDebugButtonClick, 
             self.DebugButton)
     
     self.VariablesList = CT.CustomTreeCtrl(self,
           style=wx.SUNKEN_BORDER,
           agwStyle=CT.TR_NO_BUTTONS|
                    CT.TR_SINGLE|
                    CT.TR_HAS_VARIABLE_ROW_HEIGHT|
                    CT.TR_HIDE_ROOT|
                    CT.TR_NO_LINES|
                    getattr(CT, "TR_ALIGN_WINDOWS_RIGHT", CT.TR_ALIGN_WINDOWS))
     self.VariablesList.SetIndent(0)
     self.VariablesList.SetSpacing(5)
     self.VariablesList.DoSelectItem = lambda *x,**y:True
     self.VariablesList.Bind(CT.EVT_TREE_ITEM_ACTIVATED,
             self.OnVariablesListItemActivated)
     self.VariablesList.Bind(wx.EVT_LEFT_DOWN, self.OnVariablesListLeftDown)
     
     buttons_sizer = wx.FlexGridSizer(cols=3, hgap=0, rows=1, vgap=0)
     buttons_sizer.AddWindow(self.ParentButton)
     buttons_sizer.AddWindow(self.InstanceChoice, flag=wx.GROW)
     buttons_sizer.AddWindow(self.DebugButton)
     buttons_sizer.AddGrowableCol(1)
     buttons_sizer.AddGrowableRow(0)
     
     main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
     main_sizer.AddSizer(buttons_sizer, flag=wx.GROW)
     main_sizer.AddWindow(self.VariablesList, flag=wx.GROW)
     main_sizer.AddGrowableCol(0)
     main_sizer.AddGrowableRow(1)
     
     self.SetSizer(main_sizer)
     
     self.ParentWindow = window
     self.Controller = controller
     self.Debug = debug
     if not self.Debug:
         self.DebugButton.Hide()
     
     self.PouTagName = None
     self.PouInfos = None
     self.PouInstance = None
Ejemplo n.º 10
0
    def __init__(self, parent, dlg_id, title, folderPath):
        wx.Dialog.__init__(self, parent, dlg_id, title)
        self._is_importing = False
        self._stop_importing = False
        projectService = wx.GetApp().GetService(ProjectEditor.ProjectService)
        self.project_view = projectService.GetView()
        project_path = os.path.dirname(
            self.project_view.GetDocument().GetFilename())
        #project path name is the relative dest path
        self.dest_path = os.path.basename(project_path)
        if folderPath != "":
            self.dest_path = os.path.join(self.dest_path, folderPath)
        if sysutilslib.isWindows():
            self.dest_path = self.dest_path.replace("/", os.sep)
        boxsizer = wx.BoxSizer(wx.VERTICAL)
        flagSizer = wx.BoxSizer(wx.HORIZONTAL)
        st_text = wx.StaticText(self, label=_("Local File System"))
        st_text.SetFont(wx.Font(16, wx.SWISS, wx.NORMAL, wx.BOLD))
        flagSizer.Add(st_text, 1, flag=wx.LEFT | wx.EXPAND, border=SPACE)

        icon = wx.StaticBitmap(self,bitmap = wx.Bitmap(os.path.join(sysutilslib.mainModuleDir, \
                            "noval", "tool", "bmp_source", "python_logo.png")))
        flagSizer.Add(icon, 0, flag=wx.TOP | wx.RIGHT, border=HALF_SPACE)
        boxsizer.Add(flagSizer, 0, flag=wx.EXPAND | wx.ALL, border=HALF_SPACE)

        lineSizer = wx.BoxSizer(wx.HORIZONTAL)
        line = wx.StaticLine(self)
        lineSizer.Add(line, 1, flag=wx.LEFT | wx.EXPAND, border=0)
        boxsizer.Add(lineSizer, 0, flag=wx.EXPAND | wx.BOTTOM, border=SPACE)

        lineSizer = wx.BoxSizer(wx.HORIZONTAL)
        dirLabelText = wx.StaticText(self, -1, _('Source Location:'))
        lineSizer.Add(dirLabelText, 0, flag=wx.LEFT, border=SPACE)
        self.dirControl = wx.TextCtrl(self, -1)
        self.Bind(wx.EVT_TEXT, self.ChangeDir)
        lineSizer.Add(self.dirControl,
                      1,
                      flag=wx.LEFT | wx.EXPAND,
                      border=SPACE)
        self.browser_btn = wx.Button(self, -1, _("Browse..."))
        wx.EVT_BUTTON(self.browser_btn, -1, self.BrowsePath)
        lineSizer.Add(self.browser_btn, 0, flag=wx.LEFT, border=SPACE)
        boxsizer.Add(lineSizer, 0, flag=wx.EXPAND | wx.RIGHT, border=SPACE)

        templates = wx.GetApp().GetDocumentManager().GetTemplates()
        iconList = wx.ImageList(16, 16, initialCount=len(templates))

        folder_bmp_path = os.path.join(sysutilslib.mainModuleDir, "noval",
                                       "tool", "bmp_source",
                                       "packagefolder_obj.gif")
        folder_bmp = wx.Bitmap(folder_bmp_path, wx.BITMAP_TYPE_GIF)
        self.FolderIdx = iconList.Add(folder_bmp)

        listSizer = wx.BoxSizer(wx.HORIZONTAL)
        self._treeCtrl = CT.CustomTreeCtrl(self,
                                           size=(300, 250),
                                           style=wx.BORDER_THEME,
                                           agwStyle=wx.TR_DEFAULT_STYLE
                                           | CT.TR_AUTO_CHECK_CHILD
                                           | CT.TR_AUTO_CHECK_PARENT)
        self._treeCtrl.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_LISTBOX))
        self.Bind(CT.EVT_TREE_ITEM_CHECKED, self.checked_item)
        wx.EVT_LEFT_DOWN(self._treeCtrl, self.OnLeftClick)
        listSizer.Add(self._treeCtrl, flag=wx.LEFT | wx.RIGHT, border=SPACE)
        self._treeCtrl.AssignImageList(iconList)

        self.listbox = wx.CheckListBox(self, -1, size=(300, 250), choices=[])
        self.Bind(wx.EVT_CHECKLISTBOX, self.CheckBoxFile)
        listSizer.Add(self.listbox, 1, flag=wx.TOP | wx.EXPAND, border=0)
        boxsizer.Add(listSizer,
                     0,
                     flag=wx.EXPAND | wx.BOTTOM | wx.TOP | wx.RIGHT,
                     border=SPACE)

        lineSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.file_filter_btn = wx.Button(self, -1, _("File Filters"))
        wx.EVT_BUTTON(self.file_filter_btn, -1, self.ShowFilterFileDialog)
        lineSizer.Add(self.file_filter_btn, 0, flag=wx.LEFT, border=SPACE)
        self.filters = []

        self.select_all_btn = wx.Button(self, -1, _("Select All"))
        wx.EVT_BUTTON(self.select_all_btn, -1, self.SelectAll)
        lineSizer.Add(self.select_all_btn, 0, flag=wx.LEFT, border=SPACE)

        self.unselect_all_btn = wx.Button(self, -1, _("UnSelect All"))
        wx.EVT_BUTTON(self.unselect_all_btn, -1, self.UnSelectAll)
        lineSizer.Add(self.unselect_all_btn, 0, flag=wx.LEFT, border=SPACE)
        boxsizer.Add(lineSizer, 0, flag=wx.EXPAND | wx.RIGHT, border=SPACE)

        lineSizer = wx.BoxSizer(wx.HORIZONTAL)
        destdirLabelText = wx.StaticText(self, -1, _('Dest Directory:'))
        lineSizer.Add(destdirLabelText, 0, flag=wx.LEFT, border=0)
        self.destDirCtrl = wx.TextCtrl(self,
                                       -1,
                                       self.dest_path,
                                       size=(200, -1))
        self.destDirCtrl.Enable(False)
        lineSizer.Add(self.destDirCtrl, 0, flag=wx.LEFT, border=SPACE)
        boxsizer.Add(lineSizer, 0, flag=wx.ALL, border=SPACE)

        sbox = wx.StaticBox(self, -1, _("Option"))
        sboxSizer = wx.StaticBoxSizer(sbox, wx.VERTICAL)

        self.overwrite_chkbox = wx.CheckBox(
            self, label=_("Overwrite existing files without warning"))
        sboxSizer.Add(self.overwrite_chkbox,
                      flag=wx.LEFT | wx.TOP,
                      border=HALF_SPACE)
        self.root_folder_chkbox = wx.CheckBox(
            self, label=_("Create top-level folder"))
        sboxSizer.Add(self.root_folder_chkbox,
                      flag=wx.LEFT | wx.TOP,
                      border=HALF_SPACE)
        boxsizer.Add(sboxSizer,
                     flag=wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT,
                     border=SPACE)

        lineSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.m_gauge = wx.Gauge(self, wx.ID_ANY, 100, wx.DefaultPosition,
                                wx.DefaultSize, wx.GA_HORIZONTAL)
        lineSizer.Add(self.m_gauge, 1, flag=wx.LEFT | wx.EXPAND, border=0)
        boxsizer.Add(lineSizer, 0, flag=wx.BOTTOM | wx.EXPAND, border=SPACE)
        Publisher.subscribe(self.UpdateImportProgress,
                            NOVAL_MSG_UI_IMPORT_FILES_PROGRESS)

        bsizer = wx.StdDialogButtonSizer()
        self.ok_btn = wx.Button(self, wx.ID_OK, _("&Import"))
        wx.EVT_BUTTON(self.ok_btn, -1, self.OnOKClick)
        #set ok button default focused
        self.ok_btn.SetDefault()
        bsizer.AddButton(self.ok_btn)

        cancel_btn = wx.Button(self, wx.ID_CANCEL, _("&Cancel"))
        wx.EVT_BUTTON(cancel_btn, -1, self.OnCancelClick)
        bsizer.AddButton(cancel_btn)
        bsizer.Realize()
        boxsizer.Add(bsizer, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM,
                     HALF_SPACE)

        self.SetSizer(boxsizer)
        self.m_gauge.Hide()
        self.Fit()
Ejemplo n.º 11
0
    def init_ui(self):
        panel = wx.Panel(self)

        box_all = wx.BoxSizer(wx.HORIZONTAL)

        self.panel1 = wx.Panel(panel, -1, style=wx.SUNKEN_BORDER)
        self.panel1.SetBackgroundColour("Black")
        # panel2 = wx.Panel(panel, -1, style=wx.SUNKEN_BORDER)
        # panel2.SetBackgroundColour("red")
        # panel3 = wx.Panel(panel, -1, style=wx.SUNKEN_BORDER)
        # panel3.SetBackgroundColour("yellow")
        # panel4 = wx.Panel(panel, -1, style=wx.SUNKEN_BORDER)
        # panel4.SetBackgroundColour("grey")

        photo_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.photo = wx.StaticBitmap(self.panel1, wx.ID_ANY)
        self.photo.SetBackgroundColour("Grey")
        photo_sizer.Add(self.photo, 1, wx.EXPAND)
        self.panel1.SetSizer(photo_sizer)
        self.panel1.SetAutoLayout(True)

        left_box = wx.BoxSizer(wx.VERTICAL)
        left_box.Add(wx.StaticText(panel, label='Drag folder here'))

        # left_box.Add(panel2, 1, wx.EXPAND)
        self.list_box_root = wx.ListBox(panel, -1, style=wx.LB_SINGLE)
        self.Bind(wx.EVT_LISTBOX, self.OnListBoxRootSelect, self.list_box_root)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnListBoxRootDouble,
                  self.list_box_root)

        drop = AppDropTarget(self)
        drop.SetApp(self)
        panel.SetDropTarget(drop)

        left_box.Add(self.list_box_root, 1, wx.EXPAND)

        left_box.Add(wx.StaticText(panel, label='file tree from folder'))

        # self.file_tree = wx.GenericDirCtrl(panel, -1, style=wx.DIRCTRL_DIR_ONLY)

        self.file_tree = customtree.CustomTreeCtrl(panel,
                                                   -1,
                                                   agwStyle=wx.TR_DEFAULT_STYLE
                                                   | wx.TR_NO_BUTTONS)
        self.file_tree.SetBackgroundColour("White")
        # self.file_tree.SetBorderPen(wx.Pen("Black", 10))

        self.Bind(customtree.EVT_TREE_SEL_CHANGED, self.OnTreeFolderItemSelect,
                  self.file_tree)
        self.Bind(customtree.EVT_TREE_ITEM_ACTIVATED,
                  self.OnTreeFolderItemActived, self.file_tree)

        # self.file_tree = wx.GenericDirCtrl(panel, dir = wx.EmptyString, style=wx.DIRCTRL_3D_INTERNAL | wx.SUNKEN_BORDER)

        # file_tree = self.file_tree.GetTreeCtrl()
        # file_tree.AppendItem(file_tree.GetRootItem(), "/Users/lirui")

        left_box.Add(self.file_tree, 3, wx.EXPAND)

        left_box.Add(wx.StaticText(panel, label='photo files'))

        self.list_box_files = wx.ListBox(panel, -1, style=wx.LB_SINGLE)
        self.Bind(wx.EVT_LISTBOX, self.OnListBoxFilesSelect,
                  self.list_box_files)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnListBoxFilesDouble,
                  self.list_box_files)

        self.list_box_files.Bind(wx.EVT_KEY_UP, self.OnListBoxFilesKey)

        left_box.Add(self.list_box_files, 2, wx.EXPAND)

        box_all.Add(left_box, 2, wx.EXPAND)
        box_all.Add(self.panel1, 10, wx.EXPAND)

        #
        # p1 = wx.Panel(panel)
        # p1.SetBackgroundColour('#eded43')
        #
        # box_all.Add(p1, flag=wx.RIGHT|wx.EXPAND, border=8)
        #
        # box_all.Add(wx.Button(parent=panel, label=u'line one'), flag=wx.EXPAND, proportion=wx.EXPAND)

        panel.SetAutoLayout(True)

        panel.SetSizer(box_all)

        pass
Ejemplo n.º 12
0
    def __init__(self, parent, category_dct,category_list, docManager,option_name):
        """
        Initializes the options dialog with a notebook page that contains new
        instances of the passed optionsPanelClasses.
        """
        wx.Dialog.__init__(self, parent, -1, _("Options"))

        self._optionsPanels = {}
        self.current_panel = None
        self.current_item = None
        self._docManager = docManager
        self._category_list = category_list

        sizer = wx.BoxSizer(wx.VERTICAL)
        
        line_sizer = wx.BoxSizer(wx.HORIZONTAL)
        tree_sizer = wx.BoxSizer(wx.VERTICAL)
            
        self.tree = CT.CustomTreeCtrl(self,size=(200,600) ,style = wx.BORDER_THEME,agwStyle = wx.TR_DEFAULT_STYLE|wx.TR_NO_BUTTONS|wx.TR_HIDE_ROOT)
        tree_sizer.Add(self.tree, 0, wx.ALL, 0)
        wx.EVT_TREE_SEL_CHANGED(self.tree,self.tree.GetId(),self.DoSelection)

        line_sizer.Add(tree_sizer, 0, wx.TOP|wx.LEFT, consts.SPACE)
        self.panel_sizer = wx.BoxSizer(wx.VERTICAL)
        
        line_sizer.Add(self.panel_sizer, 0, wx.RIGHT|wx.EXPAND, consts.SPACE)
        sizer.Add(line_sizer, 0, wx.ALL | wx.EXPAND, -1)
        
        sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND |wx.LEFT,consts.SPACE + 200)

        bitmap_plus = os.path.normpath(os.path.join(sysutilslib.mainModuleDir,"noval" ,"tool","bmp_source","plus.ico"))
        bitmap_minus = os.path.normpath(os.path.join(sysutilslib.mainModuleDir, "noval" ,"tool","bmp_source","minus.ico"))
        bitmap = wx.Bitmap(bitmap_plus, wx.BITMAP_TYPE_ICO)
        width = bitmap.GetWidth()
        
        il = wx.ImageList(width, width)
        #must add bitmap to imagelist twice
        il.Add(wx.Bitmap(bitmap_plus, wx.BITMAP_TYPE_ICO))
        il.Add(wx.Bitmap(bitmap_plus, wx.BITMAP_TYPE_ICO))
        il.Add(wx.Bitmap(bitmap_minus, wx.BITMAP_TYPE_ICO))
        il.Add(wx.Bitmap(bitmap_minus, wx.BITMAP_TYPE_ICO))

        self.tree.il = il                
        self.tree.SetButtonsImageList(il)
        self.root = self.tree.AddRoot("TheRoot")
        for category in category_list:
            item = self.tree.AppendItem(self.root,category)
            optionsPanelClasses = category_dct[category]
            for name,optionsPanelClass in optionsPanelClasses:
                option_panel = optionsPanelClass(self,-1)
                option_panel.Hide()
                self._optionsPanels[name] = option_panel
                child = self.tree.AppendItem(item,name)
                if name == option_name:
                    self.tree.SelectItem(child)

        sizer.Add(self.CreateButtonSizer(wx.OK | wx.CANCEL), 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM|wx.TOP, consts.HALF_SPACE)
        self.SetSizer(sizer)
        self.Layout()
        self.Fit()
        wx.CallAfter(self.DoRefresh)
Ejemplo n.º 13
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          title="China App Stress",
                          size=(1000, 600))
        self.Center()
        self.panel = wx.Panel(self, -1)
        self.main_box = wx.BoxSizer(wx.HORIZONTAL)  #整个界面,水平布局
        self.left_box = wx.BoxSizer(wx.VERTICAL)  #左边界面,主要放置 Tree和PLAN的导入导出
        self.right_box = wx.BoxSizer(wx.VERTICAL)  #右边界面,主要放置 文本输出和基本按键
        self.thread_list = list()
        #左边界面模块开始
        #---------树模块开始
        self.test_case_tree = CT.CustomTreeCtrl(self.panel,
                                                agwStyle=wx.TR_DEFAULT_STYLE
                                                | CT.TR_AUTO_CHECK_PARENT
                                                | CT.TR_AUTO_CHECK_CHILD)
        self.test_case_tree_root = self.test_case_tree.AddRoot('TestCase')
        TestCaseTree.append_test_case(tree=self.test_case_tree,
                                      parent=self.test_case_tree_root,
                                      case_path=GlobalVariable.cases_folder)
        self.test_case_tree_root.Expand()
        #---------树模块结束

        self.left_above_box = wx.BoxSizer(wx.HORIZONTAL)  #左下界面,import和outport
        #---------左下界面模块开始
        self.import_button = wx.Button(self.panel, -1, 'Import',
                                       size=(-1, 50))  #导入XML按钮
        self.Bind(wx.EVT_BUTTON, self.on_import, self.import_button)
        self.export_button = wx.Button(self.panel, -1, 'Export',
                                       size=(-1, 50))  #导出选项到XML按钮
        self.Bind(wx.EVT_BUTTON, self.on_export, self.export_button)
        self.left_above_box.Add(self.import_button, 1, wx.EXPAND)
        self.left_above_box.Add(self.export_button, 1, wx.EXPAND)
        #---------左下界面模块结束
        self.left_box.Add(self.test_case_tree, 1, wx.EXPAND)
        self.left_box.Add(self.left_above_box, 0, wx.EXPAND)
        #左边界面模块结束

        #右边界面模块开始
        #------------文本显示模块开始
        self.message_box = wx.TextCtrl(self.panel,
                                       -1,
                                       "",
                                       style=wx.TE_MULTILINE | wx.TE_READONLY
                                       | wx.HSCROLL)
        self.message_box.SetInsertionPointEnd()
        redir = RedirectText(self.message_box)
        sys.stdout = redir

        #------------文本显示模块结束
        self.Right_Above_Box = wx.BoxSizer(
            wx.HORIZONTAL)  #右下界面模块,水平布局,主要包含 Devicelist 和StartButton
        self.Right_Above_Box_VERTICAL = wx.BoxSizer(
            wx.VERTICAL)  #右下BUTTONBOX,垂直布局,主要包含 下面两个水平布局框架
        self.Right_Above_Box_HORIZONTAL_1 = wx.BoxSizer(
            wx.HORIZONTAL)  #右下界面模块,水平布局,Start和Stop
        self.Right_Above_Box_HORIZONTAL_2 = wx.BoxSizer(
            wx.HORIZONTAL)  #右下界面模块,水平布局,Report和空白
        #------------右下显示模块开始

        #        DEV.getDevicesList()
        #        self.Device_Box = wx.RadioBox(self.panel, -1, "Device", wx.DefaultPosition,wx.DefaultSize,DEV.devices_List, 1, wx.RA_SPECIFY_COLS)#显示设备列表
        #        self.Bind(wx.EVT_RADIOBOX, self.OnChoice, self.Device_Box)
        #        serial_number = self.Device_Box.GetItemLabel(self.Device_Box.Selection)

        self.start_button = wx.Button(self.panel, -1, 'START',
                                      size=(-1, 40))  #开始运行
        self.Bind(wx.EVT_BUTTON, self.on_start, self.start_button)
        self.Result_Button = wx.Button(self.panel, -1, 'RESULT',
                                       size=(-1, 40))  #打开报告
        # self.Bind(wx.EVT_BUTTON, self.OnResult, self.Result_Button)
        self.stop_button = wx.Button(self.panel, -1, 'STOP',
                                     size=(-1, 40))  #停止运行
        self.Bind(wx.EVT_BUTTON, self.on_stop, self.stop_button)
        self.Refresh_Button = wx.Button(self.panel,
                                        -1,
                                        'REFRESH',
                                        size=(-1, 40))  #重新加载页面
        #  self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.Refresh_Button)

        self.Right_Above_Box_HORIZONTAL_1.Add(self.start_button, 1, wx.EXPAND)
        self.Right_Above_Box_HORIZONTAL_1.Add(self.stop_button, 1, wx.EXPAND)

        self.Right_Above_Box_HORIZONTAL_2.Add(self.Result_Button, 1, wx.EXPAND)
        self.Right_Above_Box_HORIZONTAL_2.Add(self.Refresh_Button, 1,
                                              wx.EXPAND)
        self.Right_Above_Box_VERTICAL.Add(self.Right_Above_Box_HORIZONTAL_1, 1,
                                          wx.EXPAND)
        self.Right_Above_Box_VERTICAL.Add(self.Right_Above_Box_HORIZONTAL_2, 1,
                                          wx.EXPAND)
        #        self.Right_Above_Box.Add(self.Device_Box,3,wx.EXPAND)
        self.Right_Above_Box.Add(self.Right_Above_Box_VERTICAL, 7,
                                 wx.EXPAND | wx.TOP, 5)

        #------------右下显示模块结束
        self.right_box.Add(self.message_box, 1, wx.EXPAND)
        self.right_box.Add(self.Right_Above_Box, 0, wx.EXPAND)
        #右边界面模块结束

        self.main_box.Add(self.left_box, 3,
                          wx.EXPAND | wx.TOP | wx.LEFT | wx.BOTTOM, 5)
        self.main_box.Add(self.right_box, 7,
                          wx.EXPAND | wx.TOP | wx.RIGHT | wx.LEFT | wx.BOTTOM,
                          5)
        self.panel.SetSizer(self.main_box)
Ejemplo n.º 14
0
    def __init__(self,
                 parent,
                 root_ctx,
                 shift_filter,
                 category_filter,
                 id=wx.ID_ANY,
                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                 size=wx.DefaultSize,
                 pos=wx.DefaultPosition):
        pre = wx.PreDialog()
        pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
        pre.Create(parent, id, "Filters", pos, size, style)
        self.PostCreate(pre)

        sizer = wx.BoxSizer(wx.VERTICAL)

        shift_filter_active = True
        if shift_filter is None:
            shift_filter = {}
            shift_filter_active = False

        category_filter_active = True
        if category_filter is None:
            category_filter = set()
            category_filter_active = False

        # get all categories
        categories = set()

        def collect_categories(node, context):
            for category in node.categories:
                if category is not None:
                    categories.add(category)
            return True

        root_ctx.visit_nodes(collect_categories)

        # list control for category filters
        choices = ["<none>"] + sorted(categories)
        self.categories_listbox = wx.CheckListBox(self,
                                                  style=wx.NO_BORDER,
                                                  choices=choices)
        box = wx.StaticBox(self, -1, "Categories")
        boxsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        boxsizer.Add(self.categories_listbox, 1, wx.ALL, 5)
        sizer.Add(boxsizer, 0, wx.EXPAND | wx.ALL, 5)

        for i in xrange(self.categories_listbox.GetCount()):
            category = self.categories_listbox.GetString(i)
            if category == "<none>":
                category = None
            if not category_filter_active or category in category_filter:
                self.categories_listbox.Check(i)

        # tree control of all possible shifted contexts
        all_shifts = {}
        for shifted_ctx in root_ctx.iter_shifted_contexts():
            for key, value in shifted_ctx.get_shift_set().iteritems():
                all_shifts.setdefault(key, set()).add(value)

        tree_ctrl = CT.CustomTreeCtrl(self)
        box = wx.StaticBox(self, -1, "Contexts")
        boxsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        boxsizer.Add(tree_ctrl, 1, wx.EXPAND | wx.ALL, 5)
        sizer.Add(boxsizer, 1, wx.EXPAND | wx.ALL, 5)

        root = tree_ctrl.AddRoot("Root context", ct_type=1)
        root.Check(not shift_filter_active or None in shift_filter)
        root.SetData((None, None, False))

        for key in sorted(all_shifts.iterkeys()):
            node_item = tree_ctrl.AppendItem(root, key.short_name, ct_type=1)
            node_item.SetData((key, None, True))
            node_item.Set3State(True)

            # add the individual shift items
            num_checked = 0
            for shift in sorted(all_shifts[key]):
                if isinstance(shift, MDFNode):
                    shift_str = shift.short_name
                else:
                    shift_str = str(shift)[:50]
                shift_item = tree_ctrl.AppendItem(node_item,
                                                  shift_str,
                                                  ct_type=1)
                shift_item.SetData((key, shift, False))

                if ((not shift_filter_active) or
                    (key in shift_filter and shift in shift_filter[key])):
                    shift_item.Check(True)
                    num_checked += 1

            # set the state of the group item
            if num_checked == len(all_shifts[key]):
                node_item.Set3StateValue(wx.CHK_CHECKED)
            elif num_checked > 0:
                node_item.Set3StateValue(wx.CHK_UNDETERMINED)
            else:
                node_item.Set3StateValue(wx.CHK_UNCHECKED)

        tree_ctrl.Expand(root)

        self.ctx_tree = tree_ctrl
        tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKED, self.OnCtxTreeItemChecked)

        # ok/cancel buttons
        btnsizer = wx.StdDialogButtonSizer()
        okbtn = wx.Button(self, wx.ID_OK)
        okbtn.SetDefault()
        btnsizer.AddButton(okbtn)
        clearbtn = wx.Button(self, label="Clear All")
        btnsizer.SetNegativeButton(clearbtn)
        cancelbtn = wx.Button(self, wx.ID_CANCEL)
        btnsizer.AddButton(cancelbtn)
        btnsizer.Realize()
        sizer.Add(btnsizer, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                  5)

        self.Bind(wx.EVT_BUTTON, self.OnClearAll, clearbtn)

        self.SetSizer(sizer)
        sizer.Fit(self)
        self.CenterOnParent()
Ejemplo n.º 15
0
    def InitMainPanel(self):

        ### MAIN PANEL
        #
        # Create main panel to contain everything
        self.panel = wx.Panel(self)
        self.box   = wx.BoxSizer(wx.VERTICAL)

        # Create FlexGridSizer to have 3 panes
        # 2nd and 3rd arguments are hgap and vgap b/t panes (cosmetic)
        self.grid = wx.FlexGridSizer(cols = 3, rows = 2, hgap = 10, vgap = 10)

        self.part_header = wx.StaticText(self.panel, label = "Parts view")
        self.geom_header = wx.StaticText(self.panel, label = "Geometry view")
        self.latt_header = wx.StaticText(self.panel, label = "Lattice view")

        self.panel_style = wx.SIMPLE_BORDER
        self.part_panel = wx.Panel(self.panel, style = self.panel_style)
        self.geom_panel = wx.Panel(self.panel, style = self.panel_style)
        self.latt_panel = wx.Panel(self.panel, style = self.panel_style)

        self.part_sizer = wx.BoxSizer(wx.VERTICAL)
        self.latt_sizer = wx.BoxSizer(wx.VERTICAL)
        
        # Some special setup for geometry sizer (grid)
        self.image_cols = 2
        self.geom_sizer = wx.GridSizer(cols = self.image_cols, rows = 0, hgap = 5, vgap = 5)
        # Defines tightness of images in grid (i.e. produces blank border)
        self.geom_tight = 0.7


        # PARTS VIEW SETUP
        # Custom tree ctrl implementation
        self.treeStyle = (ctc.TR_MULTIPLE | ctc.TR_EDIT_LABELS | ctc.TR_HAS_BUTTONS)
        self.partTree_ctc = ctc.CustomTreeCtrl(self.part_panel, agwStyle = self.treeStyle)
        self.partTree_ctc.SetBackgroundColour('white')
        self.part_sizer.Add(self.partTree_ctc, 1, wx.EXPAND)



        # GEOMETRY VIEW SETUP
        # Set up image-view grid, where "rows = 0" means the sizer updates dynamically
        # according to the number of elements it holds
#        self.geom_sizer.Add(self.image_grid, 1, wx.EXPAND)

        # Binding for toggling of part/assembly images
        # though toggle buttons not yet realised
        self.Bind(wx.EVT_TOGGLEBUTTON, self.ImageToggled)
        
        self.no_image_ass  = 'Images/noimage_ass.png'
        self.no_image_part = 'Images/noimage_part.png'



        # LATTICE VIEW SETUP
        # Set up matplotlib FigureCanvas with toolbar for zooming and movement
        self.latt_figure = mpl.figure.Figure()
        self.latt_canvas = FigureCanvas(self.latt_panel, -1, self.latt_figure)
        self.latt_axes   = self.latt_figure.add_subplot(111)
        self.latt_canvas.Hide()

        # Realize but hide, to be shown later when file loaded/data updated
        self.latt_tb = NavigationToolbar(self.latt_canvas)
#        self.latt_tb.Realize()
        self.latt_tb.Hide()

        self.latt_sizer.Add(self.latt_canvas, 1, wx.EXPAND | wx.ALIGN_BOTTOM | wx.ALL, border = 5)
        self.latt_sizer.Add(self.latt_tb, 0, wx.EXPAND)

        self.selected_colour = 'blue'
        


        # OVERALL SIZERS SETUP
        self.part_panel.SetSizer(self.part_sizer)
        self.geom_panel.SetSizer(self.geom_sizer)
        self.latt_panel.SetSizer(self.latt_sizer)

        self.grid.AddMany([(self.part_header), (self.geom_header), (self.latt_header),
                           (self.part_panel, 1, wx.EXPAND), (self.geom_panel, 1, wx.EXPAND), (self.latt_panel, 1, wx.EXPAND)])

        # Set all grid elements to "growable" upon resizing
        # Flags (second argument is proportional size)
        self.grid.AddGrowableRow(1,0)
        self.grid.AddGrowableCol(0,3)
        self.grid.AddGrowableCol(1,2)
        self.grid.AddGrowableCol(2,3)

        # Set sizer for/update main panel
        self.box.Add(self.grid, 1, wx.ALL | wx.EXPAND, 5)
        self.panel.SetSizer(self.box)
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'Scrimmage Plotting Tool')
        self.figure = Figure()
        self.ax = self.figure.add_subplot(111)

        self.canvas = FigureCanvas(self, -1, self.figure)

        self.toolbar = NavigationToolbar2Wx(self.canvas)
        self.toolbar.Realize()

        self.vsizer = wx.BoxSizer(wx.VERTICAL)

        self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.buttonSizer.Add(wx.Button(self, 101, "Open Frames"), 0)
        self.Bind(wx.EVT_BUTTON, self.open_frames, id=101)
        self.buttonSizer.Add(wx.Button(self, 102, "Set Plot Title"), 0)
        self.Bind(wx.EVT_BUTTON, self.changePlotTitle, id=102)
        self.buttonSizer.Add(wx.Button(self, 103, "Set Y Label"), 0)
        self.Bind(wx.EVT_BUTTON, self.changeYLabel, id=103)
        self.buttonSizer.Add(wx.Button(self, 104, "Set Y Min"), 0)
        self.Bind(wx.EVT_BUTTON, self.setYMin, id=104)
        self.buttonSizer.Add(wx.Button(self, 105, "Set Y Max"), 0)
        self.Bind(wx.EVT_BUTTON, self.setYMax, id=105)
        self.buttonSizer.Add(wx.Button(self, 106, "Set Font Size"), 0)
        self.Bind(wx.EVT_BUTTON, self.setFontSize, id=106)

        self.vsizer.Add(self.buttonSizer, 0)

        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.canvasSizer = wx.BoxSizer(wx.VERTICAL)

        self.canvasSizer.Add(self.canvas, 1, wx.ALL | wx.EXPAND | wx.CENTER, 0)
        self.canvasSizer.Add(self.toolbar, 0, wx.ALL | wx.EXPAND | wx.RIGHT, 0)

        self.logs = dict()

        self.logTree = CT.CustomTreeCtrl(self, agwStyle=wx.TR_DEFAULT_STYLE)
        self.logTreeRoot = self.logTree.AddRoot("Scrimmage Logs")
        self.Bind(CT.EVT_TREE_ITEM_CHECKED, self.logTreeChecked)

        self.keySizer = wx.BoxSizer(wx.VERTICAL)
        self.keySizer.Add(wx.StaticText(self, -1, "Key:"))

        rightColumn = wx.BoxSizer(wx.VERTICAL)
        rightColumn.Add(self.keySizer, 4)

        self.sizer.Add(self.logTree, 2, wx.ALL | wx.EXPAND | wx.CENTER, 5)
        self.sizer.Add(self.canvasSizer, 8, wx.ALL | wx.EXPAND | wx.CENTER, 5)
        self.sizer.Add(rightColumn, 4, wx.ALL | wx.EXPAND | wx.TOP, 5)

        self.vsizer.Add(self.sizer, 20, wx.ALL | wx.EXPAND | wx.TOP, 5)
        self.SetSizer(self.vsizer)
        self.Fit()

        self.plottedItems = list()
        self.plottedButtons = dict()
        self.plottedColors = dict()
        self.closeButtonNum = 0
        self.closeLookup = dict()

        self.timeShift = dict()
        self.timeShiftSliders = dict()

        self.plotTitle = None
        self.ymin = None
        self.ymax = None
        self.ylabel = None

        self.flyingStates = set()
        self.flyingStatesToPlot = set()
Ejemplo n.º 17
0
    def __init__(self):
        QGP = QGP_Path()
        DEV = DevicesList()
        TREE = TestCaseTree()
        wx.Frame.__init__(self, None, -1, title="UiAutomator",size = (1000,600))
        self.Center()
        self.panel = wx.Panel(self, -1)


        self.Main_Box = wx.BoxSizer( wx.HORIZONTAL)#整个界面,水平布局
        self.Left_Box = wx.BoxSizer( wx.VERTICAL)#左边界面,主要放置 Tree和PLAN的导入导出
        self.Right_Box = wx.BoxSizer( wx.VERTICAL)#右边界面,主要放置 文本输出和基本按键


        #左边界面模块开始
        #---------树模块开始
        self.TestCase_TREE = CT.CustomTreeCtrl(self.panel,agwStyle=wx.TR_DEFAULT_STYLE|CT.TR_AUTO_CHECK_PARENT|CT.TR_AUTO_CHECK_CHILD)
        self.TestCase_TREE_ROOT = self.TestCase_TREE.AddRoot('TestCase')
        self.TestCase_TREE_ROOT.Expand()


        TREE.showTestCase(self.TestCase_TREE,self.TestCase_TREE_ROOT,QGP.PATH_TESTCASES)
        #---------树模块结束
        self.Left_Above_Box = wx.BoxSizer( wx.HORIZONTAL)#左下界面,import和outport
        #---------左下界面模块开始

        self.Import_Button = wx.Button(self.panel,-1,'Import',size=(-1,50))#导入XML按钮
        self.Bind(wx.EVT_BUTTON, self.OnImport, self.Import_Button)
        self.Export_Button = wx.Button(self.panel,-1,'Export',size=(-1,50))#导出选项到XML按钮
        self.Bind(wx.EVT_BUTTON, self.OnExport, self.Export_Button)

        self.Left_Above_Box.Add(self.Import_Button,1,wx.EXPAND)
        self.Left_Above_Box.Add(self.Export_Button,1,wx.EXPAND)

        #---------左下界面模块结束
        self.Left_Box.Add(self.TestCase_TREE,1,wx.EXPAND)
        self.Left_Box.Add(self.Left_Above_Box,0,wx.EXPAND)


        #左边界面模块结束

        #右边界面模块开始
        #------------文本显示模块开始
        self.multiText = wx.TextCtrl(self.panel, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY)
        self.multiText.SetInsertionPointEnd()
        self.redir=RedirectText(self.multiText)
        sys.stdout=self.redir
        #------------文本显示模块结束
        self.Right_Above_Box = wx.BoxSizer( wx.HORIZONTAL)#右下界面模块,水平布局,主要包含 Devicelist 和StartButton
        self.Right_Above_Box_VERTICAL = wx.BoxSizer( wx.VERTICAL)#右下BUTTONBOX,垂直布局,主要包含 下面两个水平布局框架
        self.Right_Above_Box_HORIZONTAL_1 = wx.BoxSizer( wx.HORIZONTAL)#右下界面模块,水平布局,Start和Stop
        self.Right_Above_Box_HORIZONTAL_2 = wx.BoxSizer( wx.HORIZONTAL)#右下界面模块,水平布局,Report和空白
        #------------右下显示模块开始

        DEV.getDevicesList()
        self.Device_Box = wx.RadioBox(self.panel, -1, "Device", wx.DefaultPosition,wx.DefaultSize,DEV.devices_List, 1, wx.RA_SPECIFY_COLS)#显示设备列表
        self.Bind(wx.EVT_RADIOBOX, self.OnChoice, self.Device_Box)
        global serial_number
        serial_number = self.Device_Box.GetItemLabel(self.Device_Box.Selection)

        self.Start_Button = wx.Button(self.panel,-1,'START',size=(-1,40))#开始运行
        self.Bind(wx.EVT_BUTTON, self.OnStart, self.Start_Button)
        self.Result_Button = wx.Button(self.panel,-1,'RESULT',size=(-1,40))#打开报告
        self.Bind(wx.EVT_BUTTON, self.OnResult, self.Result_Button)
        self.Stop_Button = wx.Button(self.panel,-1,'STOP',size=(-1,40))#停止运行

        self.Refresh_Button = wx.Button(self.panel,-1,'REFRESH',size=(-1,40))#重新加载页面
        self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.Refresh_Button)

        self.Right_Above_Box_HORIZONTAL_1.Add(self.Start_Button,1,wx.EXPAND)
        self.Right_Above_Box_HORIZONTAL_1.Add(self.Stop_Button,1,wx.EXPAND)
        self.Right_Above_Box_HORIZONTAL_2.Add(self.Result_Button,1,wx.EXPAND)
        self.Right_Above_Box_HORIZONTAL_2.Add(self.Refresh_Button,1,wx.EXPAND)
        self.Right_Above_Box_VERTICAL.Add(self.Right_Above_Box_HORIZONTAL_1,1,wx.EXPAND)
        self.Right_Above_Box_VERTICAL.Add(self.Right_Above_Box_HORIZONTAL_2,1,wx.EXPAND)
        self.Right_Above_Box.Add(self.Device_Box,3,wx.EXPAND)
        self.Right_Above_Box.Add(self.Right_Above_Box_VERTICAL,7,wx.EXPAND|wx.TOP,5)


        #------------右下显示模块结束
        self.Right_Box.Add(self.multiText,1,wx.EXPAND)
        self.Right_Box.Add(self.Right_Above_Box,0,wx.EXPAND)
        #右边界面模块结束


        self.Main_Box.Add(self.Left_Box,3,wx.EXPAND|wx.TOP|wx.LEFT|wx.BOTTOM,5)
        self.Main_Box.Add(self.Right_Box,7,wx.EXPAND|wx.TOP|wx.RIGHT|wx.LEFT|wx.BOTTOM,5)
        self.panel.SetSizer(self.Main_Box)
Ejemplo n.º 18
0
    def __init__(self):
        global serverIp, serverPort

        wx.Frame.__init__(self,
                          parent=None,
                          title="SocketQICQ",
                          size=(600, 400))

        panel = wx.Panel(self)

        self.isChoosedFile = False

        self.dataOfChoosedFile = None

        self.fileName = None

        panel.SetBackgroundColour((0, 153, 255))

        #python3.5.1 style的设置对wx.TreeCtrl()不起作用,改用ET
        self.userListTree = CT.CustomTreeCtrl(parent=panel,
                                              pos=(10, 10),
                                              size=(280, 300),
                                              style=wx.TR_FULL_ROW_HIGHLIGHT)
        self.rootID = self.userListTree.AddRoot("已登录用户")
        self.userListTree.SetBackgroundColour((224, 255, 255))

        self.userListTree.AppendItem(self.rootID, "第一个子节点")
        self.userListTree.AppendItem(self.rootID, "第二个子节点")
        self.userListTree.ExpandAll()

        self.userList = []

        self.info = wx.Button(parent=panel,
                              pos=(100, 315),
                              size=(80, 40),
                              label="说明")
        self.info.SetBackgroundColour((224, 255, 255))

        inputTip = wx.TextCtrl(parent=panel,
                               pos=(300, 10),
                               size=(130, 20),
                               value="请输入你要发送的信息",
                               style=wx.TE_READONLY)
        inputTip.SetForegroundColour((0, 153, 255))
        inputTip.SetBackgroundColour((224, 255, 255))
        self.input = wx.TextCtrl(parent=panel, pos=(300, 30), size=(130, 50))
        self.input.SetForegroundColour((0, 153, 255))
        self.input.SetBackgroundColour((224, 255, 255))

        self.fileChooser = wx.Button(parent=panel,
                                     pos=(440, 10),
                                     size=(130, 70),
                                     label="选择文件")
        self.fileChooser.SetBackgroundColour((224, 255, 255))

        self.send = wx.Button(parent=panel,
                              pos=(300, 100),
                              size=(275, 50),
                              label="发送")
        self.send.SetBackgroundColour((224, 255, 255))

        separation = wx.TextCtrl(parent=panel, pos=(290, 170), size=(300, 2))
        separation.SetBackgroundColour((224, 255, 255))

        receivedTip = wx.TextCtrl(parent=panel,
                                  pos=(300, 190),
                                  size=(135, 20),
                                  value="发送/接收到的消息列表",
                                  style=wx.TE_READONLY)
        receivedTip.SetForegroundColour((0, 153, 255))
        receivedTip.SetBackgroundColour((224, 255, 255))
        self.messageList = wx.TextCtrl(parent=panel,
                                       size=(275, 120),
                                       pos=(300, 210),
                                       style=(wx.TE_MULTILINE | wx.HSCROLL
                                              | wx.TE_READONLY))

        self.messageList.SetBackgroundColour((224, 255, 255))
        #前景色,也就是字体颜色
        self.messageList.SetForegroundColour((0, 153, 255))

        self.sendMessage = ""

        childThraed = Thread(target=self.socketHander)
        childThraed.setDaemon(True)
        childThraed.start()

        self.Bind(wx.EVT_BUTTON, self.OnInfoClicked, self.info)
        self.Bind(wx.EVT_BUTTON, self.OnSendClicked, self.send)
        self.Bind(wx.EVT_BUTTON, self.onFileChooseClicked, self.fileChooser)