옵션번역 개발 완료

This commit is contained in:
R5600U_PC 2024-10-29 13:56:14 +09:00
parent 1de79c6fe0
commit 1d039d2b28
7 changed files with 1301 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -41,7 +41,8 @@ excluded_option_marker = '.bXsMpn.sc-dfauwV'
; delete_button_selector = 'div#productMainContentContainerId div.lesrZh.sc-bYHUQc:nth-child({index}) div.sc-igZIGL.kQDmyq'
delete_button_selector = '.kQDmyq.sc-igZIGL'
confirm_delete_button_selector = '.ant-modal.css-1li46mu.ant-modal-confirm.ant-modal-confirm-confirm button:has-text("삭제")'
add_button_selector = 'div#productMainContentContainerId div.lesrZh.sc-bYHUQc:nth-child({index}) > .sc-dRGYJT.hmQUGb'
add_button_selector2 = 'div#productMainContentContainerId div.lesrZh.sc-bYHUQc:nth-child({index}) > .sc-dRGYJT.hmQUGb'
add_button_selector = '//*[@id="productMainContentContainerId"]/div[1]/div[2]/div/div/div[2]/div/div[1]/div/div/div[2]/div/div/div[5]/div[1]/div/div/ul/li[{index}]/div/div[1]/div/div[2]/div/div/img'
; add_button_selector = 'div.hmQUGb.sc-dRGYJT'
; add_button_selector = 'div#productMainContentContainerId div.lesrZh.sc-bYHUQc:nth-child({index}) > .sc-krITIZ.ckztYT'
; file_upload_button_selector = '.ant-modal-content button:has-text("클릭 or 드레그로 파일 업로드")'

21
gui.py
View File

@ -186,7 +186,7 @@ class TranslationApp(QWidget):
def initUI(self):
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.setGeometry(QRect(1240, 750, 280, 600))
self.setGeometry(QRect(1240, 900, 280, 600))
self.setWindowTitle('AutoPecenty2')
# 로그
@ -380,7 +380,23 @@ class TranslationApp(QWidget):
# 크롬 실행 버튼 및 번역 버튼
self.start_chrome_button = QPushButton('크롬 실행', self)
self.translate_button = QPushButton('번역 시작', self)
self.translate_button.setEnabled(False)
self.translate_button.setStyleSheet("""
QPushButton:disabled {
color: gray;
background-color: lightgray;
border: 1px solid gray;
}
""")
self.pause_button = QPushButton('일시정지', self)
self.pause_button.setEnabled(False)
self.pause_button.setStyleSheet("""
QPushButton:disabled {
color: gray;
background-color: lightgray;
border: 1px solid gray;
}
""")
self.cmb_button = QPushButton('크무비설정', self)
self.cmb_test_button = QPushButton('크무비테스트', self)
@ -712,6 +728,9 @@ class TranslationApp(QWidget):
self.titleHandler.update_page(self.browser_controller.page)
self.priceHandler.update_page(self.browser_controller.page)
self.translate_button.setEnabled(True)
self.pause_button.setEnabled(True)
def save_settings(self):
"""QSettings에 사용자 정보 저장"""
self.settings.setValue("admin/id", self.admin_id_input.text())

View File

@ -776,8 +776,8 @@ class OptionHandler:
# '+ 버튼' 클릭 후 파일 업로드
self.logger.debug(f"{index}번째 옵션의 이미지추가 버튼 가져오기")
# add_button = await self.page.query_selector(add_button_selector)
add_button = option_box
add_button = self.page.locator(f'//*[@id="productMainContentContainerId"]/div[1]/div[2]/div/div/div[2]/div/div[1]/div/div/div[2]/div/div/div[5]/div[1]/div/div/ul/li[{index}]/div/div[1]/div/div[2]/div/div/img')
# add_button = await option_box.query_selector('.//div[contains(@class, "sc-krITIZ") and contains(@class, "ckztYT")]')
# add_button = await option_box.query_selector(f'div#productMainContentContainerId li:nth-child({index}) > div > div:nth-child(1) > div > div:nth-child(2) > div > div')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

View File

@ -82,12 +82,12 @@ class WhaleTranslator:
self.update_whale_rect()
# 주소창으로 이동 후 URL 입력
pyautogui.hotkey('ctrl', 'l')
time.sleep(0.4)
pyautogui.typewrite('https://daum.net')
self.change_lang()
self.enter_url("about:newtab", change=True)
self.logger.debug("URL 입력 완료")
# pyautogui.hotkey('ctrl', 'l')
# time.sleep(0.4)
# pyautogui.typewrite('https://daum.net')
# self.change_lang()
# self.enter_url("about:newtab", change=True)
# self.logger.debug("URL 입력 완료")
# 가상 데스크탑 복귀 처리
if self.vd_mode:
@ -280,7 +280,7 @@ class WhaleTranslator:
self.logger.debug(f"이미지 URL 주소 {url} 입력")
self.enter_url_for_clipboard(url)
pyautogui.press('enter')
time.sleep(2) # 페이지 로딩 대기
time.sleep(1) # 페이지 로딩 대기
# 현재 웨일 창의 해상도를 확인하여 기준 이하일 경우 패스
min_width = 200