diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bf5c46b..78ecc2d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ CHANGELOG for FlatCAM beta - more fixes for porting to PyQt6 - changes the exit method from exit(0) to quit() - more work in PyQt6 porting +- Isolation Plugin - if there is no object selected try to select the first one if there is any +- Fixed setting a new style 4.08.2021 diff --git a/FlatCAM.py b/FlatCAM.py index a1daa8ee..9d875187 100644 --- a/FlatCAM.py +++ b/FlatCAM.py @@ -155,7 +155,8 @@ if __name__ == '__main__': # apply style settings = QSettings("Open Source", "FlatCAM") if settings.contains("style"): - style = settings.value('style', type=str) + style_index = settings.value('style', type=str) + style = QtWidgets.QStyleFactory.keys()[int(style_index)] app.setStyle(style) fc = App(qapp=app) diff --git a/appGUI/preferences/general/GeneralGUIPrefGroupUI.py b/appGUI/preferences/general/GeneralGUIPrefGroupUI.py index 5f48fc86..eb761f19 100644 --- a/appGUI/preferences/general/GeneralGUIPrefGroupUI.py +++ b/appGUI/preferences/general/GeneralGUIPrefGroupUI.py @@ -94,7 +94,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.style_combo = FCComboBox() self.style_combo.addItems(QtWidgets.QStyleFactory.keys()) # find current style - current_style = QtCore.QCoreApplication.instance().style().objectName() + current_style = QtWidgets.QApplication.style().objectName() index = self.style_combo.findText(current_style, QtCore.Qt.MatchFlag.MatchFixedString) self.style_combo.setCurrentIndex(index) self.style_combo.activated.connect(self.handle_style) diff --git a/appPlugins/ToolIsolation.py b/appPlugins/ToolIsolation.py index f9ff5b81..b5a9fabc 100644 --- a/appPlugins/ToolIsolation.py +++ b/appPlugins/ToolIsolation.py @@ -286,9 +286,11 @@ class ToolIsolation(AppTool, Gerber): # try to select in the Gerber combobox the active object try: selected_obj = self.app.collection.get_active() - if selected_obj.kind == 'gerber': + if selected_obj is not None and selected_obj.kind == 'gerber': current_name = selected_obj.options['name'] self.ui.object_combo.set_value(current_name) + if selected_obj is None and [self.ui.object_combo.itemText(i) for i in range(self.ui.object_combo.count())]: + self.ui.object_combo.setCurrentIndex(0) except Exception as ee: self.app.log.debug("ToolIsolation.set_tool_ui() Select Gerber object -> %s" % str(ee))