convert.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:TACTIC-Handler 作者: listyque 项目源码 文件源码
def convert_all_files_in_path(self, path):
        if not os.path.exists(path):
            print("'%s': Path doesn't exists. Skipping" % path)
            return
        count = 0
        for filename in os.listdir(path):
            full_path = os.path.join(path, filename)
            only_name, ext = os.path.splitext(full_path)
            cmd = None
            pyfile = None
            if fnmatch.fnmatch(filename, '*.ui'):
                pyfile = '%s.py' % only_name
                cmd = self.PYUIC
            elif fnmatch.fnmatch(filename, '*.qrc'):
                pyfile = '%s_rc.py' % only_name
                cmd = self.PYRCC
            if cmd and modified(full_path, pyfile):
                cmd_string = '%s -o "%s" "%s"' % (cmd, pyfile, full_path)
                os.system(cmd_string)
                count += 1
        print("'%s': %s converted %s files" % (path, time.ctime(time.time()), count))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号