Skip to content

ptmenu: Refactor the build of the menu

Valentin Valls requested to merge select-dialog into master

This PR is a first step to provide a bit more flexibility to the menus.

Right now the code contains a lot of if-elif-else cases to distinguish each behaviors. That's typically something for OOP.

This PR rework the code as OOP with wrapper classes.

  • Rename DlgWidget as _PtWrapper, that's just an internal private wrapper
  • Split _PtWrapper into different classes (mostly one per UserDlg_)
  • Create BlissDialog.WRAPPERS for the mapping from UserDlg_ to PtWrapper
  • User Container are wrapped the same way
  • Fix issues on UserChoice, .defval was not always properly updated
  • Reduce the scope of some public function/class
    • Some of them was set deprecated for now, just in case
  • Added a test coverage
    • Unfortunately i haven't found a way to launch in an App
    • But this can be launch interactively with pytest tests/shell/test_dialogs.py -s -x --ptmenu

As side result, third party library like ebs-tomo can now add extra components.

Edited by Valentin Valls

Merge request reports