-
-
Notifications
You must be signed in to change notification settings - Fork 4
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 #85 from scalabli/_quo
#SpinningWheel fix
- Loading branch information
Showing
10 changed files
with
210 additions
and
23 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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Example of an input box dialog. | ||
""" | ||
import time | ||
import multiprocessing | ||
from quo import print | ||
from quo.dialog import InputBox | ||
|
||
#start_time = time.time() | ||
|
||
def main(): | ||
result = InputBox( | ||
title="PromptBox shenanigans", | ||
text="What Country are you from?:" | ||
) | ||
def ok(): | ||
pass | ||
# return print(f"{result}") | ||
|
||
def mult(i): | ||
with multiprocessing.Pool() as pool: | ||
pool.map(ok, i) | ||
#int(f"Result = {result}") | ||
if __name__ == "__main__": | ||
n = None | ||
start_time = time.time() | ||
main() | ||
duration = time.time() - start_time | ||
print(f"Duration {duration}") | ||
|
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Example of printing colored text to the output. | ||
""" | ||
import time | ||
import asyncio | ||
import concurrent.futures | ||
import multiprocessing | ||
from quo import print | ||
from quo.text import FormattedText | ||
from quo.style import Style | ||
|
||
async def main(): | ||
style = Style.add( | ||
{ | ||
"hello": "#ff0066", | ||
"world": "#44ff44 italic", | ||
} | ||
) | ||
|
||
# Print using a a list of text fragments. | ||
text_fragments = FormattedText( | ||
[ | ||
("class:hello", "Hello "), | ||
("class:world", "World"), | ||
("", "\n"), | ||
] | ||
) | ||
async def ok(text_fragments, style): | ||
async with text_framents as txt: | ||
print(txt, style=style) | ||
|
||
async def oks(dits): | ||
tasks = [] | ||
task = asyncio.ensure_future(ok(text_fragments,style)) | ||
tasks.append(task) | ||
await asyncio.gather(*tasks, return_exceptions=True) | ||
|
||
def asyc_tasks(dits): | ||
asyncio.get_event_loop().run_until_complete(ok(dits)) | ||
|
||
|
||
|
||
# with multiprocessing.Pool() as pool: | ||
# pool.map(ok, dits) | ||
#print(text_fragments, style=style) | ||
|
||
# Print using an HTML object. | ||
print("<hello>hello</hello> <world>world</world>\n", style=style) | ||
|
||
# Print using an HTML object with inline styling. | ||
print('<style fg="#ff0066">hello</style> ' | ||
'<style fg="#44ff44"><i>world</i></style>\n' | ||
) | ||
|
||
if __name__ == "__main__": | ||
start = time.time() | ||
with concurrent.futures.ProcessPoolExecutor(max_workers=5) as ex: | ||
futures = [ex.submit(asyc_tasks)] | ||
for future in concurrent.futures.as_completed(futures): | ||
pass | ||
duration = time.time() - start | ||
print(f"Duration {duration}") |
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,47 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Example of printing colored text to the output. | ||
""" | ||
import time | ||
import multiprocessing | ||
from quo import print | ||
from quo.text import FormattedText | ||
from quo.style import Style | ||
|
||
def main(): | ||
style = Style.add( | ||
{ | ||
"hello": "#ff0066", | ||
"world": "#44ff44 italic", | ||
} | ||
) | ||
|
||
# Print using a a list of text fragments. | ||
text_fragments = FormattedText( | ||
[ | ||
("class:hello", "Hello "), | ||
("class:world", "World"), | ||
("", "\n"), | ||
] | ||
) | ||
def ok(text_fragments, style): | ||
return print(text_fragments, style=style) | ||
|
||
def oks(dits): | ||
with multiprocessing.Pool() as pool: | ||
pool.map(ok, dits) | ||
#print(text_fragments, style=style) | ||
|
||
# Print using an HTML object. | ||
print("<hello>hello</hello> <world>world</world>\n", style=style) | ||
|
||
# Print using an HTML object with inline styling. | ||
print('<style fg="#ff0066">hello</style> ' | ||
'<style fg="#44ff44"><i>world</i></style>\n' | ||
) | ||
|
||
if __name__ == "__main__": | ||
start = time.time() | ||
main() | ||
duration = time.time() - start | ||
print(f"Duration {duration}") |
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,40 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Example of printing colored text to the output. | ||
""" | ||
import time | ||
from quo import print | ||
from quo.text import FormattedText | ||
from quo.style import Style | ||
|
||
def main(): | ||
style = Style.add( | ||
{ | ||
"hello": "#ff0066", | ||
"world": "#44ff44 italic", | ||
} | ||
) | ||
|
||
# Print using a a list of text fragments. | ||
text_fragments = FormattedText( | ||
[ | ||
("class:hello", "Hello "), | ||
("class:world", "World"), | ||
("", "\n"), | ||
] | ||
) | ||
print(text_fragments, style=style) | ||
|
||
# Print using an HTML object. | ||
print("<hello>hello</hello> <world>world</world>\n", style=style) | ||
|
||
# Print using an HTML object with inline styling. | ||
print('<style fg="#ff0066">hello</style> ' | ||
'<style fg="#44ff44"><i>world</i></style>\n' | ||
) | ||
|
||
if __name__ == "__main__": | ||
start = time.time() | ||
main() | ||
duration = time.time() - start | ||
print(f"Duration {duration}") |
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