BCDA-APS / gemviz

Data visualization for tiled
https://bcda-aps.github.io/gemviz/
Other
4 stars 0 forks source link

use custom Qt widgets in designer #133

Closed prjemian closed 1 year ago

prjemian commented 1 year ago

It would be nice if ...

... the custom widgets defined here (such as DateTimeRangeSlider or RangeSlider) by Python code could be used in other widgets in the Qt Designer.

prjemian commented 1 year ago

The PyDM package has a factory method to assist in doing the same with the PyDM custom widgets.

prjemian commented 1 year ago

references:

Instructions for QVideoWidget:

  1. Add regular QWidget to the form.
  2. Select Promote to from the added widget context menu.
  3. In the dialog put QVideoWidget as Promoted class name, Header file should automatically become qvideowidget.h.
  4. Click Add, and then Promote. Now you have QVideoWidget on your form.
prjemian commented 1 year ago

Tried this in date_time_range_slider.ui, for RangeSlider. After clicking the Add button, the Promote became enabled. This actually worked!

prjemian commented 1 year ago

The range_slider.h file is fictitious. Not sure why it did not raise a FileNotFound exception.

prjemian commented 1 year ago

With this change, these lines are no longer needed:

https://github.com/BCDA-APS/gemviz/blob/a9a88c27e891d572fa465d8fb23b9e89cb0cb0e8/gemviz/date_time_range_slider.py#L9

https://github.com/BCDA-APS/gemviz/blob/a9a88c27e891d572fa465d8fb23b9e89cb0cb0e8/gemviz/date_time_range_slider.py#L81-L85

prjemian commented 1 year ago

Similarly, promote when the DateTimeRangeSlider (a QWidget, actually) is used. Exact file name will change with the MVC refactor PR #128.

prjemian commented 1 year ago

Widget promotion is the correct choice in this case, since these widgets are used only in our own code. The methods used by the PyDM package apply to widgets from the package that will be used by other code, not the case here.

prjemian commented 1 year ago

Will wait for #128 before starting this work.