-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #749 from rzellem/develop
v0.46.3: fix alignment bug in GUI
- Loading branch information
Showing
6 changed files
with
59 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import threading | ||
import time | ||
import sys | ||
|
||
|
||
done_flag_animate_exotic = None | ||
th_animate_exotic = None | ||
|
||
|
||
def animate(): | ||
import itertools | ||
for c in itertools.cycle(['|', '/', '-', '\\']): | ||
if done_flag_animate_exotic: | ||
sys.stdout.write('\rThinking ... DONE!') | ||
sys.stdout.write('\n') | ||
break | ||
sys.stdout.write('\rThinking ' + c + ' ... ') | ||
sys.stdout.flush() | ||
time.sleep(0.11) | ||
sys.stdout.flush() | ||
|
||
|
||
def animate_toggle(enabled=False): | ||
""" | ||
Console feature intended to be run in a single synchronous block. | ||
""" | ||
global done_flag_animate_exotic | ||
global th_animate_exotic | ||
counter_wait = 0 | ||
if enabled: | ||
done_flag_animate_exotic = False | ||
th_animate_exotic = threading.Thread(target=animate, daemon=True) | ||
th_animate_exotic.start() | ||
else: | ||
done_flag_animate_exotic = True | ||
if th_animate_exotic is not None: # kill animate thread before proceeding | ||
while th_animate_exotic.is_alive() and counter_wait <= 30: | ||
time.sleep(.37) | ||
counter_wait += 1 | ||
th_animate_exotic.join() # lightest solution | ||
th_animate_exotic = None | ||
return not done_flag_animate_exotic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.46.2" | ||
__version__ = "0.46.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters