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

PR: qta-browser update #233

Merged
merged 8 commits into from
Nov 24, 2023
Merged

Conversation

pedromorgan
Copy link

Some qta-browser updates to make gui nicer.

  • A toolbar at top with actions
  • make stuff persist with qsettings

Hidden Motive

  • End goal is to "embed as widget in app" and let clients decide their own icons and colors ;-)

image

commit aabecef
Author: pedromorgan@gmail.com <--replace-all>
Date:   Thu May 4 22:42:59 2023 +0100

    GUI improvements for necessitarty

commit 779fde3
Author: pedromorgan@gmail.com <--replace-all>
Date:   Thu May 4 22:27:08 2023 +0100

    clear button

commit f47909f
Author: pedromorgan@gmail.com <--replace-all>
Date:   Thu May 4 22:10:25 2023 +0100

    toolbar group

commit 6314863
Author: pedromorgan@gmail.com <--replace-all>
Date:   Thu May 4 21:38:40 2023 +0100

    toolbar

commit 6009b48
Author: pedromorgan@gmail.com <--replace-all>
Date:   Thu May 4 21:16:24 2023 +0100

    cols and settings

commit 22d6cc3
Author: pedromorgan@gmail.com <--replace-all>
Date:   Thu May 4 20:42:23 2023 +0100

    add cols size coil
@dalthviz dalthviz changed the title qta-browser update PR: qta-browser update May 16, 2023
@dalthviz
Copy link
Member

Hi @pedromorgan thank you for your interest in improving the icon browser! I think the idea behind the changes makes sense but just in case, what do you think @ccordoba12 ?

Also, if this go forward I think we should update the screenshot for the icon browser and maybe expand a little bit the README section about it (maybe including info about the settings that are persisted between launches?) and of course fix the failing tests :)

Thank you again for your interest in improving QtAwesome @pedromorgan !

@pedromorgan
Copy link
Author

hi @dalthviz, thanks for reply... and an updates patch

  • fixed the tests
  • removed settings, cos its not really necessary, as before

@ccordoba12
Copy link
Member

I looks good to me too, thanks @pedromorgan for your contribution!

@pedromorgan
Copy link
Author

Just updated screenshot

Ready for merge.. TIA

@pedromorgan
Copy link
Author

@dalthviz @ccordoba12 How does this review work?

@dalthviz
Copy link
Member

dalthviz commented Jun 13, 2023

Hi @pedromorgan sorry for the late response! Just approved the run of the CI to check that the tests are passing (and seems like everything is green now 🎉 ) and now we will give this a more thoughtful review 👍

Just in case, after a quick check, looks like maybe the only couple of things I would say needs to be changed are:

  • The icon of the window - Although pandas are nice, maybe using the fa5s.icons or fa5b.font-awesome icon could be better:

image

image

  • Maybe the number of default columns (maybe to 6 or 8), since from the screenshot 10 seems like to much.

Anyhow, I would check this locally too as part of the review and maybe then the things above could not be so interesting to do or maybe some other suggestions could appear.

@dalthviz dalthviz self-requested a review June 13, 2023 00:35
@dalthviz dalthviz added this to the v1.3.0 milestone Jun 13, 2023
@pedromorgan
Copy link
Author

@dalthviz fixed the icon...

Re columns, am using 30 across on a big screen.. the main reason I hacked in the first place..

@dalthviz
Copy link
Member

Re columns, am using 30 across on a big screen.. the main reason I hacked in the first place..

Checked locally and actually I think the default columns number is okay 👍 However, the window minimum size is kind of big (at least for my screen) so probably we will need to reduce it a little bit. Locally I'm seeing:

browser

I will leave some suggestions as a review to change the minimum size and some other little nitpicks (like the clear icon and maybe using tooltips instead of the addition of the ToolBarGroup class/instances as titles)

@pedromorgan
Copy link
Author

@dalthviz Done.. Fixed to minimum screen size ;-)))))))))))))

Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

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

Thank you again @pedromorgan for the work here! Left some initial comments regarding the widgets properties, move the list with possible number of columns to be a constant and also a way to simplify the code to clear the filter line edit.

Probably the biggest change that I propose in this review is to drop the usage of the custom class ToolBarGroup and just set tooltips for the different widgets, but let me know what do you think!

Comment on lines +76 to +81
buttClear = QtWidgets.QToolButton()
buttClear.setAutoRaise(True)
buttClear.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
buttClear.setIcon(qtawesome.icon("mdi.alpha-x"))
buttClear.clicked.connect(self._clearClicked)
tbgFont.addWidget(buttClear)
Copy link
Member

Choose a reason for hiding this comment

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

Thinking about this, I think the clear button logic can be removed and instead we could use here the QLineEdit setClearButtonEnabled method: https://doc.qt.io/qt-6/qlineedit.html#clearButtonEnabled-prop

So adding a line for the _lineEditFilter like:

self._lineEditFilter.setClearButtonEnabled(True)

Instead of the extra widget for the button. With this change you should be able to see something like:

filter

tbcols = ToolBarGroup("Columns")
toolbar.addWidget(tbcols)
self._combo_cols = QtWidgets.QComboBox(self)
for idx, no in enumerate([5, 8, 10, 15, 20, 25, 30]):
Copy link
Member

Choose a reason for hiding this comment

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

Lets move move this list with the possible values for the number of columns to a constant. Something like NUM_COLUMNS_OPTIONS = [5, 8, 10, 15, 20, 25, 30] or maybe even NUM_COLUMNS_OPTIONS = [5, 10, 15, 20, 25, 30] since now the the default is 5


self._nameField = QtWidgets.QLineEdit(self)
self._nameField.setAlignment(QtCore.Qt.AlignCenter)
self._nameField.setReadOnly(True)
self._nameField.setFixedWidth(250)
Copy link
Member

Choose a reason for hiding this comment

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

Lets change this fixed width to be a maximum width so when resizing the window to the minimum size widgets don't overlap:

Suggested change
self._nameField.setFixedWidth(250)
self._nameField.setMaximumWidth(250)

tbgFont.addWidget(self._comboFont)

self._lineEditFilter = QtWidgets.QLineEdit(self)
self._lineEditFilter.setFixedWidth(200)
Copy link
Member

Choose a reason for hiding this comment

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

Lets change this fixed width to be a maximum width so when resizing the window to the minimum size widgets don't overlap:

Suggested change
self._lineEditFilter.setFixedWidth(200)
self._lineEditFilter.setMaximumWidth(200)

tbgFont = ToolBarGroup("Filter")
toolbar.addWidget(tbgFont)
self._comboFont = QtWidgets.QComboBox(self)
self._comboFont.setFixedWidth(75)
Copy link
Member

Choose a reason for hiding this comment

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

Lets change this fixed width to be a maximum width so when resizing the window to the minimum size widgets don't overlap:

Suggested change
self._comboFont.setFixedWidth(75)
self._comboFont.setMaximumWidth(75)


# selected group
tbgSelected = ToolBarGroup("Selected")
toolbar.addWidget(tbgSelected)
Copy link
Member

Choose a reason for hiding this comment

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

Lets add some stretch here to enable the line edit to expand until reaching its maximum width when needed:

Suggested change
toolbar.addWidget(tbgSelected)
toolbar.addWidget(tbgSelected, stretch=10)


# filter group
tbgFont = ToolBarGroup("Filter")
toolbar.addWidget(tbgFont)
Copy link
Member

Choose a reason for hiding this comment

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

Lets add some stretch here to enable the line edit to expand until reaching its maximum width when needed:

Suggested change
toolbar.addWidget(tbgFont)
toolbar.addWidget(tbgFont, stretch=10)

@@ -260,6 +311,31 @@ def data(self, index, role):
return super().data(index, role)


class ToolBarGroup(QtWidgets.QWidget):
Copy link
Member

Choose a reason for hiding this comment

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

Regarding this custom widget to add titles, what do you think if instead we just add tooltips to the relevant widgets so people can check/understand what they do?

So for example for the line edit that filters the icons:

filter

For the text for each element, it could be something like:

  • Font combobox: Select fonts prefix which icons will be included in the filtering
  • Filter line edit: Filter icons by name
  • Selected icon line edit: Full identifier of the currently selected icon
  • Copy button: Copy selected icon full identifier to the clipboard
  • Theme combobox: Select color palette for the icons and the icon browser
  • Columns combobox: Select number of columns the icons list is showing

"""
Ensure the filter UX works
What happens if a `penguin`
Copy link
Member

Choose a reason for hiding this comment

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

Lets rewrite this to:

Suggested change
What happens if a `penguin`
Ensure the filter UX works when searching for `penguin`


def test_filter_fail(qtbot, browser):
"""
What happens if a `not a penguin-penguin`
Copy link
Member

@dalthviz dalthviz Jun 21, 2023

Choose a reason for hiding this comment

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

Lets rewrite this to be:

Suggested change
What happens if a `not a penguin-penguin`
Ensure the filter doesn't show results if the filter text doesn't match any icon

@dalthviz dalthviz removed this from the v1.3.0 milestone Jun 21, 2023
@ccordoba12
Copy link
Member

@pedromorgan, may I ask: why did you decide to close this pull request? We can help you finish it, if that's ok for you.

@pedromorgan
Copy link
Author

Because I got better things to do than fix some review on code style etc. Also this is the first time in the discussion that a lot of the topics are brought up.

The time spent doing the review, could have been spent fixing the code itself.

So am not going to waste my time.. TA

@pedromorgan pedromorgan reopened this Jun 22, 2023
@pedromorgan
Copy link
Author

I understand your role now.. A pointless job..

  • So instead of actually doing things,
  • instead telling people to do things..
  • instead of doing it themselves...

AFAIK..

  • u should have merges it in your own branch
  • clean it up to "YOUR" taste
  • and then commit to main and job done..
  • fingers crossed and job done

This explains a lot why foss project stall..

  • and ultimately fork
  • over a trivial issue

@pedromorgan
Copy link
Author

@dalthviz has spent more time revieing my code, that actually correct the errors within...

There is a weed in the garden

  • I propose to remove it...
  • No wait. .need to check first with code review

@dalthviz
Copy link
Member

I'm sorry @pedromorgan if the way I reviewed the PR frustated you. Just until yestarday I was able to make time to give a full review and it ended up having more changes/suggestions than I initially though. I still think that the work here is worthy to be finished and merged so if you are okay I can help finish the PR so it can be merged.

Again, truly sorry if the review process was not what you expected to be. By no means I wanted you to feel bad or frustated with this PR.

@pedromorgan
Copy link
Author

@derek-rein Why not just merge this, and go and fix it.. TIA.. ;-))))

  • U spent more time on review, instead of taking the "kinda way i see it".. to fit your review ideals
  • instead of merging it,, and then fixing it... even though my version is better than original > its now ever better..

Move faster please... and let ideas flow... Think more like a carpenter and wood rather than code..

@ccordoba12 ccordoba12 merged commit 0f41ce5 into spyder-ide:master Nov 24, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants