Browse Source

Resolve all wx warnings and errors and bump version to 4.1.0

1.0.5-release-candidate
Chris 4 years ago
parent
commit
bc495ddc72
10 changed files with 56 additions and 39 deletions
  1. 14
      gooey/gui/components/footer.py
  2. 10
      gooey/gui/components/header.py
  3. 26
      gooey/gui/events.py
  4. 1
      gooey/gui/seeder.py
  5. 13
      gooey/python_bindings/argparse_to_json.py
  6. 8
      gooey/tests/test_dropdown.py
  7. 14
      gooey/tests/test_parent_inheritance.py
  8. 4
      gooey/tests/test_processor.py
  9. 3
      requirements.txt
  10. 2
      setup.py

14
gooey/gui/components/footer.py

@ -102,16 +102,16 @@ class Footer(wx.Panel):
self.progress_bar.Hide()
h_sizer.AddStretchSpacer(1)
h_sizer.Add(self.cancel_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
h_sizer.Add(self.start_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
h_sizer.Add(self.stop_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
h_sizer.Add(self.cancel_button, 0,wx.RIGHT, 20)
h_sizer.Add(self.start_button, 0, wx.RIGHT, 20)
h_sizer.Add(self.stop_button, 0, wx.RIGHT, 20)
v_sizer.AddStretchSpacer(1)
v_sizer.Add(h_sizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
v_sizer.Add(h_sizer, 0, wx.EXPAND)
h_sizer.Add(self.edit_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)
h_sizer.Add(self.restart_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)
h_sizer.Add(self.close_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
h_sizer.Add(self.edit_button, 0, wx.RIGHT, 10)
h_sizer.Add(self.restart_button, 0, wx.RIGHT, 10)
h_sizer.Add(self.close_button, 0, wx.RIGHT, 20)
self.edit_button.Hide()
self.restart_button.Hide()
self.close_button.Hide()

10
gooey/gui/components/header.py

@ -73,12 +73,12 @@ class FrameHeader(wx.Panel):
sizer = wx.BoxSizer(wx.HORIZONTAL)
headings_sizer = self.build_heading_sizer()
sizer.Add(headings_sizer, 1,
wx.ALIGN_LEFT | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND | wx.LEFT,
wx.ALIGN_LEFT | wx.EXPAND | wx.LEFT,
PAD_SIZE)
sizer.Add(self.settings_img, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.running_img, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.check_mark, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.error_symbol, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.settings_img, 0, wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.running_img, 0, wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.check_mark, 0, wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.error_symbol, 0, wx.EXPAND | wx.RIGHT, PAD_SIZE)
self.running_img.Hide()
self.check_mark.Hide()
self.error_symbol.Hide()

26
gooey/gui/events.py

@ -7,20 +7,20 @@ that tie everything together.
import wx
WINDOW_STOP = wx.NewId()
WINDOW_CANCEL = wx.NewId()
WINDOW_CLOSE = wx.NewId()
WINDOW_START = wx.NewId()
WINDOW_RESTART = wx.NewId()
WINDOW_EDIT = wx.NewId()
WINDOW_STOP = wx.Window.NewControlId()
WINDOW_CANCEL = wx.Window.NewControlId()
WINDOW_CLOSE = wx.Window.NewControlId()
WINDOW_START = wx.Window.NewControlId()
WINDOW_RESTART = wx.Window.NewControlId()
WINDOW_EDIT = wx.Window.NewControlId()
WINDOW_CHANGE = wx.NewId()
PANEL_CHANGE = wx.NewId()
LIST_BOX = wx.NewId()
WINDOW_CHANGE = wx.Window.NewControlId()
PANEL_CHANGE = wx.Window.NewControlId()
LIST_BOX = wx.Window.NewControlId()
CONSOLE_UPDATE = wx.NewId()
EXECUTION_COMPLETE = wx.NewId()
PROGRESS_UPDATE = wx.NewId()
CONSOLE_UPDATE = wx.Window.NewControlId()
EXECUTION_COMPLETE = wx.Window.NewControlId()
PROGRESS_UPDATE = wx.Window.NewControlId()
USER_INPUT = wx.NewId()
USER_INPUT = wx.Window.NewControlId()

1
gooey/gui/seeder.py

@ -11,6 +11,7 @@ def fetchDynamicProperties(target, encoding):
Sends a gooey-seed-ui request to the client program it retrieve
dynamically generated defaults with which to seed the UI
"""
# TODO: this needs to apply the same argpase_to_json data cleaning rules
cmd = '{} {}'.format(target, 'gooey-seed-ui --ignore-gooey')
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
if proc.returncode != 0:

13
gooey/python_bindings/argparse_to_json.py

@ -476,7 +476,7 @@ def handle_default(action, widget):
handlers = [
[textinput_with_nargs_and_list_default, coerse_nargs_list],
[is_widget('Listbox'), clean_list_defaults],
[is_widget('Dropdown'), safe_string],
[is_widget('Dropdown'), coerce_str],
[is_widget('Counter'), safe_string]
]
for matches, apply_coercion in handlers:
@ -555,7 +555,8 @@ def clean_default(default):
def safe_string(value):
"""
Coerce a type to string as long as it isn't None
Coerce a type to string as long as it isn't None or Boolean
TODO: why do I have this special boolean case..?
"""
if value is None or isinstance(value, bool):
return value
@ -563,6 +564,14 @@ def safe_string(value):
return str(value)
def coerce_str(value):
"""
Coerce the incoming type to string as long as it isn't None
"""
return str(value) if value is not None else value
def this_is_a_comment(action, widget):
"""
TODO:

8
gooey/tests/test_dropdown.py

@ -28,6 +28,14 @@ class TestGooeyDropdown(unittest.TestCase):
[['1', '2'], '1', '1', ['1', '2','3'], '1'],
# dynamic updates removed our selected value; defaults back to placeholder
[['1', '2'], '2', '2', ['1', '3'], 'Select Option'],
# TODO: this test case is currently passing wrong data for the dynamic
# TODO: update due to a bug where Gooey doesn't apply the same ingestion
# TODO: rules for data received dynamically as it does for parsers.
# TODO: In short, Gooey should be able to handle a list of bools [True, False]
# TODO: from dynamics just like it does in parser land. It doesn't currently
# TODO: do this, so I'm manually casting it to strings for now.
[[True, False], True, 'True', ['True', 'False'], 'True']
]
for choices, default, initalSelection, dynamicUpdate, expectedFinalSelection in testcases:

14
gooey/tests/test_parent_inheritance.py

@ -23,9 +23,9 @@ class TestParentInheritance(unittest.TestCase):
elif action.dest == "b_file":
found += 1
self.assertEquals(2, found, "Did not find 2 expected arguments, found " + str(found))
self.assertEquals(parser.widgets["a_file"], "FileChooser")
self.assertEquals(parser.widgets["b_file"], "DirChooser")
self.assertEqual(2, found, "Did not find 2 expected arguments, found " + str(found))
self.assertEqual(parser.widgets["a_file"], "FileChooser")
self.assertEqual(parser.widgets["b_file"], "DirChooser")
def test_parent_arguments_are_not_overridden(self):
"""
@ -50,7 +50,7 @@ class TestParentInheritance(unittest.TestCase):
action2 = parser.add_argument("a_file", widget="DirChooser", default="b")
self._verify_duplicate_parameters(action1, action2, parser)
self.assertEquals(parser.widgets["a_file"], "FileChooser")
self.assertEqual(parser.widgets["a_file"], "FileChooser")
def test_duplicates_on_same_parser_are_ignored(self):
"""
@ -71,7 +71,7 @@ class TestParentInheritance(unittest.TestCase):
action2 = parser.add_argument("a_file", default="b", widget="DirChooser")
self._verify_duplicate_parameters(action1, action2, parser)
self.assertEquals(parser.widgets["a_file"], "FileChooser")
self.assertEqual(parser.widgets["a_file"], "FileChooser")
def _verify_duplicate_parameters(self, action1, action2, parser):
"""
@ -81,6 +81,6 @@ class TestParentInheritance(unittest.TestCase):
for action in parser._actions:
if action.dest == "a_file":
found += 1
self.assertEquals(2, found, "Expected a both actions handling a_file but got " + str(found))
self.assertEquals(parser.get_default("a_file"), "a")
self.assertEqual(2, found, "Expected a both actions handling a_file but got " + str(found))
self.assertEqual(parser.get_default("a_file"), "a")
self.assertNotEqual(action1, action2)

4
gooey/tests/test_processor.py

@ -9,10 +9,10 @@ class TestProcessor(unittest.TestCase):
def test_extract_progress(self):
# should pull out a number based on the supplied
# regex and expression
processor = ProcessController("^progress: (\d+)%$", None, False, 'utf-8')
processor = ProcessController(r"^progress: (\d+)%$", None, False, 'utf-8')
self.assertEqual(processor._extract_progress(b'progress: 50%'), 50)
processor = ProcessController("total: (\d+)%$", None, False, 'utf-8')
processor = ProcessController(r"total: (\d+)%$", None, False, 'utf-8')
self.assertEqual(processor._extract_progress(b'my cool total: 100%'), 100)

3
requirements.txt

@ -1,5 +1,4 @@
RXPY>=0.1.0
wxpython>=4.0.0b1
wxpython>=4.1.0
Pillow>=4.3.0
psutil>=5.4.2
colored>=1.3.93

2
setup.py

@ -15,7 +15,7 @@ deps = [
]
if sys.version[0] == '3':
deps.append('wxpython==4.0.7')
deps.append('wxpython==4.1.0')
setup(

Loading…
Cancel
Save