toggle_state 변수 keyError 수정

This commit is contained in:
9700X_PC 2024-11-13 16:39:10 +09:00
parent a4528c6a57
commit 32863688b1
10 changed files with 28 additions and 20 deletions

View File

@ -1127,8 +1127,9 @@ class BrowserController(QThread):
await self.edit_price(product_category)
# 썸네일 수정
if self.toggle_states.get('thumb',False):
self.logger.debug(f"썸네일수정 : {self.toggle_states['thumb']} ")
thumb = self.toggle_states.get('thumb',False)
if thumb:
self.logger.debug(f"썸네일수정 : {thumb} ")
await self.edit_thumb()
# 태그 수정
@ -1140,8 +1141,10 @@ class BrowserController(QThread):
pass
# 상세페이지 수정
if self.toggle_states.get('detail_Option',False) or self.toggle_states.get('detail_IMGTrans',False):
self.logger.debug(f"상세페이지 수정 : {self.toggle_states['detail_Option']} + {self.toggle_states['detail_IMGTrans']}")
detail_Option = self.toggle_states.get('detail_Option',False)
detail_IMGTrans = self.toggle_states.get('detail_IMGTrans',False)
if detail_Option or detail_IMGTrans:
self.logger.debug(f"상세페이지 수정 : {detail_Option} + {detail_IMGTrans}")
if not self.toggle_states.get('recovery_mode',False):
await self.detail_trans()
@ -1224,7 +1227,7 @@ class BrowserController(QThread):
await self.click_option_tab()
# 옵션 최대선택갯수
max_option_count = self.toggle_states['max_option_count']
max_option_count = self.toggle_states.get('max_option_count', 0)
self.current_options_info = await self.optionHandler.process_options(product_name, max_option_count, self.toggle_states)
# 수정 후 저장

View File

@ -205,13 +205,13 @@ class ClipboardImageManager:
"""클립보드의 내용을 처리하고, 필요한 경우 이미지 변환, 크롭 또는 클립보드 비우기"""
try:
is_watermark = toggle_states['watermark']
is_watermark = toggle_states.get('watermark')
self.logger.debug(f"is_watermark : {is_watermark}")
watermark_text = toggle_states['watermark_text']
watermark_text = toggle_states.get('watermark_text')
self.logger.debug(f"watermark_text : {watermark_text}")
opacity_percent = toggle_states['opacity_percent']
opacity_percent = toggle_states.get('opacity_percent')
self.logger.debug(f"opacity_percent : {opacity_percent}")
clipboard_data = self.get_clipboard_data()

12
gui.py
View File

@ -795,6 +795,12 @@ class AutoPercentyGUI(QWidget):
self.browser_controller.wait() # 스레드가 종료될 때까지 대기
event.accept()
def close(self):
self.logger.debug('프로그램을 종료합니다...')
self.save_settings()
asyncio.run(self.browser_controller.close_browser()) # 브라우저 종료
super().close()
@Slot()
def on_start_PercentyJob_clicked(self):
@ -974,12 +980,6 @@ class AutoPercentyGUI(QWidget):
# self.logger.debug('번역 작업을 중단합니다...')
# self.running = False # 번역 작업 중단
async def close(self):
self.logger.debug('프로그램을 종료합니다...')
self.save_settings()
await self.browser_controller.close_browser() # 브라우저 종료
super().close()
# async def detail_trans(self):
# # 상세페이지 탭 클릭
# await self.browser_controller.click_detail_tab()

View File

@ -18,6 +18,8 @@ def allow_sleep():
ctypes.windll.kernel32.SetThreadExecutionState(ES_CONTINUOUS)
if __name__ == '__main__':
app = QApplication([])
# 로깅 설정
logger = setup_logger('default_logger', 'AutoPercenty3.log')
@ -25,7 +27,6 @@ if __name__ == '__main__':
prevent_sleep()
# PySide6 GUI 실행
app = QApplication([])
window = AutoPercentyGUI(logger)
window.show()

View File

@ -222,12 +222,13 @@ class OptionHandler:
# 4. 옵션 정보 수집 및 번역
if toggle_states['optionTrnas']:
self.logger.debug(f"옵션 AI번역 : {toggle_states['optionTrnas']}")
optionTrnas = toggle_states.get('optionTrnas')
if optionTrnas:
self.logger.debug(f"옵션 AI번역 : {optionTrnas}")
try:
# Vertex AI를 통한 번역 시도
translated_options = await self.vertexAItranslator.translate_options(self.option_info['original_names'], product_name)
translated_options = await self.vertexAItranslator.translate_options(self.option_info.get('original_names'), product_name)
self.logger.debug(f"번역된 옵션 입력")
await self.apply_translated_options(translated_options, self.option_info['edit_fields'])
@ -268,8 +269,9 @@ class OptionHandler:
# 5. 옵션 필터링 및 조정
if toggle_states['optionAutoSelect']:
self.logger.debug(f"옵션 필터링 및 조정 : {toggle_states['optionAutoSelect']}")
optionAutoSelect = toggle_states.get('optionAutoSelect')
if optionAutoSelect:
self.logger.debug(f"옵션 필터링 및 조정 : {optionAutoSelect}")
await self.filter_and_adjust_options(max_option_count)
# 가격 낮은 순 재정렬 클릭
await self.low_order_click()

2
qt.conf Normal file
View File

@ -0,0 +1,2 @@
[Platforms]
WindowsArguments = dpiawareness=1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 KiB

After

Width:  |  Height:  |  Size: 403 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 KiB

After

Width:  |  Height:  |  Size: 624 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 KiB

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 KiB

After

Width:  |  Height:  |  Size: 401 KiB