mirror of https://github.com/chriskiehl/Gooey.git
19 changed files with 319 additions and 52 deletions
Split View
Diff Options
-
24gooey/_tmp/example_disable_stop.py
-
23gooey/_tmp/example_progress_bar_1.py
-
27gooey/_tmp/example_progress_bar_2.py
-
26gooey/_tmp/example_progress_bar_3.py
-
39gooey/_tmp/example_progress_bar_4.py
-
89gooey/gui/controller.py
-
5gooey/gui/util/quoting.py
-
11gooey/gui/util/taskkill.py
-
1gooey/gui/widgets/components.py
-
2gooey/gui/widgets/widget_pack.py
-
34gooey/gui/windows/base_window.py
-
21gooey/gui/windows/footer.py
-
2gooey/gui/windows/layouts.py
-
17gooey/languages/eng.py
-
30gooey/languages/english.json
-
5gooey/python_bindings/config_generator.py
-
4gooey/python_bindings/docopt_to_json.py
-
10gooey/python_bindings/gooey_decorator.py
-
1gooey/python_bindings/gooey_parser.py
@ -0,0 +1,24 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (\d+)%$", |
|||
disable_stop_button=True) |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_1") |
|||
_ = parser.parse_args(sys.argv[1:]) |
|||
|
|||
for i in range(100): |
|||
print("progress: {}%".format(i+1)) |
|||
sys.stdout.flush() |
|||
sleep(0.1) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -0,0 +1,23 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (\d+)%$") |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_1") |
|||
_ = parser.parse_args(sys.argv[1:]) |
|||
|
|||
for i in range(100): |
|||
print("progress: {}%".format(i+1)) |
|||
sys.stdout.flush() |
|||
sleep(0.1) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -0,0 +1,27 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (\d+)/(\d+)$", |
|||
progress_expr="x[0] / x[1] * 100", |
|||
disable_progress_bar_animation=True) |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_2") |
|||
parser.add_argument("steps", type=int, default=15) |
|||
parser.add_argument("delay", type=int, default=1) |
|||
args = parser.parse_args(sys.argv[1:]) |
|||
|
|||
for i in range(args.steps): |
|||
print("progress: {}/{}".format(i+1, args.steps)) |
|||
sys.stdout.flush() |
|||
sleep(args.delay) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -0,0 +1,26 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (?P<current>\d+)/(?P<total>\d+)$", |
|||
progress_expr="current / total * 100") |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_3") |
|||
parser.add_argument("steps", type=int, default=15) |
|||
parser.add_argument("delay", type=int, default=1) |
|||
args = parser.parse_args(sys.argv[1:]) |
|||
|
|||
for i in range(args.steps): |
|||
print("progress: {}/{}".format(i+1, args.steps)) |
|||
sys.stdout.flush() |
|||
sleep(args.delay) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -0,0 +1,39 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (-?\d+)%$", |
|||
disable_progress_bar_animation=True) |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_1") |
|||
_ = parser.parse_args(sys.argv[1:]) |
|||
|
|||
print("Step 1") |
|||
|
|||
for i in range(1, 101): |
|||
print("progress: {}%".format(i)) |
|||
sys.stdout.flush() |
|||
sleep(0.05) |
|||
|
|||
print("Step 2") |
|||
|
|||
print("progress: -1%") # pulse |
|||
sys.stdout.flush() |
|||
sleep(3) |
|||
|
|||
print("Step 3") |
|||
|
|||
for i in range(1, 101): |
|||
print("progress: {}%".format(i)) |
|||
sys.stdout.flush() |
|||
sleep(0.05) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -0,0 +1,11 @@ |
|||
import sys |
|||
import os |
|||
import signal |
|||
|
|||
|
|||
if sys.platform.startswith("win"): |
|||
def taskkill(pid): |
|||
os.system('taskkill /F /PID {:d} /T >NUL 2>NUL'.format(pid)) |
|||
else: # POSIX |
|||
def taskkill(pid): |
|||
os.kill(pid, signal.SIGTERM) |
Write
Preview
Loading…
Cancel
Save