Skip to content

Commit

Permalink
Fixed Multiple input while waiting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
FyrfyX8 committed Oct 8, 2023
1 parent 7e38bd8 commit 7d4550e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,10 @@ def ResetRolling(index, row):


def buttonPress(arg):
async def Pressed():
global MenuDeph, FMenuDeph, MenuIndex, MenuMaxIndex, MacAddresses, MenuMMIndex, RotateEnabled, ButtonEnabled, Wait,\
global ButtonEnabled, Wait

def pressed():
global MenuDeph, FMenuDeph, MenuIndex, MenuMaxIndex, MacAddresses, MenuMMIndex, RotateEnabled, ButtonEnabled, Wait, \
Scripts, MenuPrDeph, RollingEvent, RollingFlag, Connecting

if ButtonEnabled and Wait:
Expand All @@ -546,7 +548,7 @@ async def Pressed():
if MacAddresses[MenuMMIndex] == "none":
asyncio.run_coroutine_threadsafe(SetMac(), loop)
while Wait:
await asyncio.sleep(0.01)
time.sleep(0.01)
Wait = True
elif MacAddresses[MenuMMIndex] != "none":
RemoveMac()
Expand All @@ -561,14 +563,16 @@ async def Pressed():
if MenuDeph != MenuPrDeph:
ResetMenu()
else:
await asyncio.sleep(0.01)
time.sleep(0.01)
ButtonEnabled = True
RotateEnabled = True
else:
return
async def buttonCheck():
if ButtonEnabled and Wait:
await asyncio.get_event_loop().run_in_executor(None, pressed)

asyncio.run_coroutine_threadsafe(Pressed(),loop)

asyncio.run_coroutine_threadsafe(buttonCheck(), loop)

def valueChanged(value, direction):
global MenuPos, CursorPos, MenuMaxPos, MenuIndex, RollingEvent
Expand Down

0 comments on commit 7d4550e

Please sign in to comment.