代码拉取完成,页面将自动刷新
同步操作将从 pyminer/pyminer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
"""
这是一个用来调用,自动生成翻译文件的脚本。
"""
import os, sys
# import pmgwidgets
# sys.exit(0)
pn = os.path.dirname
pj = os.path.join
root = pn(pn(__file__))
print(root)
designer_root = pj(root, r'attachments', 'qtdesigner')
print(designer_root)
pylupdate_path = r'J:\Developing\pyminer_bin\PyMiner\interpreter\python.exe J:/Developing/pyminer_bin/PyMiner/bin/pmtoolbox/ui/translation.py' # pj(root, r'interpreter', 'Scripts', 'pylupdate5.exe')
linguist_path = pj(designer_root, r'linguist.exe')
import sys, subprocess
import os
import shutil
import os
path1 = r'E:\Python\pyminer_bin\PyMiner\bin\pmgwidgets'
path2 = r'E:\Python\pyminer_bin\PyMiner\bin\pmgwidgets'
s = ''
def update_ts(packages_path):
l = os.listdir(packages_path)
for folder in l:
if folder.find('.') != -1:
continue
abso_path = os.path.join(packages_path, folder)
translation_folder = os.path.join(abso_path, 'translations')
if not os.path.exists(translation_folder):
os.mkdir(translation_folder)
filenames = ''
for filename in os.listdir(abso_path):
if filename.endswith('.py'):
file_abso_path = os.path.join(abso_path, filename)
filenames += ' ' + file_abso_path + ' '
translation_file = os.path.join(translation_folder, 'qt_zh_CN.ts')
if filenames.strip() !='':
cmd = '%s %s -ts %s' % (pylupdate_path, filenames, translation_file)
print(cmd)
os.system(cmd)
# cmd = 'cd %s && linguist %s' % (designer_root, os.path.normcase(translation_file))
# print(cmd)
# subprocess.Popen(cmd,shell=True)
# plugins_path, platform_plugin_path = os.environ.pop('QT_PLUGIN_PATH'), os.environ.pop(
# 'QT_QPA_PLATFORM_PLUGIN_PATH') # =plugins_path
# =platform_plugin_path
# os.chdir(designer_root)
# print(os.getcwd())
# os.system(cmd)
# os.environ['QT_PLUGIN_PATH'] = plugins_path
# os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = platform_plugin_path
def update_translation(path):
global s
# print(path,os.path.exists(path))
for root, dirs, files in os.walk(path, True):
# print(root,path)
for f in files:
if f.endswith('.py') and not f.find('__init__.py'):
file = os.path.join(root, f)
s = s + ' ' + file + ' '
packages1_path = os.path.join(os.path.dirname(__file__), 'pyminer2/extensions/packages')
update_ts(packages1_path)
update_ts(os.path.join(os.path.dirname(__file__), r'pmgwidgets/widgets/basic'))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。