- Isolation Plugin - if there is no object selected try to select the first one if there is any

- Fixed setting a new style
This commit is contained in:
Marius Stanciu
2021-08-05 22:16:10 +03:00
committed by Marius
parent 1d88491a18
commit 03618172d7
4 changed files with 8 additions and 3 deletions

View File

@@ -15,6 +15,8 @@ CHANGELOG for FlatCAM beta
- more fixes for porting to PyQt6 - more fixes for porting to PyQt6
- changes the exit method from exit(0) to quit() - changes the exit method from exit(0) to quit()
- more work in PyQt6 porting - 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 4.08.2021

View File

@@ -155,7 +155,8 @@ if __name__ == '__main__':
# apply style # apply style
settings = QSettings("Open Source", "FlatCAM") settings = QSettings("Open Source", "FlatCAM")
if settings.contains("style"): 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) app.setStyle(style)
fc = App(qapp=app) fc = App(qapp=app)

View File

@@ -94,7 +94,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
self.style_combo = FCComboBox() self.style_combo = FCComboBox()
self.style_combo.addItems(QtWidgets.QStyleFactory.keys()) self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
# find current style # 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) index = self.style_combo.findText(current_style, QtCore.Qt.MatchFlag.MatchFixedString)
self.style_combo.setCurrentIndex(index) self.style_combo.setCurrentIndex(index)
self.style_combo.activated.connect(self.handle_style) self.style_combo.activated.connect(self.handle_style)

View File

@@ -286,9 +286,11 @@ class ToolIsolation(AppTool, Gerber):
# try to select in the Gerber combobox the active object # try to select in the Gerber combobox the active object
try: try:
selected_obj = self.app.collection.get_active() 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'] current_name = selected_obj.options['name']
self.ui.object_combo.set_value(current_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: except Exception as ee:
self.app.log.debug("ToolIsolation.set_tool_ui() Select Gerber object -> %s" % str(ee)) self.app.log.debug("ToolIsolation.set_tool_ui() Select Gerber object -> %s" % str(ee))