Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added UI for Positioners component (#105)
* Added new class "editor.designer.CollimatorComponent" and its "__init__" method * Added properties "editor.designer.CollimatorComponent.__required_widgets" and "__required_comboboxes" * Added method "editor.designer.CollimatorComponent.reset()" and missing required label for the detector combobox * Added method "editor.designer.CollimatorComponent.validate()" * Added method "editor.designer.CollimatorComponent.setNewCollimator()" * Added method "editor.designer.CollimatorComponent.updateValue()" * Added method "editor.designer.CollimatorComponent.value()" * Added code to "editor.view.EditorWindow.initActions()" and "initMenus" to display the collimator component * BUG FIX -- removed unresolved parameter fro "editor.designer.CollimatorComponent.value()" * Added code to "editor.designer.Designer.setComponent()" to ensure the collimator component is displayed * Fixed typo in "editor.designer.CollimatorComponent.updateValue()" to populate the detectors combobox correctly. * Added routine "tests.test_editor.TestEditor.testCollimatorComponent()" containing tests of the collimator component * Added code to "editor.designer.CollimatorComponent.updateValue()" to display a warning if no detectors are defined * Updated tests in "tests.test_editor.TestEditor.testCollimatorComponent()" to include the detector warning * Added code to "editor.designer.CollimatorComponent.updateValue()" to disapply the detector warning at the start of each call * BUG FIX - Added call to "reset()" in the "updateValue()" method for each component to remove any warnings that have been applied. Also removed code clearing comboboxes from the "reset()" methods. * Changed code in "editor.designer.CollimatorComponent" and "tests.test_editor.TestEditor.testCollimatorComponent()" to choose the collimator by index from a combobox and have the name as a line edit * Added code to "editor.designer.CollimatorComponent.setNewCollimator()" to default to the first detector when setting a new collimator * Added code to "editor.designer.CollimatorComponent" to set the detector fields as an editable combobox, including a new routine"setNewDetector()" * Added tests to "tests.test_editor.TestEditor.testCollimatorComponent()" to ensure we can switch detectors, and new detectors in the editable combobox * Added new Class "editor.designer.FixedHardwareComponent" along with "__init__()" method. * Added new method "editor.designer.FixedHardwareComponent.__required_comboboxes" * Added new method "editor.designer.FixedHardwareComponent.reset()" * Added new method "editor.designer.FixedHardwareComponent.validate()" * Added new method "editor.designer.FixedHardwareComponent.updateValue()" * Added new method "editor.designer.FixedHardwareComponent.value()" * Added code to "editor.designer.Designer" and "editor.view" to display the fixed hardware component * Added code to "editor.designer.FixedHardwareComponent" to expand the width of the name combobox. Also fixed typos. * Added routine "tests.test_editor.testEditor.testFixedHardwareComponent()" * Added tests for visual subcomponent to "tests.test_editor.testEditor.testFixedHardwareComponent()" and "testCollimatorComponent()" * Added new class "editor.designer.PositioningStacksComponent" along with "__init__()" method * Added new methods "editor.designer.PositioningStacksComponent.__required_widgets" and "__required_comboboxes" * Added new methods "editor.designer.PositioningStacksComponent.reset()" * Added new methods "editor.designer.PositioningStacksComponent.validate()" * Added new methods "editor.designer.PositioningStacksComponent.addNewItem()" * Added new method "editor.designer.PositioningStacksComponent.clearList()" and reviewed variable names. * Added new method "editor.designer.PositioningStacksComponent.updateValue()" and added code to "clearList()" to populate the combobox correctly. * Added new method "editor.designer.PositioningStacksComponent.value()" * Added code to "editor.designer.Designer" and "editor.view" to display the positioning stacks component * Connected "Add" and "Clear" buttons to the corresponding routines in "editor.designer.PositioningStacksComponent" * BUG FIX -- changed code to ensure we refer to the ".text()" method of "QListWidgetItem" in "editor.designer.PositioningStacksComponent.value()" * Enabled drag and drop to reorder the list of positioners in "editor.designer.PositioningStacksComponent" * Aligned clear button to top of positioner box in "editor.designer.PositioningStacksComponent" * Added tests "tests.test_editor.testEditor.testPositioningStacksComponent" * Replaced defined JSON data with "SAMPLE_IDF" in "tests.test_editor.testEditor.testPositioningStacksComponent" * Added tests for "Add" and "Clear" buttons to "tests.test_editor.testEditor.testPositioningStacksComponent" * Changed the positioner field to an editable combobox in "editor.designer.PositioningStacksComponent". This includes a new routine "setNewPositioner" and updates to "addNewItem" and "clearList" * Added tests for adding a new positioner to "tests.test_editor.testEditor.testPositioningStacksComponent" * Added code to "editor.designer.PositioningStacksComponent.addNewItem()" that removes duplicate positioners from the stack. * Added Class "editor.designer.PositionersComponent" and its "__init__()" method * Added new method "editor.designer.PositionersComponent.__required_comboboxes" * Added new method "editor.designer.PositionersComponent.reset()" * Added new method "editor.designer.PositionersComponent.validate()" * Added new method "editor.designer.PositionersComponent.addJoints()" and connected "Clear" button to the "clear()" slot * Added new method "editor.designer.PositionersComponent.updateValue()" * Added new method "editor.designer.PositionersComponent.value()" * Added code to "editor.view" to display the positioners component * BUG FIX in "editor.designer.PositionersComponent.updateValue()" -- made sure to get base and tool values from positioner data * Added code to "editor.designer.PositionersComponent" to align the "Add Joints" and "Clear" buttons correctly * BUG FIX in "editor.designer.PositionersComponent" -- variable name "joints_list" applied throughout the Class * Added code to set base and tool values to zero in "editor.designer.PositionersComponent.reset()" * Added Class "editor.designer.JointSubComponent" and its "__init__()" method * Added methods "editor.designer.JointSubComponent.__required_widgets" and "__required_comboboxes" * Added method "editor.designer.JointSubComponent.reset()" * Added method "editor.designer.JointSubComponent.validate()" * Added code to "editor.designer.JointSubComponent.__init__()" to handle changing the joint component and fixed typos in "__required_widgets()" * Added method "editor.designer.JointSubComponent.updateValue()" * Added method "editor.designer.JointSubComponent.value()" * Added code to "editor.designer.PositionerComponent" to display the joint subcomponent * Added code to "editor.designer.JointsSubComponent.updateValue()" to ensure parent and child comboboxes are correctly defined. Also tidied up combobox code in Positioning Stacks and Positioners components * Added new Class "editor.designer.LinkSubComponent" and its "__init()__" method * Added method "editor.designer.LinkSubComponent.__required_comboboxes" * Added method "editor.designer.LinkSubComponent.reset()" * Added method "editor.designer.LinkSubComponent.validate()" * Added method "editor.designer.LinkSubComponent.updateValue()" * Added method "editor.designer.LinkSubComponent.value()" * Added code to "editor.designer.PositionerComponent" to display the link subcomponent * Added code to "editor.designer.PositionerComponent" to display the object and link subcomponents using an accordion widget * Reduced size of list widget in "editor.designer.PositionerComponent" and removed surrounding boxes for "JointSubComponent" and "LinkSubComponent" * Added code to "editor.designer.Designer" to ensure global stretch factor is applied to all components except the positioner * Added push button "remove" and new method "editor.designer.JointSubComponent.removeJoint" * Added code to populate the custom order box in "editor.designer.PositionersComponent.updateValue()" * Used a deepcopy of the JSON in the call to "joints.updateValue()" in "editor.designer.PositionersComponent.updateValue()" so deleting joints is not permanent * Used a deepcopy of the JSON in the call to "links.updateValue()" in "editor.designer.PositionersComponent.updateValue()" so deleting links is not permanent. Also added "remove" button and "removeLink()" method to the "LinkComponent" * Added code to "editor.designer.PositionersComponent.updateValue()" to remove joints from the custom order box if they are removed from the Joints subcomponent. * Removed validating the visual subcomponent from "editor.designer.LinkSubComponent.validate()" because the visual object is optional in this case. * Added basic tests "tests.test_editor.testEditor.testPositionersComponent" * Added tests to ensure removed joints and links are restored if the positioner is reselected to "tests.test_editor.testEditor.testPositionersComponent" * Added tests "tests.test_editor.testEditor.testJointSubComponent". Also fixed bug by removing unnecessary call to "updateValue()" when adding new entries * Added tests "tests.test_editor.testEditor.testLinkSubComponent" * Added code to "editor.designer.PositionersComponent.validate()" to display accordion panes if they are invalid * Edited "editor.designer.PositionersComponent.value()" to ensure the custom order of joints for a positioner is updated when a joint is removed in the joint subcomponent * Edited "editor.designer.PositionersComponent.addJoints()" to preserve a custom order of joints is one is defined * Added routine "editor.designer.PositionersComponent.updateJointsList()" to remove repetition in Class routines * From Stephen - Added routine "core.util.widgets.Accordion.removePane()" and edited "core.util.widgets.Accordion.clear()" * From Stephen - Redesigned "editor.designer.PositionersComponent" to enable joints and links to be added to the JSON * BUG FIX - moved a statement to reset the name combobox from "editor.designer.PositioningStacksComponent.reset()" to "editor.designer.PositioningStacksComponent.updateValue()". * Added code to open invalid accordion panes in "editor.designer.PositioningStacksComponent.validate()". * Added code to ensure custom order box is updated when joints are added and removed, and joint names are updated when we write to the JSON. * Added code to "editor.designer.PositionersComponent.updateValue()" to update pane labels to joint/link names. * BUG FIX -- Added code to "editor.designer.PositionersComponent.removeLink()" and "removeJoint()" to traverse the list in reverse order and prevent out of sync indices. * Added code to "editor.designer.PositionersComponent.removeLink()" and "removeJoint()" to keep pane labels as joint/link names where possible * Added tests to "tests.test_editor.testPositionersComponent.()" to reflect the changes in the design of the component. * Addressed review comments. --------- Co-authored-by: PaulSharp <[email protected]>
- Loading branch information