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

gui: fix custom color support UI rendering issues #2666

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

Conversation

fsagbuya
Copy link
Contributor

ARTIQ Pull Request

Description of Changes

Fixes issues with custom color support interfering with normal widget styling:

  • Handle title bar and window colors independently
  • Enhanced reset colors to properly restore default Qt/UI settings
  • Refactored gradient handling to preserve appearance with custom colors
  • Replaced styleSheet with palette for consistent widget styling

Default view on Windows:
image

Default view on Linux (gradient is lighter in pyqt6)
image

Colored View on Linux:
image

Related Issue

Closes #2661

Type of Changes

Type
🐛 Bug fix
🔨 Refactoring

Steps (Choose relevant, delete irrelevant before submitting)

All Pull Requests

  • Use correct spelling and grammar.
  • Close/update issues.
  • Check the copyright situation of your changes and sign off your patches (git commit --signoff, see copyright).

Code Changes

  • Run flake8 to check code style (follow PEP-8 style). flake8 has issues with parsing Migen/gateware code, ignore as necessary.
  • Test your changes or have someone test them. Mention what was tested and how.
    - Tested on Linux and Windows

Git Logistics

  • Split your contribution into logically separate changes (git rebase --interactive). Merge/squash/fixup commits that just fix or amend previous commits. Remove unintended changes & cleanup. See tutorial.
  • Write short & meaningful commit messages. Review each commit for messages (git show). Format:
    topic: description. < 50 characters total.
    
    Longer description. < 70 characters per line
    

Licensing

See copyright & licensing for more info.
ARTIQ files that do not contain a license header are copyrighted by M-Labs Limited and are licensed under LGPLv3+.


def apply_colors(self):
def apply_color(self, key=None):
Copy link
Member

Choose a reason for hiding this comment

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

So the default is not to do anything?

How about breaking this function into two? Most of it is inside that if key ==

@sbourdeauducq
Copy link
Member

Generally seems a bit messy.

@@ -108,7 +135,8 @@ def _get_group(self, key):
return self._groups[key]
group = QtWidgets.QTreeWidgetItem([key])
for col in range(3):
group.setBackground(col, self.palette().mid())
color = getattr(self, 'group_color', self.palette().mid().color())
Copy link
Member

Choose a reason for hiding this comment

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

Something more explicit than this discreetly set group_color attribute would be clearer, more maintainable and less bug-prone.

Copy link
Member

Choose a reason for hiding this comment

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

In general try to avoid creating new attributes anywhere else than the constructor.

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.

Custom color support leads to weird UI rendering
2 participants