Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cope better with long package names #216

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DigitalBrains1
Copy link

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:

  • If moving to a package below a long package, and the package moved to is partly out of view, the list does not scroll to get it fully in view.
  • Even though it appears that ugfx computes ugfx.get_string_width() the same way (hunting down a few function calls in the C code), adding the widths of ugfx.get_char_width() together still sometimes produces overly long strings, for instance for this package:
    ;;)''2303211-2194523023klfrsdkfdlk;df;;''''{}{}{[[]]]]])))(()_)}}./.,////\\
    (No, that wasn't my cat on the keyboard, that's the name of the package! It's in "uncategorised".)

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.

Remaining bugs;
- If moving to a package below a long package, and the package moved to
  is partly out of view, the list does not scroll to get it fully in view.
- Even though it appears that ugfx computes ugfx.get_string_width() the
  same way, adding the widths of ugfx.get_char_width() together still
  sometimes produces overly long strings, for instance for this package:
    ;;)''2303211-2194523023klfrsdkfdlk;df;;''''{}{}{[[]]]]])))(()_)}}./.,////\\\\
  (No, that wasn't my cat on the keyboard, that's the name of the
  package! It's in "uncategorised")
@basvs
Copy link

basvs commented Aug 10, 2017

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.

@basvs basvs self-assigned this Aug 10, 2017
def move_sel(active,dir_):
if active:
sel = options.selected_index()
print("Ingoing:", sel)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and several other print statements)
This looks like debugging. Do we really need it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yes, I forgot to remove that. Fixed.

@DigitalBrains1
Copy link
Author

DigitalBrains1 commented Aug 13, 2017

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
Copy link

basvs commented Aug 13, 2017

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
Copy link
Author

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:

lst->ghList = gwinListCreate(NULL, &wi, FALSE); //FALSE - no multiselect

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants