Skip to content

Commit

Permalink
darkmode wip
Browse files Browse the repository at this point in the history
  • Loading branch information
irgolic authored and markotoplak committed Mar 6, 2023
1 parent 3ae2386 commit 57ed696
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Orange/canvas/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,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)

Expand Down
12 changes: 11 additions & 1 deletion Orange/widgets/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

NAME = "Data"

ID = "orange.widgets.data"
Expand All @@ -12,6 +13,15 @@

ICON = "icons/Category-Data.svg"

BACKGROUND = "#FFD39F"
from AnyQt.QtGui import QPalette

BACKGROUND = {
'light': {
QPalette.Light: '#febc57',
QPalette.Midlight: '#fe9457',
QPalette.Button: '#fe9057',
},
'plain': "#FFD39F",
}

PRIORITY = 1
12 changes: 11 additions & 1 deletion Orange/widgets/evaluate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
Widgets from Evaluate category
"""

NAME = "Evaluate"

DESCRIPTION = "Evaluate classification/regression performance."

BACKGROUND = "#C3F3F3"
from AnyQt.QtGui import QPalette

BACKGROUND = {
'light': {
QPalette.Light: '#a5ebeb',
QPalette.Midlight: '#5cebeb',
QPalette.Button: '#4be3f2',
},
'plain': "#C3F3F3",
}

ICON = "icons/Category-Evaluate.svg"

Expand Down
11 changes: 10 additions & 1 deletion Orange/widgets/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@

DESCRIPTION = 'Prediction.'

BACKGROUND = '#FAC1D9'
from AnyQt.QtGui import QPalette

BACKGROUND = {
'light': {
QPalette.Light: '#ffbddb',
QPalette.Midlight: '#ff8dc6',
QPalette.Button: '#f175b6',
},
'plain': "#FAC1D9",
}

ICON = 'icons/Category-Model.svg'

Expand Down
11 changes: 10 additions & 1 deletion Orange/widgets/unsupervised/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@

DESCRIPTION = "Unsupervised learning."

BACKGROUND = "#CAE1EF"
from AnyQt.QtGui import QPalette

BACKGROUND = {
'light': {
QPalette.Light: '#aed2d9',
QPalette.Midlight: '#5abced',
QPalette.Button: '#499fd8',
},
'plain': "#CAE1EF",
}

ICON = "icons/Category-Unsupervised.svg"

Expand Down
11 changes: 10 additions & 1 deletion Orange/widgets/visualize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@

DESCRIPTION = "Widgets for data visualization."

BACKGROUND = "#FFB7B1"
from AnyQt.QtGui import QPalette

BACKGROUND = {
'light': {
QPalette.Light: '#f2b6b8',
QPalette.Midlight: '#ff8a99',
QPalette.Button: '#ff7a8a',
},
'plain': "#FFB7B1",
}

ICON = "icons/Category-Visualize.svg"

Expand Down
5 changes: 2 additions & 3 deletions Orange/widgets/visualize/owscatterplotgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy as np
from AnyQt.QtCore import Qt, QRectF, QSize, QTimer, pyqtSignal as Signal, \
QObject
QObject, QEvent
from AnyQt.QtGui import QColor, QPen, QBrush, QPainterPath, QTransform, \
QPainter
from AnyQt.QtWidgets import QApplication, QToolTip, QGraphicsTextItem, \
Expand Down Expand Up @@ -568,8 +568,7 @@ def __init__(self, scatter_widget, parent=None, view_box=ViewBox):

self.view_box = view_box(self)
_axis = {"left": AxisItem("left"), "bottom": AxisItem("bottom")}
self.plot_widget = pg.PlotWidget(viewBox=self.view_box, parent=parent,
background="w", axisItems=_axis)
self.plot_widget = pg.PlotWidget(viewBox=self.view_box, parent=parent, axisItems=_axis)
self.plot_widget.hideAxis("left")
self.plot_widget.hideAxis("bottom")
self.plot_widget.getPlotItem().buttonsHidden = True
Expand Down
28 changes: 27 additions & 1 deletion Orange/widgets/visualize/utils/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import numpy as np

from AnyQt.QtCore import QSize, Signal
from AnyQt.QtCore import QSize, Signal, QEvent, Qt
from AnyQt.QtWidgets import QApplication
from PyQt5.QtGui import QPalette, QPen

from orangewidget.utils.visual_settings_dlg import VisualSettingsDialog
from pyqtgraph import AxisItem

from Orange.data import (
Table, ContinuousVariable, Domain, Variable, StringVariable
Expand Down Expand Up @@ -412,6 +414,7 @@ def __init__(self):
def setup_gui(self):
self._add_graph()
self._add_controls()
# self._update_palette()
self.input_changed.emit(None)
self.output_changed.emit(None)

Expand Down Expand Up @@ -663,6 +666,29 @@ def onDeleteWidget(self):
self.graph.plot_widget.clear()
self.graph.clear()

# def changeEvent(self, event):
# if event.type() == QEvent.PaletteChange:
# self._update_palette()
# super().changeEvent(event)
#
# def _update_palette(self):
# palette: QPalette = self.palette()
# brush = palette.base()
# text_color = palette.color(QPalette.WindowText)
#
# self.graph.update_colors() # TODO?
# self.graph.plot_widget.setBackground(brush)
# self.graph.tip_textitem.setDefaultTextColor(Qt.black)
#
# pen = QPen(text_color)
#
# plotItem = self.graph.plot_widget.plotItem
# plotItem.titleLabel.setText(brush.color().name())
# for name in plotItem.axes:
# a: AxisItem = plotItem.getAxis(name)
# a.setPen(pen)
# a.setTextPen(pen)


class OWAnchorProjectionWidget(OWDataProjectionWidget, openclass=True):
""" Base widget for widgets with graphs with anchors. """
Expand Down

0 comments on commit 57ed696

Please sign in to comment.