mirror of https://github.com/chriskiehl/Gooey.git
chriskiehl
9 years ago
11 changed files with 124 additions and 63 deletions
Split View
Diff Options
-
2gooey/__init__.py
-
12gooey/__main__.py
-
1gooey/examples/widget_demo.py
-
5gooey/gui/action_sorter.py
-
58gooey/gui/application.py
-
1gooey/gui/controller.py
-
3gooey/gui/windows/base_window.py
-
5gooey/gui/windows/runtime_display_panel.py
-
40gooey/python_bindings/config_generator.py
-
58gooey/python_bindings/gooey_decorator.py
-
2gooey/python_bindings/source_parser.py
@ -1,8 +1,8 @@ |
|||
import os |
|||
from gooey.python_bindings.gooey_decorator import Gooey |
|||
from gooey.python_bindings.gooey_parser import GooeyParser |
|||
from gooey.gui import application |
|||
|
|||
version_file = os.path.join(os.path.dirname(__file__), 'version') |
|||
|
|||
__version__ = '0.1.6' |
|||
|
@ -0,0 +1,12 @@ |
|||
''' |
|||
Delegates arguments to the main Gooey runner |
|||
|
|||
For use when run directly from command line with the -m (module) flag: |
|||
|
|||
e.g. $ python -m gooey |
|||
|
|||
''' |
|||
|
|||
from gooey import application |
|||
|
|||
application.main() |
@ -0,0 +1,40 @@ |
|||
import os |
|||
import argparse_to_json |
|||
from gooey.gui.windows import layouts |
|||
from gooey.python_bindings import source_parser |
|||
|
|||
|
|||
def create_from_module(module_path, **kwargs): |
|||
show_config = kwargs.get('show_config', False) |
|||
|
|||
run_cmd = 'python {}'.format(module_path) |
|||
a = os.path.basename(module_path).replace('.py', '') |
|||
build_spec = { |
|||
'language': kwargs.get('language', 'english'), |
|||
'target': run_cmd, |
|||
'program_name': kwargs.get('program_name') or os.path.basename(module_path).replace('.py', ''), |
|||
'program_description': kwargs.get('program_description', ''), |
|||
'show_config': show_config, |
|||
'show_advanced': kwargs.get('show_advanced', True), |
|||
'default_size': kwargs.get('default_size', (610, 530)), |
|||
'requireds_cols': kwargs.get('required_cols', 1), |
|||
'optionals_cols': kwargs.get('optional_cols', 3), |
|||
'manual_start': False |
|||
} |
|||
|
|||
if show_config: |
|||
parser = source_parser.extract_parser(module_path) |
|||
build_spec['program_description'] = parser.description or build_spec['program_description'] |
|||
|
|||
layout_data = argparse_to_json.convert(parser) if build_spec['show_advanced'] else layouts.basic_config.items() |
|||
build_spec.update(layout_data) |
|||
|
|||
else: |
|||
build_spec['manual_start'] = True |
|||
|
|||
return build_spec |
|||
|
|||
|
|||
|
|||
def has_argparse(module_path): |
|||
return any(['.parse_args(' in line.lower() for line in f.readlines()]) |
Write
Preview
Loading…
Cancel
Save