--- a/src/eric7/Preferences/ConfigurationPages/MicroPythonPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/MicroPythonPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -7,6 +7,7 @@ Module implementing the MicroPython configuration page. """ + from eric7 import Preferences, Utilities from eric7.EricWidgets.EricPathPicker import EricPathPickerModes from eric7.MicroPython.MicroPythonWidget import AnsiColorSchemes @@ -14,6 +15,11 @@ from .ConfigurationPageBase import ConfigurationPageBase from .Ui_MicroPythonPage import Ui_MicroPythonPage +try: + from PyQt6.QtCharts import QChart +except ImportError: + QChart = None + class MicroPythonPage(ConfigurationPageBase, Ui_MicroPythonPage): """ @@ -36,9 +42,7 @@ self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys())) # populate the chart theme combobox - try: - from PyQt6.QtCharts import QChart - + if QChart is not None: self.chartThemeComboBox.addItem(self.tr("Automatic"), -1) self.chartThemeComboBox.addItem( self.tr("Light"), QChart.ChartTheme.ChartThemeLight @@ -64,7 +68,7 @@ self.chartThemeComboBox.addItem( self.tr("Qt"), QChart.ChartTheme.ChartThemeQt ) - except ImportError: + else: self.chartThemeComboBox.setEnabled(False) self.mpyCrossPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)