2023-01-13 ver.3 Simplify the design process
parent
680d4ee1ed
commit
97b58368f1
|
@ -48,7 +48,7 @@ except Exception as exc:
|
||||||
import ssl
|
import ssl
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
|
|
||||||
CONST_APP_VERSION = u"MaxBot (2023.01.13) ver.2"
|
CONST_APP_VERSION = u"MaxBot (2023.01.13) ver.3"
|
||||||
|
|
||||||
CONST_HOMEPAGE_DEFAULT = "https://tixcraft.com"
|
CONST_HOMEPAGE_DEFAULT = "https://tixcraft.com"
|
||||||
|
|
||||||
|
@ -1690,7 +1690,7 @@ def tixcraft_reload_captcha(driver):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
#PS: credit to LinShihJhang's share
|
#PS: credit to LinShihJhang's share
|
||||||
def tixcraft_auto_ocr(driver, ocr, ocr_captcha_with_submit, away_from_keyboard_enable, previous_answer):
|
def tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer):
|
||||||
print("start to ddddocr")
|
print("start to ddddocr")
|
||||||
from NonBrowser import NonBrowser
|
from NonBrowser import NonBrowser
|
||||||
|
|
||||||
|
@ -1713,11 +1713,11 @@ def tixcraft_auto_ocr(driver, ocr, ocr_captcha_with_submit, away_from_keyboard_e
|
||||||
orc_answer = orc_answer.strip()
|
orc_answer = orc_answer.strip()
|
||||||
print("orc_answer:", orc_answer)
|
print("orc_answer:", orc_answer)
|
||||||
if len(orc_answer)==4:
|
if len(orc_answer)==4:
|
||||||
who_care_var, is_form_sumbited = tixcraft_keyin_captcha_code(driver, answer = orc_answer, auto_submit = ocr_captcha_with_submit)
|
who_care_var, is_form_sumbited = tixcraft_keyin_captcha_code(driver, answer = orc_answer, auto_submit = away_from_keyboard_enable)
|
||||||
else:
|
else:
|
||||||
if not away_from_keyboard_enable:
|
if not away_from_keyboard_enable:
|
||||||
tixcraft_keyin_captcha_code(driver)
|
tixcraft_keyin_captcha_code(driver)
|
||||||
tixcraft_toast(driver, "※ Ocr fail...")
|
tixcraft_toast(driver, "※ OCR辨識失敗Q_Q,驗證碼請手動輸入...")
|
||||||
else:
|
else:
|
||||||
is_need_redo_ocr = True
|
is_need_redo_ocr = True
|
||||||
if previous_answer != orc_answer:
|
if previous_answer != orc_answer:
|
||||||
|
@ -1740,11 +1740,8 @@ def tixcraft_ticket_main(driver, config_dict, ocr):
|
||||||
auto_check_agree = config_dict["auto_check_agree"]
|
auto_check_agree = config_dict["auto_check_agree"]
|
||||||
|
|
||||||
ocr_captcha_enable = config_dict["ocr_captcha"]["enable"]
|
ocr_captcha_enable = config_dict["ocr_captcha"]["enable"]
|
||||||
ocr_captcha_with_submit = config_dict["ocr_captcha"]["auto_submit"]
|
|
||||||
away_from_keyboard_enable = config_dict["ocr_captcha"]["force_submit"]
|
away_from_keyboard_enable = config_dict["ocr_captcha"]["force_submit"]
|
||||||
if not ocr_captcha_enable:
|
if not ocr_captcha_enable:
|
||||||
ocr_captcha_with_submit = False
|
|
||||||
if not ocr_captcha_with_submit:
|
|
||||||
away_from_keyboard_enable = False
|
away_from_keyboard_enable = False
|
||||||
|
|
||||||
if auto_check_agree:
|
if auto_check_agree:
|
||||||
|
@ -1806,7 +1803,7 @@ def tixcraft_ticket_main(driver, config_dict, ocr):
|
||||||
previous_answer = None
|
previous_answer = None
|
||||||
is_verifyCode_editing = True
|
is_verifyCode_editing = True
|
||||||
for redo_ocr in range(999):
|
for redo_ocr in range(999):
|
||||||
is_need_redo_ocr, previous_answer, is_form_sumbited = tixcraft_auto_ocr(driver, ocr, ocr_captcha_with_submit, away_from_keyboard_enable, previous_answer)
|
is_need_redo_ocr, previous_answer, is_form_sumbited = tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer)
|
||||||
if is_form_sumbited:
|
if is_form_sumbited:
|
||||||
# start next loop.
|
# start next loop.
|
||||||
is_verifyCode_editing = False
|
is_verifyCode_editing = False
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "pass_1_seat_remaining": true, "auto_check_agree": true, "ocr_captcha": {"enable": true, "auto_submit": true, "force_submit": true}, "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true, "area_mode": "from top to bottom", "area_keyword_1": "", "area_keyword_1_and": "", "area_keyword_2": "", "area_keyword_2_and": "", "auto_guess_options": false, "user_guess_string": ""}, "tixcraft": {"date_auto_select": {"enable": true, "date_keyword": "", "mode": "from top to bottom"}, "area_auto_select": {"enable": true, "area_keyword_1": "", "area_keyword_2": "", "area_keyword_3": "", "area_keyword_4": "", "mode": "from top to bottom"}, "pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true, "presale_code": ""}, "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "facebook_account": "", "kktix_account": "", "adblock_plus_enable": false}, "debug": false}
|
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "pass_1_seat_remaining": true, "auto_check_agree": true, "ocr_captcha": {"enable": true, "force_submit": false}, "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true, "area_mode": "from top to bottom", "area_keyword_1": "", "area_keyword_1_and": "", "area_keyword_2": "", "area_keyword_2_and": "", "auto_guess_options": false, "user_guess_string": ""}, "tixcraft": {"date_auto_select": {"enable": true, "date_keyword": "", "mode": "from top to bottom"}, "area_auto_select": {"enable": true, "area_keyword_1": "", "area_keyword_2": "", "area_keyword_3": "", "area_keyword_4": "", "mode": "from top to bottom"}, "pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true, "presale_code": ""}, "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "facebook_account": "", "kktix_account": "", "adblock_plus_enable": false}, "debug": false}
|
68
settings.py
68
settings.py
|
@ -19,7 +19,7 @@ import json
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import pyperclip
|
import pyperclip
|
||||||
|
|
||||||
CONST_APP_VERSION = u"MaxBot (2023.01.13) ver.2"
|
CONST_APP_VERSION = u"MaxBot (2023.01.13) ver.3"
|
||||||
|
|
||||||
CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom"
|
CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom"
|
||||||
CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"
|
CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"
|
||||||
|
@ -77,7 +77,6 @@ def load_translate():
|
||||||
en_us["area_keyword_4"] = 'Area Keyword #4'
|
en_us["area_keyword_4"] = 'Area Keyword #4'
|
||||||
en_us["pass_1_seat_remaining"] = 'Pass 1 seat remaining'
|
en_us["pass_1_seat_remaining"] = 'Pass 1 seat remaining'
|
||||||
en_us["ocr_captcha"] = 'OCR captcha'
|
en_us["ocr_captcha"] = 'OCR captcha'
|
||||||
en_us["ocr_captcha_with_submit"] = 'After guess auto submit'
|
|
||||||
en_us["ocr_captcha_force_submit"] = 'Away from keyboard'
|
en_us["ocr_captcha_force_submit"] = 'Away from keyboard'
|
||||||
|
|
||||||
en_us["preference"] = 'Preference'
|
en_us["preference"] = 'Preference'
|
||||||
|
@ -135,7 +134,6 @@ def load_translate():
|
||||||
zh_tw["area_keyword_4"] = '區域關鍵字 #4'
|
zh_tw["area_keyword_4"] = '區域關鍵字 #4'
|
||||||
zh_tw["pass_1_seat_remaining"] = '避開「剩餘 1」的區域'
|
zh_tw["pass_1_seat_remaining"] = '避開「剩餘 1」的區域'
|
||||||
zh_tw["ocr_captcha"] = '猜測驗證碼'
|
zh_tw["ocr_captcha"] = '猜測驗證碼'
|
||||||
zh_tw["ocr_captcha_with_submit"] = '猜測後自動送出'
|
|
||||||
zh_tw["ocr_captcha_force_submit"] = '掛機模式'
|
zh_tw["ocr_captcha_force_submit"] = '掛機模式'
|
||||||
|
|
||||||
zh_tw["preference"] = '偏好設定'
|
zh_tw["preference"] = '偏好設定'
|
||||||
|
@ -193,7 +191,6 @@ def load_translate():
|
||||||
zh_cn["area_keyword_4"] = '区域关键字 #4'
|
zh_cn["area_keyword_4"] = '区域关键字 #4'
|
||||||
zh_cn["pass_1_seat_remaining"] = '避开“剩余 1”的区域'
|
zh_cn["pass_1_seat_remaining"] = '避开“剩余 1”的区域'
|
||||||
zh_cn["ocr_captcha"] = '猜测验证码'
|
zh_cn["ocr_captcha"] = '猜测验证码'
|
||||||
zh_cn["ocr_captcha_with_submit"] = '猜测后自动送出'
|
|
||||||
zh_cn["ocr_captcha_force_submit"] = '挂机模式'
|
zh_cn["ocr_captcha_force_submit"] = '挂机模式'
|
||||||
|
|
||||||
zh_cn["preference"] = '偏好设定'
|
zh_cn["preference"] = '偏好设定'
|
||||||
|
@ -252,7 +249,6 @@ def load_translate():
|
||||||
ja_jp["area_keyword_4"] = 'エリアキーワード #4'
|
ja_jp["area_keyword_4"] = 'エリアキーワード #4'
|
||||||
ja_jp["pass_1_seat_remaining"] = '「1 席残り」エリアは避ける'
|
ja_jp["pass_1_seat_remaining"] = '「1 席残り」エリアは避ける'
|
||||||
ja_jp["ocr_captcha"] = 'キャプチャを推測する'
|
ja_jp["ocr_captcha"] = 'キャプチャを推測する'
|
||||||
ja_jp["ocr_captcha_with_submit"] = '提出で推測した後'
|
|
||||||
zh_cn["ocr_captcha_force_submit"] = 'キーボードから離れて'
|
zh_cn["ocr_captcha_force_submit"] = 'キーボードから離れて'
|
||||||
|
|
||||||
ja_jp["preference"] = '設定'
|
ja_jp["preference"] = '設定'
|
||||||
|
@ -306,7 +302,6 @@ def get_default_config():
|
||||||
config_dict["auto_check_agree"] = True
|
config_dict["auto_check_agree"] = True
|
||||||
config_dict["ocr_captcha"] = {}
|
config_dict["ocr_captcha"] = {}
|
||||||
config_dict["ocr_captcha"]["enable"] = True
|
config_dict["ocr_captcha"]["enable"] = True
|
||||||
config_dict["ocr_captcha"]["auto_submit"] = False
|
|
||||||
config_dict["ocr_captcha"]["force_submit"] = False
|
config_dict["ocr_captcha"]["force_submit"] = False
|
||||||
|
|
||||||
config_dict['kktix']={}
|
config_dict['kktix']={}
|
||||||
|
@ -429,7 +424,6 @@ def btn_save_act(language_code, slience_mode=False):
|
||||||
global txt_captcha_sound_filename
|
global txt_captcha_sound_filename
|
||||||
global chk_state_adblock_plus
|
global chk_state_adblock_plus
|
||||||
global chk_state_ocr_captcha
|
global chk_state_ocr_captcha
|
||||||
global chk_state_ocr_captcha_with_submit
|
|
||||||
global chk_state_ocr_captcha_force_submit
|
global chk_state_ocr_captcha_force_submit
|
||||||
|
|
||||||
is_all_data_correct = True
|
is_all_data_correct = True
|
||||||
|
@ -505,7 +499,6 @@ def btn_save_act(language_code, slience_mode=False):
|
||||||
|
|
||||||
config_dict["ocr_captcha"] = {}
|
config_dict["ocr_captcha"] = {}
|
||||||
config_dict["ocr_captcha"]["enable"] = bool(chk_state_ocr_captcha.get())
|
config_dict["ocr_captcha"]["enable"] = bool(chk_state_ocr_captcha.get())
|
||||||
config_dict["ocr_captcha"]["auto_submit"] = bool(chk_state_ocr_captcha_with_submit.get())
|
|
||||||
config_dict["ocr_captcha"]["force_submit"] = bool(chk_state_ocr_captcha_force_submit.get())
|
config_dict["ocr_captcha"]["force_submit"] = bool(chk_state_ocr_captcha_force_submit.get())
|
||||||
|
|
||||||
# save config.
|
# save config.
|
||||||
|
@ -667,7 +660,6 @@ def applyNewLanguage():
|
||||||
global lbl_auto_reload_coming_soon_page
|
global lbl_auto_reload_coming_soon_page
|
||||||
global lbl_presale_code
|
global lbl_presale_code
|
||||||
global lbl_ocr_captcha
|
global lbl_ocr_captcha
|
||||||
global lbl_ocr_captcha_with_submit
|
|
||||||
global lbl_ocr_captcha_force_submit
|
global lbl_ocr_captcha_force_submit
|
||||||
|
|
||||||
# for checkbox
|
# for checkbox
|
||||||
|
@ -684,8 +676,7 @@ def applyNewLanguage():
|
||||||
global chk_play_captcha_sound
|
global chk_play_captcha_sound
|
||||||
global chk_adblock_plus
|
global chk_adblock_plus
|
||||||
global chk_ocr_captcha
|
global chk_ocr_captcha
|
||||||
global chk_ocr_captcha_with_sumit
|
global chk_ocr_captcha_force_submit
|
||||||
global chk_ocr_captcha_force_sumit
|
|
||||||
|
|
||||||
global tabControl
|
global tabControl
|
||||||
|
|
||||||
|
@ -728,7 +719,6 @@ def applyNewLanguage():
|
||||||
lbl_auto_reload_coming_soon_page.config(text=translate[language_code]["auto_reload_coming_soon_page"])
|
lbl_auto_reload_coming_soon_page.config(text=translate[language_code]["auto_reload_coming_soon_page"])
|
||||||
lbl_presale_code.config(text=translate[language_code]["user_guess_string"])
|
lbl_presale_code.config(text=translate[language_code]["user_guess_string"])
|
||||||
lbl_ocr_captcha.config(text=translate[language_code]["ocr_captcha"])
|
lbl_ocr_captcha.config(text=translate[language_code]["ocr_captcha"])
|
||||||
lbl_ocr_captcha_with_submit.config(text=translate[language_code]["ocr_captcha_with_submit"])
|
|
||||||
lbl_ocr_captcha_force_submit.config(text=translate[language_code]["ocr_captcha_force_submit"])
|
lbl_ocr_captcha_force_submit.config(text=translate[language_code]["ocr_captcha_force_submit"])
|
||||||
|
|
||||||
chk_pass_1_seat_remaining.config(text=translate[language_code]["enable"])
|
chk_pass_1_seat_remaining.config(text=translate[language_code]["enable"])
|
||||||
|
@ -743,8 +733,7 @@ def applyNewLanguage():
|
||||||
chk_play_captcha_sound.config(text=translate[language_code]["enable"])
|
chk_play_captcha_sound.config(text=translate[language_code]["enable"])
|
||||||
chk_adblock_plus.config(text=translate[language_code]["enable"])
|
chk_adblock_plus.config(text=translate[language_code]["enable"])
|
||||||
chk_ocr_captcha.config(text=translate[language_code]["enable"])
|
chk_ocr_captcha.config(text=translate[language_code]["enable"])
|
||||||
chk_ocr_captcha_with_sumit.config(text=translate[language_code]["enable"])
|
chk_ocr_captcha_force_submit.config(text=translate[language_code]["enable"])
|
||||||
chk_ocr_captcha_force_sumit.config(text=translate[language_code]["enable"])
|
|
||||||
|
|
||||||
tabControl.tab(0, text=translate[language_code]["preference"])
|
tabControl.tab(0, text=translate[language_code]["preference"])
|
||||||
tabControl.tab(1, text=translate[language_code]["advanced"])
|
tabControl.tab(1, text=translate[language_code]["advanced"])
|
||||||
|
@ -823,34 +812,18 @@ def showHideOcrCaptchaWithSubmit():
|
||||||
global chk_state_ocr_captcha
|
global chk_state_ocr_captcha
|
||||||
is_ocr_captcha_enable = bool(chk_state_ocr_captcha.get())
|
is_ocr_captcha_enable = bool(chk_state_ocr_captcha.get())
|
||||||
|
|
||||||
global ocr_captcha_with_submit_index
|
global ocr_captcha_force_submit_index
|
||||||
global lbl_ocr_captcha_with_submit
|
global lbl_ocr_captcha_force_submit
|
||||||
global chk_ocr_captcha_with_sumit
|
global chk_ocr_captcha_force_submit
|
||||||
|
|
||||||
if is_ocr_captcha_enable:
|
if is_ocr_captcha_enable:
|
||||||
# show.
|
|
||||||
lbl_ocr_captcha_with_submit.grid(column=0, row=ocr_captcha_with_submit_index, sticky = E)
|
|
||||||
chk_ocr_captcha_with_sumit.grid(column=1, row=ocr_captcha_with_submit_index, sticky = W)
|
|
||||||
else:
|
|
||||||
# hide
|
|
||||||
lbl_ocr_captcha_with_submit.grid_forget()
|
|
||||||
chk_ocr_captcha_with_sumit.grid_forget()
|
|
||||||
|
|
||||||
global chk_state_ocr_captcha_with_submit
|
|
||||||
is_ocr_captcha_auto_submit_enable = bool(chk_state_ocr_captcha_with_submit.get())
|
|
||||||
|
|
||||||
global ocr_captcha_force_submit_index
|
|
||||||
global lbl_ocr_captcha_force_submit
|
|
||||||
global chk_ocr_captcha_force_sumit
|
|
||||||
|
|
||||||
if is_ocr_captcha_auto_submit_enable:
|
|
||||||
# show.
|
# show.
|
||||||
lbl_ocr_captcha_force_submit.grid(column=0, row=ocr_captcha_force_submit_index, sticky = E)
|
lbl_ocr_captcha_force_submit.grid(column=0, row=ocr_captcha_force_submit_index, sticky = E)
|
||||||
chk_ocr_captcha_force_sumit.grid(column=1, row=ocr_captcha_force_submit_index, sticky = W)
|
chk_ocr_captcha_force_submit.grid(column=1, row=ocr_captcha_force_submit_index, sticky = W)
|
||||||
else:
|
else:
|
||||||
# hide
|
# hide
|
||||||
lbl_ocr_captcha_force_submit.grid_forget()
|
lbl_ocr_captcha_force_submit.grid_forget()
|
||||||
chk_ocr_captcha_force_sumit.grid_forget()
|
chk_ocr_captcha_force_submit.grid_forget()
|
||||||
|
|
||||||
def showHidePass1SeatRemaining():
|
def showHidePass1SeatRemaining():
|
||||||
global combo_ticket_number
|
global combo_ticket_number
|
||||||
|
@ -1516,23 +1489,6 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
|
||||||
|
|
||||||
group_row_count+=1
|
group_row_count+=1
|
||||||
|
|
||||||
global ocr_captcha_with_submit_index
|
|
||||||
ocr_captcha_with_submit_index = group_row_count
|
|
||||||
|
|
||||||
global lbl_ocr_captcha_with_submit
|
|
||||||
lbl_ocr_captcha_with_submit = Label(frame_group_tixcraft, text=translate[language_code]['ocr_captcha_with_submit'])
|
|
||||||
lbl_ocr_captcha_with_submit.grid(column=0, row=ocr_captcha_with_submit_index, sticky = E)
|
|
||||||
|
|
||||||
global chk_state_ocr_captcha_with_submit
|
|
||||||
chk_state_ocr_captcha_with_submit = BooleanVar()
|
|
||||||
chk_state_ocr_captcha_with_submit.set(config_dict['ocr_captcha']["auto_submit"])
|
|
||||||
|
|
||||||
global chk_ocr_captcha_with_sumit
|
|
||||||
chk_ocr_captcha_with_sumit = Checkbutton(frame_group_tixcraft, text=translate[language_code]['enable'], variable=chk_state_ocr_captcha_with_submit, command=showHideOcrCaptchaWithSubmit)
|
|
||||||
chk_ocr_captcha_with_sumit.grid(column=1, row=group_row_count, sticky = W)
|
|
||||||
|
|
||||||
group_row_count+=1
|
|
||||||
|
|
||||||
global ocr_captcha_force_submit_index
|
global ocr_captcha_force_submit_index
|
||||||
ocr_captcha_force_submit_index = group_row_count
|
ocr_captcha_force_submit_index = group_row_count
|
||||||
|
|
||||||
|
@ -1544,9 +1500,9 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
|
||||||
chk_state_ocr_captcha_force_submit = BooleanVar()
|
chk_state_ocr_captcha_force_submit = BooleanVar()
|
||||||
chk_state_ocr_captcha_force_submit.set(config_dict['ocr_captcha']["force_submit"])
|
chk_state_ocr_captcha_force_submit.set(config_dict['ocr_captcha']["force_submit"])
|
||||||
|
|
||||||
global chk_ocr_captcha_force_sumit
|
global chk_ocr_captcha_force_submit
|
||||||
chk_ocr_captcha_force_sumit = Checkbutton(frame_group_tixcraft, text=translate[language_code]['enable'], variable=chk_state_ocr_captcha_force_submit)
|
chk_ocr_captcha_force_submit = Checkbutton(frame_group_tixcraft, text=translate[language_code]['enable'], variable=chk_state_ocr_captcha_force_submit)
|
||||||
chk_ocr_captcha_force_sumit.grid(column=1, row=group_row_count, sticky = W)
|
chk_ocr_captcha_force_submit.grid(column=1, row=group_row_count, sticky = W)
|
||||||
|
|
||||||
# final flush.
|
# final flush.
|
||||||
global frame_group_tixcraft_index
|
global frame_group_tixcraft_index
|
||||||
|
@ -1861,7 +1817,7 @@ def main():
|
||||||
load_GUI(root, config_dict)
|
load_GUI(root, config_dict)
|
||||||
|
|
||||||
GUI_SIZE_WIDTH = 460
|
GUI_SIZE_WIDTH = 460
|
||||||
GUI_SIZE_HEIGHT = 615
|
GUI_SIZE_HEIGHT = 594
|
||||||
|
|
||||||
GUI_SIZE_MACOS = str(GUI_SIZE_WIDTH) + 'x' + str(GUI_SIZE_HEIGHT)
|
GUI_SIZE_MACOS = str(GUI_SIZE_WIDTH) + 'x' + str(GUI_SIZE_HEIGHT)
|
||||||
GUI_SIZE_WINDOWS=str(GUI_SIZE_WIDTH-60) + 'x' + str(GUI_SIZE_HEIGHT-90)
|
GUI_SIZE_WINDOWS=str(GUI_SIZE_WIDTH-60) + 'x' + str(GUI_SIZE_HEIGHT-90)
|
||||||
|
|
Loading…
Reference in New Issue