nucleic / enaml

Declarative User Interfaces for Python
http://enaml.readthedocs.io/en/latest/
Other
1.53k stars 130 forks source link

[BUG] Non working examples ? #455

Closed Kochise closed 2 years ago

Kochise commented 2 years ago

Hi, just trying the example files, yet some are acting "weird" :

enaml-main\examples\styling\banner.enaml

The dark gradient is way too dark to see it is actually a gradient. Use this instead :

'stop: 0 #1356A9, stop: 0.3 #8AAFDC, stop: 0.58 #E0E4E0, stop: 0.68 #F8D8B1, stop: 0.848 #D39B8A, stop: 0.8499 #9C7F73, stop: 0.85 #D79F88, stop: 0.851 #E2BF9B, stop: 1 #817F73)'

enaml-main\examples\templates\basic.enaml

ok_clicked and cancel_clicked are obviously not handled like intended, nothing is printed into the console.

enaml-main\examples\widgets\buttons.enaml

While selecting RadionButton from the second container (two lowest radios) you can unselect radios from the first container.

enaml-main\examples\widgets\dual_slider.enaml

Sliders' tab are way too tiny :

slider_tabs

enaml-main\examples\widgets\file_dialog.enaml

The file dialog opens relatively to its parent window (or not, even when parent=None). How is it possible to open the dialog always on screen which is the parent window yet centered ? Or best, save its position and last path for next time.

enaml-main\examples\widgets\flow_area.enaml

Item(FlowItem).Html doesn't show up until 'Ortho Stretch' is at least 1 and up or 'Preferred Height' is at least 173 and up.

enaml-main\examples\widgets\image_view.enaml

The motion of the ImageView is pretty weird because related of the spacer's width. Even if the window's height is high enough, if its width is narrowed the image goes up.

enaml-main\examples\widgets\mdi_area.enaml

Tiling : get 3 mdi windows, tile them, move the top left and top right around, tile them again, the title bar of the top right window is not redrawn correctly.

Cascading : get 3 mdi windows, cascade them, move the top left one around, cascade them again, the middle one gets buried. I mean, the position should be set to top alternatively so that we can read every title bar like the first time. Btw, is there a way to define the horizontal and vertical spacing of the tiled windows ?

mdi_area

enaml-main\examples\layout\basic\stack.enaml

Maybe there should be one.

enaml-main\examples\tutorial\plugin\plugin.enaml

Maybe there should be one.

enaml-main\examples\tutorial\scintilla\scintilla.enaml

Maybe there should be one.

MatthieuDartiailh commented 2 years ago

Thanks for your report. Can you let me know on what OS you are running, the enaml and Qt version and how you installed enaml ?

Kochise commented 2 years ago

Windows 10 20H2 (19042.1165) AeroLite theme Python 3.7.9 (Spyder 5.1.5) PyQt5 5.12.3 (Spyder 5.1.5) enaml 0.13.0

MatthieuDartiailh commented 2 years ago

Thanks I will have a look at those tomorrow.

Note that the flow area one may be fixed in main (see #448)

MatthieuDartiailh commented 2 years ago

Hi, just trying the example files, yet some are acting "weird" :

enaml-main\examples\styling\banner.enaml

The dark gradient is way too dark to see it is actually a gradient. Use this instead :

'stop: 0 #1356A9, stop: 0.3 #8AAFDC, stop: 0.58 #E0E4E0, stop: 0.68 #F8D8B1, stop: 0.848 #D39B8A, stop: 0.8499 #9C7F73, stop: 0.85 #D79F88, stop: 0.851 #E2BF9B, stop: 1 #817F73)'

I agree it is too dark (maybe related to windows theme), I will update it.

enaml-main\examples\templates\basic.enaml

ok_clicked and cancel_clicked are obviously not handled like intended, nothing is printed into the console.

This has been fixed as part of #445 and will be part of the next release.

enaml-main\examples\widgets\buttons.enaml

While selecting RadionButton from the second container (two lowest radios) you can unselect radios from the first container.

I can reproduce and it is indeed very weird. I will have to investigate more.

enaml-main\examples\widgets\dual_slider.enaml

Sliders' tab are way too tiny :

slider_tabs

This I cannot reproduce. image

enaml-main\examples\widgets\file_dialog.enaml

The file dialog opens relatively to its parent window (or not, even when parent=None). How is it possible to open the dialog always on screen which is the parent window yet centered ? Or best, save its position and last path for next time.

Enaml relies on the backend implementation there and does not expose those "advanced" (i.e. no provided by the Qt static methods) features. It may be possible to hack around though by using a lower level API on the Qt side.

enaml-main\examples\widgets\flow_area.enaml

Item(FlowItem).Html doesn't show up until 'Ortho Stretch' is at least 1 and up or 'Preferred Height' is at least 173 and up.

The resist_height was set to weak which caused the widget to fully collapsed. I will remove it since the example will be more illustrative this way.

enaml-main\examples\widgets\image_view.enaml

The motion of the ImageView is pretty weird because related of the spacer's width. Even if the window's height is high enough, if its width is narrowed the image goes up.

I agree it is weird. The simplest would be to set the hug_width of the image to strong to prevent the window from being resized. I believe other wise the system is underconstrained.

enaml-main\examples\widgets\mdi_area.enaml

Tiling : get 3 mdi windows, tile them, move the top left and top right around, tile them again, the title bar of the top right window is not redrawn correctly.

Cascading : get 3 mdi windows, cascade them, move the top left one around, cascade them again, the middle one gets buried. I mean, the position should be set to top alternatively so that we can read every title bar like the first time. Btw, is there a way to define the horizontal and vertical spacing of the tiled windows ?

mdi_area

Here again we simply directly use Qt functionalities and they do not appear to offer ways to be customized so not sure what we can do.

enaml-main\examples\layout\basic\stack.enaml

Maybe there should be one.

enaml-main\examples\tutorial\plugin\plugin.enaml

Maybe there should be one.

enaml-main\examples\tutorial\scintilla\scintilla.enaml

Maybe there should be one.

You are welcome to contribute extra examples

MatthieuDartiailh commented 2 years ago

See #457 for some improvements

Kochise commented 2 years ago

Thank, seems good, I'll check how it behaves IRL tomorrow.

I'll contribute to more examples, yet I'm still learning enaml the hard way (reading source code).

I'm actually summing up things (doc, hierarchy, dependencies) into a WIP "template" file, btw could you review it ?

https://github.com/Kochise/enaml-studio/blob/main/enaml-api.py

I let you find out the "syntax" describing the relationships and/or alternatives in the "trees".

Kochise commented 2 years ago

enaml-main\examples\widgets\dual_slider.enaml Sliders' tab are way too tiny : slider_tabs

This I cannot reproduce. image


Weird, I tried the normal Windows theme :

dual_slider_normal

I then switched to Aero Lite theme :

dual_slider_lite

I closed the program and reopened it :

dual_slider_lite_reopen

Hence it's not the Aero Lite theme per se, as when switching from normal theme works, yet something is definitively not right.

MatthieuDartiailh commented 2 years ago

That is definitively a weird one. Can you try making a pure Qt reproducer ? I am wondering if we are miscalling Qt or if it is a kind of Qt bug.

Kochise commented 2 years ago

"Pure Qt reproducer" ? You mean native C++ or PyQt5 ? Since I'm using (forced to by Spyder) an "outdated" version, maybe it is the version I'm using that is at fault. Yet, it is strange indeed.

MatthieuDartiailh commented 2 years ago

No I meant PyQt5 (or pyside2). 5.12 is not that bad actually some people are still on 5.9

Kochise commented 2 years ago

Ok, so I did it the "naive" way and here's what I found.

I tried the normal Windows theme :

dual_slider_pyqt5_normal

I then switched to Aero Lite theme :

dual_slider_pyqt5_lite

I closed the program and reopened it :

dual_slider_pyqt5_lite_reopen

As you can see, there's definitively something going on about the size of slider's elements. It's like they are squished. Yet it only happens at initial loading using Aero Lite theme's elements, despite looking good with normal Windows theme elements' size.

Yet it looks different from Enaml's implementation.

dual_slider_pyqt5.py.txt

MatthieuDartiailh commented 2 years ago

The one difference I see is that your set the ticks to show on both sides. I suspect that if you use single sided ticks you will recover enaml behavior. It may be worth reporting the issue directly on Qt bug tracker.

Kochise commented 2 years ago

Oopsie.

dual_slider_pyqt5_tickbelow_normal

dual_slider_pyqt5_tickbelow_lite

dual_slider_pyqt5_tickbelow_lite_reopen

dual_slider_pyqt5_tickbelow.py.txt

So it definitively lies on the PyQt5 side.

MatthieuDartiailh commented 2 years ago

Closing since the issue stems from Qt5 not enaml.