Beispiel #1
0
 def __buildListFile(self):
     """创建文件列表"""
     if self.__validBasePath():
         for fs in os.walk(self.basePath):
             for f in fs[2]:
                 extName = os.path.splitext(f)[1][1:]
                 if extName in self.filter:
                     self.fileList.append(transferCode(os.path.join(fs[0], f), "gbk", "utf-8"))
Beispiel #2
0
 def OnChooseBtnRightDown(self, event):
     dialog = wx.DirDialog(None, "Choose a folder:",
           style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
     if dialog.ShowModal() == wx.ID_OK:
         pathStr = transferCode(dialog.GetPath()+path.sep,'gbk','utf-8')
         self.pathText.SetValue(pathStr)
         self.pathText.SetToolTipString(pathStr)
         self.selectedPath = pathStr
         self.startBtn.Enable(True)
     dialog.Destroy()
Beispiel #3
0
 def __readApkInfo(self,apk):
     '''
     读取并返回apk信息
     @return: ApkInfoDto
     '''
     info = ApkInfoDto()
     # 取得文件名
     info.name = os.path.splitext(apk)[0]
     info.apkFile = apk
     cmd = transferCode(os.getcwd()+os.sep+'aapt.exe dump badging "'+apk+'"','utf-8','gbk')        
     for lineStr in os.popen(cmd).readlines():
         if lineStr.startswith("package: name='") :
             infos = re.match(r"package: name='(.*?)' versionCode='(.*?)' versionName='(.*?)'", lineStr).groups()
             info.pkgName = infos[0]
             info.version = int(infos[1])
             info.versionCode = infos[2]
         elif lineStr.startswith("application: label='") :
             infos = re.match(r"application: label='(.*?)' icon='.*?'", lineStr).groups()
             info.cnName = infos[0]
     return info
Beispiel #4
0
 def __deleteFile(self,info):
     fileName = transferCode(self.__buildFileName(info), 'utf-8', 'gbk')
     os.remove(fileName)
Beispiel #5
0
 def __renameFile(self,info):
     fromFile = transferCode(info.apkFile, 'utf-8', 'gbk')
     toFile = transferCode(self.__buildFileName(info), 'utf-8', 'gbk')
     os.rename(fromFile, toFile)
     info.apkFile = self.__buildFileName(info)