🐛 | Fixed SHIFT-button getting stuck.
Some checks are pending
Gitea Action Test / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Action Test / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
parent
04072b16e6
commit
fb0451d49f
17
main.py
17
main.py
@ -11,6 +11,10 @@ def save_preferences():
|
||||
save_preferences_button.config(state=DISABLED, text="Saved!")
|
||||
root.after(5000, lambda: save_preferences_button.config(state=NORMAL, text="Save"))
|
||||
|
||||
def release_shift(is_windowed):
|
||||
if is_windowed:
|
||||
pyautogui.keyUp("shift")
|
||||
|
||||
def launch_exe():
|
||||
# Check for valid server address (Currently only supports numerical addresses (not domains.))
|
||||
if not validate_server_address(server_address_field.get()):
|
||||
@ -29,16 +33,21 @@ def launch_exe():
|
||||
# If game needs to be windowed then we use BF42Plus provided "workaround."
|
||||
if windowed.get():
|
||||
pyautogui.keyDown("shift")
|
||||
root.after(5000, lambda: pyautogui.keyUp("shift"))
|
||||
|
||||
subprocess.call([
|
||||
try:
|
||||
subprocess.call([
|
||||
"./BF1942.exe",
|
||||
"+game", "FinnWars",
|
||||
"+restart", "1",
|
||||
"+game", "FinnWars",
|
||||
"+joinServer", server_address_field.get()
|
||||
])
|
||||
root.quit()
|
||||
root.after(2000, lambda: release_shift(windowed.get()))
|
||||
root.after(2050, lambda: root.quit())
|
||||
except:
|
||||
launch_game.config(state=DISABLED, text=".exe not found!")
|
||||
root.after(5000, lambda: launch_game.config(state=NORMAL, text="Launch"))
|
||||
|
||||
root.after(50, lambda: release_shift(windowed.get()))
|
||||
|
||||
def validate_server_address(server_address):
|
||||
ip_regex = r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$"
|
||||
|
Loading…
Reference in New Issue
Block a user