Skip to content

fix: Global GUI stylesheet and wrap app execution in main() - #221

Open
q24609962-svg wants to merge 13 commits into
juami:mainfrom
q24609962-svg:newpullrequest
Open

fix: Global GUI stylesheet and wrap app execution in main()#221
q24609962-svg wants to merge 13 commits into
juami:mainfrom
q24609962-svg:newpullrequest

Conversation

@q24609962-svg

@q24609962-svg q24609962-svg commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

closes #198

Global GUI stylesheet: I updated src/GUI/code/main.py to enforce clear, readable colors across all GUI windows (including CV/CA/LSV creators, experiment list, and port dropdown).
Key addition (already in your file now):
app = QApplication(sys.argv)

Global GUI stylesheet: I updated src/GUI/code/main.py to enforce clear, 
readable colors across all GUI windows (including CV/CA/LSV creators, 
experiment list, and port dropdown).
Key addition (already in your file now):
app = QApplication(sys.argv)
@q24609962-svg

Copy link
Copy Markdown
Contributor Author

#198

@sbillinge

Copy link
Copy Markdown
Member

Thanks for this @q24609962-svg

Since we can't write tests for this, please could you post images of the gui in light and dark mode on the different platforms to make sure it is a global fix? If you don't have access to all the platforms let's ask if there are other users who can check that.

q24609962-svg and others added 3 commits February 19, 2026 19:58
Created a new app_setup.py file to centralize the creation of the QApplication and enforce a consistent stylesheet for readable text and background colors. Updated main.py to utilize this new function, streamlining the application setup process. Added a test for the stylesheet to ensure it sets readable colors across GUI components.
Updated the test file to skip tests if PySide6 is not available, ensuring compatibility and preventing import errors. This change enhances the robustness of the test suite when running in environments without PySide6.
@q24609962-svg

Copy link
Copy Markdown
Contributor Author

Sorry I don't have access to all platforms, it will be good for other users to check

@Dbardgett

Copy link
Copy Markdown
Contributor

I tried running this PR on my Macbook and it works pretty well (see attached)! It responds instantly to changing between light mode and dark mode and it fixes an issue for me previously in which text would appear white on a white background when inputting parameters for CA/CV/LSV.
MacOS Dark
MacOS Light

@sbillinge

Copy link
Copy Markdown
Member

This is great, thanks @q24609962-svg . Thanks for the review @Dbardgett .

@q24609962-svg this is failing pre-commit. there is a problem with the linting. You can see what the fail is by clicking through on the failed check. as a good practice when contributing code, we recommend that you install pre-commit locally.

to do this. In your conda environment, install pre-commit

conda install pre-commit

then, in the top level directory of the project run

pre-commit install

to activate it.

It will now do the linting checks each time you make a commit (and prevent the commit if it fails). It slows down the commit process (you will see) but speeds up getting PRs merged.

Please read more detailed information in the documentation of scikit-package (scikit-package.github.io/scikit-package).

Your PR is failing flake8 which requires a manual edit to fix it.

@sbillinge sbillinge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @q24609962-svg please see inline comments.

Comment thread src/GUI/code/main.py
board, d9 = board_objects[0], board_objects[3]

# 'Find Potentiostat'
def find_port():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there are reason you are defining functions inside main()? As a general matter, we would prefer this to be done outside main() so main() is just a script that executes.

Comment thread src/GUI/code/main.py
_load_arduino(ui)
ui.find_potentiostat_button.clicked.connect(find_port)

def disconnect_port():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same comment as above

Comment thread .pre-commit-config.yaml
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: monthly
skip: [no-commit-to-branch]
skip: [no-commit-to-branch, docformatter]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please can you try removing both these skips. We don't want to work around the coding standards and then immortalize it in a merge commit if possible.

@sbillinge sbillinge changed the title What I changed fix: Global GUI stylesheet and wrap app execution in main() Mar 22, 2026
@sbillinge

Copy link
Copy Markdown
Member

@q24609962-svg I wonder if it makes sense to close this and put these nice edits on a clean PR because of the large changes on the GUI codebase?

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.

fix: Text same color as background

3 participants