From b29586388b2684fb8632f7e48d7f649ed6fdacbb Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 10 Nov 2021 22:48:59 +0200 Subject: [PATCH] - fixed the issue with toggling visibility for Excellon objects - fixed some issue when using Python 3.10 --- CHANGELOG.md | 5 +++++ appCommon/Common.py | 2 +- appGUI/GUIElements.py | 8 ++++---- appObjects/FlatCAMExcellon.py | 15 +++++++-------- appPlugins/ToolCopperThieving.py | 2 +- appPlugins/ToolQRCode.py | 2 +- camlib.py | 2 +- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bde578ef..83ed6cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta ================================================= +10.11.2021 + +- fixed the issue with toggling visibility for Excellon objects +- fixed some issue when using Python 3.10 + 7.11.2021 - in Cutout Plugin made sure that mouse bytes feature will not autoselect the Excellon object that is created diff --git a/appCommon/Common.py b/appCommon/Common.py index 2bb5134e..715db047 100644 --- a/appCommon/Common.py +++ b/appCommon/Common.py @@ -88,7 +88,7 @@ class LoudDict(dict): self.callback = callback -class LoudUniqueList(list, collections.MutableSequence): +class LoudUniqueList(list, collections.abc.MutableSequence): """ A List with a callback for item changes, callback which returns the index where the items are added/modified. A List that will allow adding only items that are not in the list. diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index a26bdc5c..0f6b39c5 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -1206,13 +1206,13 @@ class FCDoubleSlider(QtWidgets.QSlider): return self.value() def setMinimum(self, value): - return super(FCDoubleSlider, self).setMinimum(value * self._multi) + return super(FCDoubleSlider, self).setMinimum(int(value * self._multi)) def setMaximum(self, value): - return super(FCDoubleSlider, self).setMaximum(value * self._multi) + return super(FCDoubleSlider, self).setMaximum(int(value * self._multi)) def setSingleStep(self, value): - return super(FCDoubleSlider, self).setSingleStep(value * self._multi) + return super(FCDoubleSlider, self).setSingleStep(int(value * self._multi)) def singleStep(self): return float(super(FCDoubleSlider, self).singleStep()) / self._multi @@ -1225,7 +1225,7 @@ class FCDoubleSlider(QtWidgets.QSlider): def set_range(self, min, max): self.blockSignals(True) - self.setRange(min * self._multi, max * self._multi) + self.setRange(int(min * self._multi), int(max * self._multi)) self.blockSignals(False) diff --git a/appObjects/FlatCAMExcellon.py b/appObjects/FlatCAMExcellon.py index aa899e60..844c5af1 100644 --- a/appObjects/FlatCAMExcellon.py +++ b/appObjects/FlatCAMExcellon.py @@ -340,10 +340,10 @@ class ExcellonObject(FlatCAMObj, Excellon): self.ui.tools_table.setItem(self.tool_row, 4, empty_plot_item) if 'multicolor' in self.tools[tool_no] and self.tools[tool_no]['multicolor'] is not None: - red = self.tools[tool_no]['multicolor'][0] * 255 - green = self.tools[tool_no]['multicolor'][1] * 255 - blue = self.tools[tool_no]['multicolor'][2] * 255 - alpha = self.tools[tool_no]['multicolor'][3] * 255 + red = int(self.tools[tool_no]['multicolor'][0] * 255) + green = int(self.tools[tool_no]['multicolor'][1] * 255) + blue = int(self.tools[tool_no]['multicolor'][2] * 255) + alpha = int(self.tools[tool_no]['multicolor'][3] * 255) h_color = QtGui.QColor(red, green, blue, alpha) self.ui.tools_table.item(self.tool_row, 4).setBackground(h_color) else: @@ -1166,11 +1166,10 @@ class ExcellonObject(FlatCAMObj, Excellon): cb_flag = self.ui.plot_cb.isChecked() for row in range(self.ui.tools_table.rowCount() - 2): table_cb = self.ui.tools_table.cellWidget(row, 5) - if cb_flag: - table_cb.setChecked(True) - else: - table_cb.setChecked(False) + table_cb.setChecked(True) if cb_flag else table_cb.setChecked(False) + self.ui_connect() + self.on_plot_cb_click_table() def on_plot_cb_click_table(self): self.ui_disconnect() diff --git a/appPlugins/ToolCopperThieving.py b/appPlugins/ToolCopperThieving.py index 078ba574..d0219e07 100644 --- a/appPlugins/ToolCopperThieving.py +++ b/appPlugins/ToolCopperThieving.py @@ -22,7 +22,7 @@ import shapely.affinity as affinity import logging from copy import deepcopy import numpy as np -from collections import Iterable +from collections.abc import Iterable import gettext import appTranslation as fcTranslate diff --git a/appPlugins/ToolQRCode.py b/appPlugins/ToolQRCode.py index 04578c29..7fc4ffda 100644 --- a/appPlugins/ToolQRCode.py +++ b/appPlugins/ToolQRCode.py @@ -19,7 +19,7 @@ from shapely.affinity import translate from shapely.geometry import box from io import StringIO, BytesIO -from collections import Iterable +from collections.abc import Iterable import logging from copy import deepcopy diff --git a/camlib.py b/camlib.py index a5742a20..bbf9042d 100644 --- a/camlib.py +++ b/camlib.py @@ -38,7 +38,7 @@ from shapely.geometry import shape from descartes.patch import PolygonPatch # --------------------------------------- -from collections import Iterable +from collections.abc import Iterable import rasterio from rasterio.features import shapes