mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
fix
This commit is contained in:
parent
30c646ddd0
commit
f10c785d97
@ -1,12 +1,13 @@
|
||||
import sys
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from PyQt5.QtGui import QFont
|
||||
import sys, windows
|
||||
import platform, os
|
||||
|
||||
if __name__ == "__main__":
|
||||
dirname = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
os.chdir(dirname)
|
||||
windows.addenvpath("./LunaTranslator/runtime/") # win7 no vcredist2015
|
||||
windows.loadlibrary(
|
||||
"./LunaTranslator/runtime/PyQt5/Qt5/bin/Qt5Core.dll"
|
||||
) # win7 no vcredist2015
|
||||
for p in (
|
||||
"./userconfig/memory",
|
||||
"./userconfig/memory",
|
||||
@ -36,6 +37,11 @@ if __name__ == "__main__":
|
||||
import gobject
|
||||
|
||||
gobject.overridepathexists()
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from PyQt5.QtGui import QFont
|
||||
|
||||
QApplication.addLibraryPath(
|
||||
"./LunaTranslator/runtime/PyQt5/Qt5/plugins"
|
||||
) # 中文字符下不能自动加载
|
||||
|
@ -25,7 +25,7 @@ from ctypes import (
|
||||
sizeof,
|
||||
byref,
|
||||
)
|
||||
import ctypes
|
||||
import ctypes, os
|
||||
from traceback import print_exc
|
||||
from ctypes.wintypes import (
|
||||
RECT,
|
||||
@ -949,3 +949,24 @@ _SetPropW.restype = BOOL
|
||||
|
||||
def SetProp(hwnd, string, hdata):
|
||||
return _SetPropW(hwnd, string, hdata)
|
||||
|
||||
|
||||
_GetEnvironmentVariableW = _kernel32.GetEnvironmentVariableW
|
||||
_GetEnvironmentVariableW.argtypes = c_wchar_p, c_wchar_p, DWORD
|
||||
_SetEnvironmentVariableW = _kernel32.SetEnvironmentVariableW
|
||||
_SetEnvironmentVariableW.argtypes = LPCWSTR, LPCWSTR
|
||||
|
||||
|
||||
def addenvpath(path):
|
||||
path = os.path.abspath(path)
|
||||
env = create_unicode_buffer(65535)
|
||||
_GetEnvironmentVariableW("PATH", env, 65535)
|
||||
_SetEnvironmentVariableW("PATH", env.value + ";" + path)
|
||||
|
||||
|
||||
_LoadLibraryW = _kernel32.LoadLibraryW
|
||||
_LoadLibraryW.argtypes = (LPCWSTR,)
|
||||
|
||||
|
||||
def loadlibrary(path):
|
||||
_LoadLibraryW(path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user