37 lines
1006 B
Python
37 lines
1006 B
Python
import ctypes
|
|
from PyQt5.QtWidgets import QApplication
|
|
from gui import TranslationApp
|
|
from logger_module import setup_logger
|
|
|
|
# 절전모드를 방지하는 설정 값
|
|
ES_CONTINUOUS = 0x80000000
|
|
ES_SYSTEM_REQUIRED = 0x00000001
|
|
|
|
def prevent_sleep():
|
|
"""절전모드 방지를 위해 시스템 설정을 변경"""
|
|
ctypes.windll.kernel32.SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED)
|
|
|
|
def allow_sleep():
|
|
"""절전모드 방지 설정을 해제"""
|
|
ctypes.windll.kernel32.SetThreadExecutionState(ES_CONTINUOUS)
|
|
|
|
def main():
|
|
# 로깅 설정
|
|
logger = setup_logger('default_logger', f'appTranslator.log')
|
|
|
|
# 절전모드 방지 활성화
|
|
prevent_sleep()
|
|
|
|
try:
|
|
# PyQt5 앱 실행
|
|
app = QApplication([])
|
|
window = TranslationApp(logger) # 로거를 TranslationApp에 전달
|
|
window.show()
|
|
app.exec_()
|
|
finally:
|
|
# 앱 종료 시 절전모드 방지 해제
|
|
allow_sleep()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|