|
2 | 2 |
|
3 | 3 | import numpy as np |
4 | 4 |
|
5 | | -from AnyQt.QtCore import QSize, Signal |
| 5 | +from AnyQt.QtCore import QSize, Signal, QEvent, Qt |
6 | 6 | from AnyQt.QtWidgets import QApplication |
| 7 | +from PyQt5.QtGui import QPalette, QPen |
7 | 8 |
|
8 | 9 | from orangewidget.utils.visual_settings_dlg import VisualSettingsDialog |
| 10 | +from pyqtgraph import AxisItem |
9 | 11 |
|
10 | 12 | from Orange.data import ( |
11 | 13 | Table, ContinuousVariable, Domain, Variable, StringVariable |
@@ -412,6 +414,7 @@ def __init__(self): |
412 | 414 | def setup_gui(self): |
413 | 415 | self._add_graph() |
414 | 416 | self._add_controls() |
| 417 | + # self._update_palette() |
415 | 418 | self.input_changed.emit(None) |
416 | 419 | self.output_changed.emit(None) |
417 | 420 |
|
@@ -663,6 +666,29 @@ def onDeleteWidget(self): |
663 | 666 | self.graph.plot_widget.clear() |
664 | 667 | self.graph.clear() |
665 | 668 |
|
| 669 | + # def changeEvent(self, event): |
| 670 | + # if event.type() == QEvent.PaletteChange: |
| 671 | + # self._update_palette() |
| 672 | + # super().changeEvent(event) |
| 673 | + # |
| 674 | + # def _update_palette(self): |
| 675 | + # palette: QPalette = self.palette() |
| 676 | + # brush = palette.base() |
| 677 | + # text_color = palette.color(QPalette.WindowText) |
| 678 | + # |
| 679 | + # self.graph.update_colors() # TODO? |
| 680 | + # self.graph.plot_widget.setBackground(brush) |
| 681 | + # self.graph.tip_textitem.setDefaultTextColor(Qt.black) |
| 682 | + # |
| 683 | + # pen = QPen(text_color) |
| 684 | + # |
| 685 | + # plotItem = self.graph.plot_widget.plotItem |
| 686 | + # plotItem.titleLabel.setText(brush.color().name()) |
| 687 | + # for name in plotItem.axes: |
| 688 | + # a: AxisItem = plotItem.getAxis(name) |
| 689 | + # a.setPen(pen) |
| 690 | + # a.setTextPen(pen) |
| 691 | + |
666 | 692 |
|
667 | 693 | class OWAnchorProjectionWidget(OWDataProjectionWidget, openclass=True): |
668 | 694 | """ Base widget for widgets with graphs with anchors. """ |
|
0 commit comments