Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored the RangeEditor for Qt and Wx to be more consistent #1783

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pbrod
Copy link
Contributor

@pbrod pbrod commented Nov 20, 2021

Refactored the RangeEditor backend for Qt and Wx so that their behavior becomes more consistent. (Closes issue #1771)

Updated the key_click_text_entry function in wx/_interaction_helpers.py to respond to "Right" or "Left" interaction. (Closes issue #1772)

Replaced the use of possibly insecure eval function with the safer ast.literal_eval in RangeEditor. (See issue #1773)

Fixed a bug on wx where the text style RangeEditor did raise an error whenever the textbox was empty, even if enter was not pressed.

Changed the default low and high attribute of RangeEditor from 0, 1 to Undefined, so that
the limits are from -infinite to +infinite by default. (Closes issue #1775)

Updated SimpleSpinEditor (for both Wx and PyQt) to allow floats and be able to specify the step of the spin control as well as allow low and/or high to be Undefined. Also added the possibility to increase the step value for the spinner by the use of the modifier keys "Shift", "Ctrl" or "Alt". They will increase the step value for the spinner by a factor of 2, 10 and 100, respectively. If a combination of "Shift", "Ctrl", "Alt" -keys are pressed the step increment will be the product of their factors. (Closes issue #1776)
Registered the interaction helper for SimpleSpinEditor for both Qt and Wx: (traitsui/testing/tester/_ui_tester_registry/qt4/_traitsui/range_editor.py,
traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/range_editor.py)

Made the behavior of LargeRangeSliderEditor more userfriendly. It now allows low and/or high to be Undefined. Its increase/decrease method also increase/decrease the trait value of a factor 10 so that the value remains the same if the increase range button is pushed once followed by a push on the decrease range button (given that the value did not exceed the boundaries low or high). (Closes issue #1777)

Added a show_error_dialog attribute to the EditorFactory class in editor_factory.py, which will disable the error popup dialog when set to False.
In order to avoid that the popup error dialog blocks and eventually makes the tests hang indefinitely the show_error_dialog attribute is set to False in RangeEditorDemo.py and test_range_editor_text.py. (Closes issue #1778)

Changed the default behavior of mode attribute in the RangeEditor. Now the 'View' conforms to the view explicitly set by the mode attribute unless it is set to 'auto'. Eg. if the mode is set to 'spinner' you will always get a SimpleSpinEditor as view. (Closes issue #1779)

Updated the mouse_click function in wx/_interaction_helpers.py to set focus to current control. (Closes issue #1780)

Checklist

  • Add a news fragment if this PR is news-worthy for end users. (see docs/releases/README.rst)

…or becomes more consistent. (Closes issue enthought#1771)

Updated the key_click_text_entry function in wx/_interaction_helpers.py to respond to "Right" or "Left" interaction. (Closes issue enthought#1772)

Replaced the use of possibly insecure eval function with the safer ast.literal_eval in RangeEditor. (See issue enthought#1773)

Fixed a bug on wx where the text style RangeEditor did raise an error whenever the textbox was empty, even if enter was not pressed.

Changed the default low and high attribute of RangeEditor from 0, 1 to Undefined, so that
the limits are from -infinite to +infinite by default. (Closes issue enthought#1775)

Updated SimpleSpinEditor (for both Wx and PyQt) to allow floats and be able to specify the step of the spin control as well as allow low and/or high to be Undefined. Also added the possibility to increase the step value for the spinner by the use of the modifier keys "Shift", "Ctrl" or "Alt". They will increase the step value for the spinner by a factor of 2, 10 and 100, respectively. If a combination of "Shift", "Ctrl", "Alt" -keys are pressed the step increment will be the product of their factors. (Closes issue enthought#1776)
Registered the interaction helper for SimpleSpinEditor for both Qt and Wx: (traitsui/testing/tester/_ui_tester_registry/qt4/_traitsui/range_editor.py,
traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/range_editor.py)

Made the behavior of LargeRangeSliderEditor more userfriendly. It now allows low and/or high to be Undefined. Its increase/decrease method also increase/decrease the trait value of a factor 10 so that the value remains the same if the increase range button is pushed once followed by a push on the decrease range button (given that the value did not exceed the boundaries low or high). (Closes issue enthought#1777)

Added a show_error_dialog attribute to the EditorFactory class in editor_factory.py, which will disable the error popup dialog when set to False.
Set the show_error_dialog attribute to False in RangeEditorDemo.py and test_range_editor_text.py in order to avoid that the popup error dialog blocks and eventually makes the tests hang indefinitely. (Closes issue enthought#1778)

Changed the default behavior of mode attribute in the RangeEditor. Now the the 'View' conforms to the view explicitly set by the mode attribute unless it is set to 'auto'. Eg. if the mode is set to 'spinner' you will always get a SimpleSpinEditor as view. (Closes issue enthought#1779)

Updated the mouse_click function in wx/_interaction_helpers.py to set focus to current control. (Closes issue enthought#1780)
@pbrod pbrod marked this pull request as ready for review November 23, 2021 12:53
…errors, `SimpleSpinEditor` uses the built in `Decimal` class
…r to spark a focusOutEvent when a OK button is clicked in the unittests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant