wxPython制作跑monkey工具(Python3)(2)

time.sleep(5)
                print (u"Pull %s success!" % self.Logname)
                findException("./MonkeyLog_%s/%s" % (self.LogFileName,self.Logname) ,"CRASH" )
                findException("./MonkeyLog_%s/%s" % (self.LogFileName,self.Logname) ,"Exception")
               
                self.orderName5 = "adb pull /data/anr/traces.txt ./MonkeyLog_%s/traces.txt" % self.LogFileName
                excuOrder(self.orderName5)
               
            print("Export Log Complete.")
        else:
            print ("logname.txt is not exist!")


       
class InsertFrame(wx.Frame):


    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,title="Run monkey",
                          pos=wx.DefaultPosition,
    size=wx.DefaultSize,style=wx.DEFAULT_FRAME_STYLE,
                           )
       

panel = wx.Panel(self,-1)  #创建画板

#应用包名
        PackageLabel = wx.StaticText(panel, -1, "package name:")
        global packageText
        packageText = wx.TextCtrl(panel, -1, "",
                                size=(260,-1))
        packageText.SetInsertionPoint(0)

#monkey事件之间的间隔时间(ms)
        MTLabel = wx.StaticText(panel, -1, "Monkey time:")
        global MTText
        MTText = wx.TextCtrl(panel, -1, "",
                                size=(260,-1))

#monkey事件总次数
        MCLabel = wx.StaticText(panel, -1, "Monkey count:")
        global MCText
        MCText = wx.TextCtrl(panel, -1, "",
                                size=(260,-1))


        global button1
        #点击按钮运行monkey
        button1 = wx.Button(panel,label="Run Monkey")  #将按钮添加到画板

#杀死monkey
        button2 = wx.Button(panel,label="Kill Monkey")  #将按钮添加到画板

#导出日志
        button3 = wx.Button(panel,label="Export Log")  #将按钮添加到画板

#日志名字:
        MonkeyLogName = wx.StaticText(panel, -1, "Monkey logName:")
        global logNameST
        logNameST = wx.TextCtrl(panel,-1,"",
                                size=(260,-1))
       
        #绑定按钮的单击事件
        self.Bind(wx.EVT_BUTTON, self.runMonkey, button1)
        self.Bind(wx.EVT_BUTTON, self.killMonkey, button2)
        self.Bind(wx.EVT_BUTTON, self.exportLog, button3)
        #绑定窗口的关闭事件
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/fa209430e5d2d3c4e2b62c108018d36b.html