kcjengr / qtpyvcp

QtPyVCP - Qt and Python based Virtual Control Panel framework for LinuxCNC.
https://www.qtpyvcp.com
Other
88 stars 48 forks source link

Allow ability for a user of a UI to add one or more custom UI panels #119

Open joco-nz opened 1 year ago

joco-nz commented 1 year ago

Similar to the feature available in pyvcp UI designer could allow for the ability to add/insert in a user designed/define UI panel.

Concept: This would be a UI file/python handler mix that could be dynamically loaded on UI start and added to some specified part of the master UI. The easiest example is a TabWidget gets a new tab holding this user loaded UI.

The specification for where this is loaded could be via custom config yaml file in the machines config dir or it could be (as pyvcp does) entries in the ini file.

Pyvcp allows for flexibility to embed more than just QT UI's. I am not sure that is necessary or desirable. Especially from a support angle. But perhaps worth considering.

KurtJacobson commented 1 year ago

I did some work on support for embedded UIs, that might be adaptable for this purpose: https://github.com/kcjengr/qtpyvcp/compare/main...embeded_ui

As it stands, it should be possible to insert a custom UI anywhere in the VCP by pointing the mainwindow:provider in the YAML to a custom python file in the machine config dir, that inherits the original VCPs VCPMainWIndow class. In this class, load the original UI file, get a reference to the widget to embed in, and add the embedded UI as a child. I did have an example of this approach, will see if I can find it.

Would be excellent to have these methods documented, or better yet, a more streamlined method.