SHA2017-badge / micropython-esp32

MicroPython ported to the SHA2017 badge
https://micropython.org/
MIT License
12 stars 16 forks source link

Cope better with long package names #216

Open DigitalBrains1 opened 7 years ago

DigitalBrains1 commented 7 years ago

This fixes a large part of the issue SHA2017-badge/Firmware#192 : it spreads long app titles over multiple lines. When the cursor moves, it moves several lines at once for these long names.

Remaining bugs:

I don't readily know how to fix these bugs, which explains them still being there.

Also, the list of installed apps in the launcher suffers from the same issue, I noticed belatedly. So perhaps the better fix is in the C code.

basvs commented 7 years ago

I guess we need to disable the 'center vertically' in C code. This code is then probably a nice addition. Still recovering from SHA2017. Will have a look at this code somewhere in the next days.

DigitalBrains1 commented 7 years ago

I guess we need to disable the 'center vertically' in C code.

I think that would entail changing the gdispGFillStringBox() call to a gdispGDrawString() inside BWgwinListDefaultDraw(), file esp32/ugfx_widgets.c. The background is already cleared I think, so that functionality won't be missed. However, it does mean handling clipping separately and the exact position of the text might need to be changed.

basvs commented 7 years ago

In a long list with multiple multi-line items, the cursor doesn't stay on the screen when scrolling down. (e..g installer -> uncategorised)

Is it possible to select both lines when a multi-line item is selected?

DigitalBrains1 commented 7 years ago

In a long list with multiple multi-line items, the cursor doesn't stay on the screen when scrolling down.

Yes, it is a variation on the theme of the first bug I mentioned in the PR. When you change the selection through "ugfx.List.selected_index(i)", the list is not scrolled like it does when it is moved because of a JOY_UP or JOY_DOWN event. It doesn't seem fixable in Python code, and I haven't studied the related C code in depth.

Is it possible to select both lines when a multi-line item is selected?

The ugfx list widget supports multi-selection, but I don't think the Python bindings support it:https://github.com/SHA2017-badge/micropython-esp32/blob/6756a75ba07d5dcf1e69d5cd70f491950b5561f1/esp32/ugfx_widgets.c#L687

Maybe this whole thing needs to be fixed in the C side, where the selection bar drawing comes for free. PR #221 could be extended to render the multiple lines in C, and draw them selected. Or maybe PR #221 should be the whole fix, just cutting off everything.