From 68532b0e50d2dd611879935d0ab3d64b060ea431 Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Wed, 14 Jul 2021 23:50:42 +0100 Subject: [PATCH 1/4] __main__: Add darkMode property to QApplication --- Orange/canvas/__main__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Orange/canvas/__main__.py b/Orange/canvas/__main__.py index f4c265918bc..d374c52e7da 100644 --- a/Orange/canvas/__main__.py +++ b/Orange/canvas/__main__.py @@ -560,6 +560,9 @@ def onrequest(url): stylesheet_string = pattern.sub("", stylesheet_string) + if 'dark' in stylesheet: + app.setProperty('darkMode', True) + else: log.info("%r style sheet not found.", stylesheet) From 1c8e3e96ed8b5d70b58f58f835a766916ad62a17 Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Thu, 18 Feb 2021 22:08:09 +0000 Subject: [PATCH 2/4] __main__: Set pyqtgraph colors from QPalette --- Orange/canvas/__main__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Orange/canvas/__main__.py b/Orange/canvas/__main__.py index d374c52e7da..9b23b78aad7 100644 --- a/Orange/canvas/__main__.py +++ b/Orange/canvas/__main__.py @@ -457,6 +457,20 @@ def main(argv=None): app.setPalette(breeze_dark()) defaultstylesheet = "darkorange.qss" + # set pyqtgraph colors + def onPaletteChange(): + p = app.palette() + bg = p.base().color().name() + fg = p.windowText().color().name() + + log.info('Setting pyqtgraph background to %s', bg) + pyqtgraph.setConfigOption('background', bg) + log.info('Setting pyqtgraph foreground to %s', fg) + pyqtgraph.setConfigOption('foreground', fg) + + app.paletteChanged.connect(onPaletteChange) + onPaletteChange() + palette = app.palette() if style is None and palette.color(QPalette.Window).value() < 127: log.info("Switching default stylesheet to darkorange") From 9f6048d450783feca462536675719509bcae0437 Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Wed, 14 Jul 2021 23:54:07 +0100 Subject: [PATCH 3/4] owpalette: Remove pyqtgraph colors set on global import --- Orange/widgets/utils/plot/owpalette.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Orange/widgets/utils/plot/owpalette.py b/Orange/widgets/utils/plot/owpalette.py index 9c58c29947c..19112fa1570 100644 --- a/Orange/widgets/utils/plot/owpalette.py +++ b/Orange/widgets/utils/plot/owpalette.py @@ -5,8 +5,6 @@ __all__ = ["create_palette", "OWPalette"] -pg.setConfigOption('background', 'w') -pg.setConfigOption('foreground', 'k') pg.setConfigOptions(antialias=True) From 6f58628f7880332ab0577105ff4b99887eabd84a Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Thu, 15 Jul 2021 01:02:53 +0100 Subject: [PATCH 4/4] pylint --- Orange/canvas/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Orange/canvas/__main__.py b/Orange/canvas/__main__.py index 9b23b78aad7..809ebf5a1ba 100644 --- a/Orange/canvas/__main__.py +++ b/Orange/canvas/__main__.py @@ -337,7 +337,7 @@ def send_statistics(url): r = requests.post(url, files={'file': json.dumps(data)}) if r.status_code != 200: log.warning("Error communicating with server while attempting to send " - "usage statistics. Status code " + str(r.status_code)) + "usage statistics. Status code %d", r.status_code) return # success - wipe statistics file log.info("Usage statistics sent.")