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

feat: added an amount of good to destinguish colors #2143 #2265

Closed
wants to merge 9 commits into from

Conversation

AryanBakliwal
Copy link
Contributor

@AryanBakliwal AryanBakliwal commented Mar 3, 2024

Purpose of PR?: To add good to distinguish colors

Fixes #2143

The predefined color swatches in QColorDialog are typically determined by the system's color scheme or the default color palette. Unfortunately, PyQt5's QColorDialog does not provide a direct method to modify these predefined color swatches.
I created a custom dialog that mimics the behavior of the QColorDialog to customize the color swatches.

Previous dialog
image

New dialog
image

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

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

Please keep the default we used in options, they are on a lot images already
options

Also Side View has an option dialog with color selection

@ReimarBauer
Copy link
Member

A colleague changed the colors for a plot to

legend_of_flightpathes_in_improved_colors
he improved the intesity of the colors.

@@ -44,11 +44,45 @@
WMS = 0


class CustomColorDialog(QtWidgets.QColorDialog):
Copy link
Member

@ReimarBauer ReimarBauer Mar 6, 2024

Choose a reason for hiding this comment

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

that is now doubling the code lines,

there should be only one definition, you can move it to
mpl_qtwidget and import it then.

@ReimarBauer
Copy link
Member

usually the tests done in 5mins now it gets into a timeout at 10mins. That is a bit strange.

@ReimarBauer
Copy link
Member

ReimarBauer commented Mar 7, 2024

This is not changed in the PR it is shown to solve the test issue.

sigkill on the test where it gets stuck shows:

-------------------------------------------------------------------------------------------- live log sessionfinish ----------------------------------------------------------------------------------------------
MSS Version: 8.3.4
--- Logging error ---
Traceback (most recent call last):
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/logging/__init__.py", line 1113, in emit
    stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
  File "/home/reimar/PycharmProjects/2024/AryanBakliwal/MSS/mslib/utils/qt.py", line 184, in excepthook
    logging.critical("Python Version: %s", sys.version)
Message: 'Python Version: %s'
Arguments: ('3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 18:08:17) [GCC 12.2.0]',)
Python Version: 3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 18:08:17) [GCC 12.2.0]
--- Logging error ---
Traceback (most recent call last):
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/logging/__init__.py", line 1113, in emit
    stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
  File "/home/reimar/PycharmProjects/2024/AryanBakliwal/MSS/mslib/utils/qt.py", line 185, in excepthook
    logging.critical("Platform: %s (%s)", platform.platform(), platform.architecture())
Message: 'Platform: %s (%s)'
Arguments: ('Linux-6.5.0-10022-tuxedo-x86_64-with-glibc2.35', ('64bit', 'ELF'))
Platform: Linux-6.5.0-10022-tuxedo-x86_64-with-glibc2.35 (('64bit', 'ELF'))
--- Logging error ---
Traceback (most recent call last):
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/logging/__init__.py", line 1113, in emit
    stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
  File "/home/reimar/PycharmProjects/2024/AryanBakliwal/MSS/mslib/utils/qt.py", line 186, in excepthook
    logging.critical("Fatal error: %s", tb)
Message: 'Fatal error: %s'
Arguments: ('Traceback (most recent call last):\n  File "/home/reimar/mambaforge/envs/m311env/bin/pytest", line 10, in <module>\n    sys.exit(console_main())\n             ^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/config/__init__.py", line 189, in console_main\n    code = main()\n           ^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/config/__init__.py", line 166, in main\n    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(\n                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_hooks.py", line 433, in __call__\n    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_manager.py", line 112, in _hookexec\n    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_callers.py", line 116, in _multicall\n    raise exception.with_traceback(exception.__traceback__)\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_callers.py", line 80, in _multicall\n    res = hook_impl.function(*args)\n          ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/main.py", line 317, in pytest_cmdline_main\n    return wrap_session(config, _main)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/main.py", line 305, in wrap_session\n    config.hook.pytest_sessionfinish(\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_hooks.py", line 433, in __call__\n    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_manager.py", line 112, in _hookexec\n    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_callers.py", line 133, in _multicall\n    teardown[0].send(outcome)\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/terminal.py", line 857, in pytest_sessionfinish\n    outcome.get_result()\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_result.py", line 108, in get_result\n    raise exc.with_traceback(exc.__traceback__)\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_callers.py", line 80, in _multicall\n    res = hook_impl.function(*args)\n          ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/xdist/dsession.py", line 92, in pytest_sessionfinish\n    nm.teardown_nodes()\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/xdist/workermanage.py", line 81, in teardown_nodes\n    self.group.terminate(self.EXIT_TIMEOUT)\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/execnet/multi.py", line 214, in terminate\n    safe_terminate(\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/execnet/multi.py", line 310, in safe_terminate\n    reply.get()\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/execnet/gateway_base.py", line 282, in get\n    self.waitfinish(timeout)\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/execnet/gateway_base.py", line 289, in waitfinish\n    if not self._result_ready.wait(timeout):\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/threading.py", line 622, in wait\n    signaled = self._cond.wait(timeout)\n               ^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/threading.py", line 320, in wait\n    waiter.acquire()\nKeyboardInterrupt\n',)
Fatal error: Traceback (most recent call last):
  File "/home/reimar/mambaforge/envs/m311env/bin/pytest", line 10, in <module>
    sys.exit(console_main())
             ^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/config/__init__.py", line 189, in console_main
    code = main()
           ^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/config/__init__.py", line 166, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_hooks.py", line 433, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_manager.py", line 112, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_callers.py", line 116, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_callers.py", line 80, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/main.py", line 317, in pytest_cmdline_main
    return wrap_session(config, _main)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/main.py", line 305, in wrap_session
    config.hook.pytest_sessionfinish(
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_hooks.py", line 433, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_manager.py", line 112, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_callers.py", line 133, in _multicall
    teardown[0].send(outcome)
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/_pytest/terminal.py", line 857, in pytest_sessionfinish
    outcome.get_result()
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_result.py", line 108, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/pluggy/_callers.py", line 80, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/xdist/dsession.py", line 92, in pytest_sessionfinish
    nm.teardown_nodes()
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/xdist/workermanage.py", line 81, in teardown_nodes
    self.group.terminate(self.EXIT_TIMEOUT)
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/execnet/multi.py", line 214, in terminate
    safe_terminate(
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/execnet/multi.py", line 310, in safe_terminate
    reply.get()
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/execnet/gateway_base.py", line 282, in get
    self.waitfinish(timeout)
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/site-packages/execnet/gateway_base.py", line 289, in waitfinish
    if not self._result_ready.wait(timeout):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/threading.py", line 622, in wait
    signaled = self._cond.wait(timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/mambaforge/envs/m311env/lib/python3.11/threading.py", line 320, in wait
    waiter.acquire()
KeyboardInterrupt

QWidget: Must construct a QApplication before a QWidget
Aborted

@ReimarBauer ReimarBauer requested a review from matrss March 10, 2024 05:22
Comment on lines +140 to +145
Colors
------

We utilize custom colors for distinguishing routes using the color palette provided by SashaMaps.
Link: https://sashamaps.net/docs/resources/20-colors/

Copy link
Collaborator

Choose a reason for hiding this comment

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

This was inserted in the middle of the "Identity Provider" section, i.e. above and below is stuff about pysaml2. It should not split that section.

Comment on lines +76 to +77
def getColor(self, button):
return QtGui.QPalette(button.palette()).color(QtGui.QPalette.Button)
Copy link
Collaborator

@matrss matrss Mar 11, 2024

Choose a reason for hiding this comment

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

This seems to do something different than the default getColor method of QColorDialog that is being overridden. Is it possible to drop this and use the class as CustomColorDialog.getColor(colour), i.e. how the QColorDialog class was previously used as well?

The CI timeout is happening because some tests mock the QColorDialog.getColor method, which now no longer works as intended and instead leaves the widget open, which blocks the tests from finishing.

@ReimarBauer
Copy link
Member

the issue was solved differently during GSOC-2024

@ReimarBauer ReimarBauer closed this Aug 2, 2024
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.

provide an amount of good to destinguish colors
3 participants