eric6/MicroPython/MicroPythonGraphWidget.py

changeset 7535
dac9bc72a0f3
parent 7360
9190402e4505
child 7780
41420f82c0ac
equal deleted inserted replaced
7534:5441fa55cb0d 7535:dac9bc72a0f3
21 QLabel, QSpinBox 21 QLabel, QSpinBox
22 ) 22 )
23 from PyQt5.QtChart import QChartView, QChart, QLineSeries, QValueAxis 23 from PyQt5.QtChart import QChartView, QChart, QLineSeries, QValueAxis
24 24
25 from E5Gui import E5MessageBox 25 from E5Gui import E5MessageBox
26 from E5Gui.E5Application import e5App
26 27
27 import UI.PixmapCache 28 import UI.PixmapCache
28 import Preferences 29 import Preferences
29 30
30 31
111 self.__axisY.setLabelFormat("%d") 112 self.__axisY.setLabelFormat("%d")
112 self.__chart.setAxisX(self.__axisX, self.__series[0]) 113 self.__chart.setAxisX(self.__axisX, self.__series[0])
113 self.__chart.setAxisY(self.__axisY, self.__series[0]) 114 self.__chart.setAxisY(self.__axisY, self.__series[0])
114 self.__chartView.setChart(self.__chart) 115 self.__chartView.setChart(self.__chart)
115 self.__chartView.setRenderHint(QPainter.Antialiasing) 116 self.__chartView.setRenderHint(QPainter.Antialiasing)
117 self.preferencesChanged()
116 118
117 self.__maxXSpinBox.valueChanged.connect(self.__handleMaxXChanged) 119 self.__maxXSpinBox.valueChanged.connect(self.__handleMaxXChanged)
120
121 @pyqtSlot()
122 def preferencesChanged(self):
123 """
124 Public slot to apply changed preferences.
125 """
126 chartColorTheme = Preferences.getMicroPython("ChartColorTheme")
127 if chartColorTheme == -1:
128 # automatic selection of light or dark depending on desktop
129 # color scheme
130 if e5App().usesDarkPalette():
131 self.__chart.setTheme(QChart.ChartThemeDark)
132 else:
133 self.__chart.setTheme(QChart.ChartThemeLight)
134 else:
135 self.__chart.setTheme(chartColorTheme)
118 136
119 @pyqtSlot(bytes) 137 @pyqtSlot(bytes)
120 def processData(self, data): 138 def processData(self, data):
121 """ 139 """
122 Public slot to process the raw data. 140 Public slot to process the raw data.

eric ide

mercurial