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

Add QElidingLineEdit class for elidable QLineEdits #154

Merged
merged 6 commits into from
Aug 3, 2023

Conversation

dalthviz
Copy link
Contributor

Example code:

from superqt import QElidingLineEdit

text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
wdg = QElidingLineEdit(text)
wdg.resize(100, 20)
wdg.show()

Preview:

imagen

eliding_line_edit

closes #152

@dalthviz dalthviz closed this Mar 29, 2023
@dalthviz dalthviz reopened this Mar 29, 2023
@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Patch coverage: 93.10% and project coverage change: -0.52% ⚠️

Comparison is base (6318675) 85.89% compared to head (a98107b) 85.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #154      +/-   ##
==========================================
- Coverage   85.89%   85.38%   -0.52%     
==========================================
  Files          32       35       +3     
  Lines        2644     2702      +58     
==========================================
+ Hits         2271     2307      +36     
- Misses        373      395      +22     
Files Changed Coverage Δ
src/superqt/elidable/_eliding_line_edit.py 86.11% <86.11%> (ø)
src/superqt/elidable/_eliding_label.py 93.93% <93.93%> (ø)
src/superqt/elidable/_eliding.py 97.67% <97.67%> (ø)
src/superqt/__init__.py 100.00% <100.00%> (ø)
src/superqt/elidable/__init__.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tlambert03
Copy link
Member

thank you @dalthviz!

the behavior and tests look great. I'm a bit unhappy with the inheritance pattern at the moment, but I can see that it's nothing you've done wrong (more of an annoyance about the fact the "text-having" parts of QLabel and QLineEdit don't share any inheritance...) It's the fact that we need to have the same methods in the subclasses:

    # appears more or less the same in both subclasses
    def setElideMode(self, mode: Qt.TextElideMode) -> None:
        """Set the elide mode to a Qt.TextElideMode."""
        super().setElideMode(mode)
        super().setText(self._elidedText())

i'd like to play with it briefly to see whether there's anything else I can think of. If not, I might just consider not using the same base class

(don't worry about the pyside6 and napari tests at the moment either)

@dalthviz
Copy link
Contributor Author

dalthviz commented Mar 30, 2023

Thank you @tlambert03 for giving this a check! I'm not totally convinced either about the inheritance pattern I did, so happy to get ideas to improve it or removing the base class if it is not worthy to have :)

@tlambert03
Copy link
Member

hey @dalthviz, very sorry about the delay here. Shall we just get this in?
While it's nice to have a clean internal pattern, all I really care about is the public API and tests. we can always iterate on the implementation. So, are you happy with the state of things from that perspective? Is it as you would want to use it over in (e.g.) napari?

@dalthviz
Copy link
Contributor Author

dalthviz commented Aug 3, 2023

Hi @tlambert03 ! No problem! And I think the functionality provided works for what I wanted to achieve over napari indeed, so merging this could be nice 👍

Thank you for checking this again and for sure open to improve in a follow up PR the implementation details as needed!

@tlambert03 tlambert03 merged commit 9119336 into pyapp-kit:main Aug 3, 2023
44 checks passed
@tlambert03 tlambert03 added the enhancement New feature or request label Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Add elided QLineEdit class
2 participants