From ee100c37fe0b11b47ea7b29d31f727c8d5b8284b Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 20 Jun 2020 10:44:08 -0700 Subject: [PATCH] closes #496 - add option to start Gooey in fullscreen mode --- README.md | 1 + gooey/gui/containers/application.py | 2 ++ gooey/python_bindings/config_generator.py | 1 + gooey/tests/test_application.py | 27 +++++++++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 gooey/tests/test_application.py diff --git a/README.md b/README.md index 5c18891..4a528dc 100644 --- a/README.md +++ b/README.md @@ -243,6 +243,7 @@ Just about everything in Gooey's overall look and feel can be customized by pass |program_name | The name displayed in the title bar of the GUI window. If not supplied, the title defaults to the script name pulled from `sys.argv[0]`. | | program_description | Sets the text displayed in the top panel of the `Settings` screen. Defaults to the description pulled from `ArgumentParser`. | | default_size | Initial size of the window | +| fullscreen | start Gooey in fullscreen mode | | required_cols | Controls how many columns are in the Required Arguments section
:warning: **Deprecation notice:** See [Group Parameters](#group-configuration) for modern layout controls| | optional_cols | Controls how many columns are in the Optional Arguments section
:warning: **Deprecation notice:** See [Group Parameters](#group-configuration) for modern layout controls| | dump_build_config | Saves a `json` copy of its build configuration on disk for reuse/editing | diff --git a/gooey/gui/containers/application.py b/gooey/gui/containers/application.py index 9147b26..9804261 100644 --- a/gooey/gui/containers/application.py +++ b/gooey/gui/containers/application.py @@ -189,6 +189,8 @@ class GooeyApplication(wx.Frame): self.SetSizer(sizer) self.console.Hide() self.Layout() + if self.buildSpec.get('fullscreen', True): + self.ShowFullScreen(True) # Program Icon (Windows) icon = wx.Icon(self.buildSpec['images']['programIcon'], wx.BITMAP_TYPE_PNG) self.SetIcon(icon) diff --git a/gooey/python_bindings/config_generator.py b/gooey/python_bindings/config_generator.py index 2d007ca..e590ca2 100644 --- a/gooey/python_bindings/config_generator.py +++ b/gooey/python_bindings/config_generator.py @@ -55,6 +55,7 @@ def create_from_parser(parser, source_path, **kwargs): 'requires_shell': kwargs.get('requires_shell', True), 'menu': kwargs.get('menu', []), 'clear_before_run': kwargs.get('clear_before_run', False), + 'fullscreen': kwargs.get('fullscreen', False), # Legacy/Backward compatibility interop 'use_legacy_titles': kwargs.get('use_legacy_titles', True), diff --git a/gooey/tests/test_application.py b/gooey/tests/test_application.py new file mode 100644 index 0000000..c1e88f9 --- /dev/null +++ b/gooey/tests/test_application.py @@ -0,0 +1,27 @@ +import unittest +from argparse import ArgumentParser + +from tests.harness import instrumentGooey + + +class TestGooeyApplication(unittest.TestCase): + + + + def testFullscreen(self): + parser = self.basicParser() + for shouldShow in [True, False]: + with self.subTest('Should set full screen: {}'.format(shouldShow)): + with instrumentGooey(parser, fullscreen=shouldShow) as (app, gapp): + self.assertEqual(gapp.IsFullScreen(), shouldShow) + + def basicParser(self): + parser = ArgumentParser() + parser.add_argument('--foo') + return parser + + + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file