diff --git a/CHANGELOG.md b/CHANGELOG.md index 352be26e..e4e46951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta ================================================= +17.06.2021 + +- fixed the setting color functionality on right click on the objects in the Project Tab such that the set color (or opacity) it is stored in a persistent setting correctly and the colors for Gerber objects are restored in order +- trying to fix a Runtime exception that may happen when the Plugin Tab is deleted completely + 10.06.2021 - fixed some issues with error reporting for the Tcl commands diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index fa2dcf07..18b9ab76 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -19,7 +19,8 @@ from PyQt5.QtCore import Qt from camlib import distance, arc, three_point_circle, Geometry, FlatCAMRTreeStorage from appTool import AppTool from appGUI.GUIElements import OptionalInputSection, FCCheckBox, FCLabel, FCComboBox, FCTextAreaRich, \ - FCDoubleSpinner, FCButton, FCInputDoubleSpinner, FCTree, NumericalEvalTupleEntry, FCEntry, FCTextEdit + FCDoubleSpinner, FCButton, FCInputDoubleSpinner, FCTree, NumericalEvalTupleEntry, FCEntry, FCTextEdit, \ + VerticalScrollArea from appParsers.ParseFont import * from vispy.geometry import Rect @@ -149,7 +150,18 @@ class BufferSelectionTool(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) @@ -389,7 +401,17 @@ class TextInputTool(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) @@ -605,7 +627,17 @@ class PaintOptionsTool(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) @@ -1100,7 +1132,17 @@ class TransformEditorTool(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index 1ce27b46..67001a85 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -19,7 +19,8 @@ import logging from camlib import distance, arc, three_point_circle from appGUI.GUIElements import FCEntry, FCComboBox, FCTable, FCDoubleSpinner, FCSpinner, RadioSet, EvalEntry2, \ - FCInputDoubleSpinner, FCButton, OptionalInputSection, FCCheckBox, NumericalEvalTupleEntry, FCLabel, FCTextEdit + FCInputDoubleSpinner, FCButton, OptionalInputSection, FCCheckBox, NumericalEvalTupleEntry, FCLabel, FCTextEdit, \ + VerticalScrollArea from appTool import AppTool import numpy as np @@ -7075,7 +7076,17 @@ class TransformEditorTool(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolAlignObjects.py b/appPlugins/ToolAlignObjects.py index c78d1b06..7f4a41b7 100644 --- a/appPlugins/ToolAlignObjects.py +++ b/appPlugins/ToolAlignObjects.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import FCComboBox, RadioSet, FCLabel, FCButton +from appGUI.GUIElements import FCComboBox, RadioSet, FCLabel, FCButton, VerticalScrollArea import math @@ -94,7 +94,17 @@ class AlignObjects(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolCalculators.py b/appPlugins/ToolCalculators.py index 54f4d6ce..b8370f77 100644 --- a/appPlugins/ToolCalculators.py +++ b/appPlugins/ToolCalculators.py @@ -7,7 +7,8 @@ from PyQt5 import QtWidgets, QtGui from appTool import AppTool -from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, NumericalEvalEntry, FCLabel, RadioSet, FCButton +from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, NumericalEvalEntry, FCLabel, RadioSet, FCButton, \ + VerticalScrollArea import math import gettext @@ -51,7 +52,17 @@ class ToolCalculator(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolCalibration.py b/appPlugins/ToolCalibration.py index 8a920bb3..eea144eb 100644 --- a/appPlugins/ToolCalibration.py +++ b/appPlugins/ToolCalibration.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import FCDoubleSpinner, EvalEntry, FCCheckBox, OptionalInputSection, FCEntry +from appGUI.GUIElements import FCDoubleSpinner, EvalEntry, FCCheckBox, OptionalInputSection, FCEntry, VerticalScrollArea from appGUI.GUIElements import FCTable, FCComboBox, RadioSet from appEditors.AppTextEditor import AppTextEditor @@ -85,7 +85,17 @@ class ToolCalibration(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolCopperThieving.py b/appPlugins/ToolCopperThieving.py index 386f7eaa..ab96155f 100644 --- a/appPlugins/ToolCopperThieving.py +++ b/appPlugins/ToolCopperThieving.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from camlib import grace from appTool import AppTool -from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox, FCLabel, FCCheckBox +from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox, FCLabel, FCCheckBox, VerticalScrollArea from appCommon.Common import LoudDict import shapely.geometry.base as base @@ -103,7 +103,17 @@ class ToolCopperThieving(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolCorners.py b/appPlugins/ToolCorners.py index d0a13fc8..8a33b5b3 100644 --- a/appPlugins/ToolCorners.py +++ b/appPlugins/ToolCorners.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool from appCommon.Common import LoudDict -from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCComboBox, FCButton, RadioSet, FCLabel +from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCComboBox, FCButton, RadioSet, FCLabel, VerticalScrollArea from shapely.geometry import MultiPolygon, LineString, Point from shapely.ops import unary_union @@ -75,7 +75,17 @@ class ToolCorners(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolCutOut.py b/appPlugins/ToolCutOut.py index 98e57a96..16680205 100644 --- a/appPlugins/ToolCutOut.py +++ b/appPlugins/ToolCutOut.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtGui, QtCore from appTool import AppTool from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox, OptionalInputSection, FCButton, \ - FCLabel + FCLabel, VerticalScrollArea from shapely.geometry import box, MultiPolygon, Polygon, LineString, LinearRing, MultiLineString, Point from shapely.ops import unary_union, linemerge @@ -139,7 +139,17 @@ class CutOut(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolDblSided.py b/appPlugins/ToolDblSided.py index 9b2951a4..c8710cb5 100644 --- a/appPlugins/ToolDblSided.py +++ b/appPlugins/ToolDblSided.py @@ -2,7 +2,8 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCButton, FCComboBox, NumericalEvalTupleEntry, FCLabel +from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCButton, FCComboBox, NumericalEvalTupleEntry, FCLabel, \ + VerticalScrollArea from numpy import Inf from copy import deepcopy @@ -69,7 +70,17 @@ class DblSidedTool(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolDistance.py b/appPlugins/ToolDistance.py index 8fa2e044..890df924 100644 --- a/appPlugins/ToolDistance.py +++ b/appPlugins/ToolDistance.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore from appTool import AppTool from appGUI.VisPyVisuals import * -from appGUI.GUIElements import FCEntry, FCButton, FCCheckBox, FCLabel +from appGUI.GUIElements import FCEntry, FCButton, FCCheckBox, FCLabel, VerticalScrollArea from shapely.geometry import Point, MultiLineString, Polygon @@ -120,7 +120,17 @@ class Distance(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolDistanceMin.py b/appPlugins/ToolDistanceMin.py index 7cf507a2..7cbc4a26 100644 --- a/appPlugins/ToolDistanceMin.py +++ b/appPlugins/ToolDistanceMin.py @@ -7,7 +7,7 @@ from PyQt5 import QtWidgets, QtCore from appTool import AppTool -from appGUI.GUIElements import FCEntry, FCLabel, FCButton +from appGUI.GUIElements import FCEntry, FCLabel, FCButton, VerticalScrollArea from shapely.ops import nearest_points from shapely.geometry import Point, MultiPolygon @@ -76,7 +76,17 @@ class DistanceMin(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py index c45d7ac6..1a4c0386 100644 --- a/appPlugins/ToolDrilling.py +++ b/appPlugins/ToolDrilling.py @@ -10,7 +10,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, \ FCComboBox, OptionalInputSection, FCSpinner, NumericalEvalEntry, OptionalHideInputSection, FCLabel, \ - NumericalEvalTupleEntry, FCComboBox2 + NumericalEvalTupleEntry, FCComboBox2, VerticalScrollArea from appParsers.ParseExcellon import Excellon from copy import deepcopy @@ -151,7 +151,17 @@ class ToolDrilling(AppTool, Excellon): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolEtchCompensation.py b/appPlugins/ToolEtchCompensation.py index 85e0f89c..28e2cdcc 100644 --- a/appPlugins/ToolEtchCompensation.py +++ b/appPlugins/ToolEtchCompensation.py @@ -8,7 +8,8 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox, NumericalEvalEntry, FCEntry +from appGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox, NumericalEvalEntry, FCEntry, \ + VerticalScrollArea from shapely.ops import unary_union @@ -62,7 +63,17 @@ class ToolEtchCompensation(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolExtract.py b/appPlugins/ToolExtract.py index ce8a7ae1..9a465123 100644 --- a/appPlugins/ToolExtract.py +++ b/appPlugins/ToolExtract.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox, FCLabel, FCTable +from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox, FCLabel, FCTable, VerticalScrollArea from shapely.geometry import Point, MultiPolygon, Polygon, box @@ -89,7 +89,17 @@ class ToolExtract(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolFiducials.py b/appPlugins/ToolFiducials.py index 95c5d7aa..4668c074 100644 --- a/appPlugins/ToolFiducials.py +++ b/appPlugins/ToolFiducials.py @@ -8,7 +8,8 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox, FCButton, FCLabel +from appGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox, FCButton, FCLabel, \ + VerticalScrollArea from appCommon.Common import LoudDict from shapely.geometry import Point, Polygon, MultiPolygon, LineString @@ -97,7 +98,17 @@ class ToolFiducials(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolFilm.py b/appPlugins/ToolFilm.py index 54dbcb38..375ca9d7 100644 --- a/appPlugins/ToolFilm.py +++ b/appPlugins/ToolFilm.py @@ -9,7 +9,7 @@ from PyQt5 import QtCore, QtWidgets, QtGui from appTool import AppTool from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, \ - OptionalHideInputSection, FCComboBox, FCFileSaveDialog, FCButton, FCLabel, FCSpinner + OptionalHideInputSection, FCComboBox, FCFileSaveDialog, FCButton, FCLabel, FCSpinner, VerticalScrollArea from copy import deepcopy import logging @@ -109,7 +109,17 @@ class Film(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolFollow.py b/appPlugins/ToolFollow.py index 2032437e..ebda7036 100644 --- a/appPlugins/ToolFollow.py +++ b/appPlugins/ToolFollow.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import RadioSet, FCButton, FCComboBox, FCLabel +from appGUI.GUIElements import RadioSet, FCButton, FCComboBox, FCLabel, VerticalScrollArea from appParsers.ParseGerber import Gerber from copy import deepcopy @@ -89,7 +89,17 @@ class ToolFollow(AppTool, Gerber): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolImage.py b/appPlugins/ToolImage.py index 73461491..ae3c642d 100644 --- a/appPlugins/ToolImage.py +++ b/appPlugins/ToolImage.py @@ -8,7 +8,7 @@ from PyQt5 import QtGui, QtWidgets from appTool import AppTool -from appGUI.GUIElements import RadioSet, FCComboBox, FCSpinner, FCLabel +from appGUI.GUIElements import RadioSet, FCComboBox, FCSpinner, FCLabel, VerticalScrollArea import os @@ -52,7 +52,17 @@ class ToolImage(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolInvertGerber.py b/appPlugins/ToolInvertGerber.py index ce536f48..4b677b73 100644 --- a/appPlugins/ToolInvertGerber.py +++ b/appPlugins/ToolInvertGerber.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox, FCLabel +from appGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox, FCLabel, VerticalScrollArea from shapely.geometry import box @@ -61,7 +61,18 @@ class ToolInvertGerber(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolIsolation.py b/appPlugins/ToolIsolation.py index 84e326dc..afb3ec0f 100644 --- a/appPlugins/ToolIsolation.py +++ b/appPlugins/ToolIsolation.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, \ - FCComboBox, OptionalInputSection, FCSpinner, FCLabel, FCInputDialogSpinnerButton, FCComboBox2 + FCComboBox, OptionalInputSection, FCSpinner, FCLabel, FCInputDialogSpinnerButton, FCComboBox2, VerticalScrollArea from appParsers.ParseGerber import Gerber from camlib import grace @@ -149,7 +149,17 @@ class ToolIsolation(AppTool, Gerber): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolLevelling.py b/appPlugins/ToolLevelling.py index 0ee507f7..b2052dd9 100644 --- a/appPlugins/ToolLevelling.py +++ b/appPlugins/ToolLevelling.py @@ -14,7 +14,7 @@ from appGUI.VisPyVisuals import * from appGUI.PlotCanvasLegacy import ShapeCollectionLegacy from appGUI.GUIElements import RadioSet, FCButton, FCComboBox, FCLabel, FCFileSaveDialog, FCCheckBox, FCTable, \ FCDoubleSpinner, FCSpinner, FCDetachableTab, FCZeroAxes, FCJog, FCSliderWithDoubleSpinner, RotatedToolButton, \ - FCEntry + FCEntry, VerticalScrollArea from appEditors.AppTextEditor import AppTextEditor from camlib import CNCjob @@ -147,7 +147,17 @@ class ToolLevelling(AppTool, CNCjob): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index 930a9534..cdea79aa 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -9,7 +9,8 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, FCComboBox2, \ - FCComboBox, OptionalInputSection, FCSpinner, NumericalEvalTupleEntry, OptionalHideInputSection, FCLabel + FCComboBox, OptionalInputSection, FCSpinner, NumericalEvalTupleEntry, OptionalHideInputSection, FCLabel, \ + VerticalScrollArea from appParsers.ParseExcellon import Excellon from camlib import grace @@ -151,7 +152,17 @@ class ToolMilling(AppTool, Excellon): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolNCC.py b/appPlugins/ToolNCC.py index ddf3431c..65eaf940 100644 --- a/appPlugins/ToolNCC.py +++ b/appPlugins/ToolNCC.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton,\ - FCComboBox, OptionalInputSection, FCLabel, FCInputDialogSpinnerButton, FCComboBox2 + FCComboBox, OptionalInputSection, FCLabel, FCInputDialogSpinnerButton, FCComboBox2, VerticalScrollArea from appParsers.ParseGerber import Gerber from camlib import grace @@ -162,7 +162,17 @@ class NonCopperClear(AppTool, Gerber): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolOptimal.py b/appPlugins/ToolOptimal.py index cd2cdc55..677106f4 100644 --- a/appPlugins/ToolOptimal.py +++ b/appPlugins/ToolOptimal.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import OptionalHideInputSection, FCTextArea, FCEntry, FCSpinner, FCCheckBox, FCComboBox, \ - FCLabel, FCButton + FCLabel, FCButton, VerticalScrollArea from camlib import grace from shapely.geometry import MultiPolygon @@ -76,7 +76,17 @@ class ToolOptimal(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolPaint.py b/appPlugins/ToolPaint.py index 563fab24..078ec6f3 100644 --- a/appPlugins/ToolPaint.py +++ b/appPlugins/ToolPaint.py @@ -14,7 +14,7 @@ from copy import deepcopy from appParsers.ParseGerber import Gerber from camlib import Geometry, FlatCAMRTreeStorage, grace from appGUI.GUIElements import FCTable, FCDoubleSpinner, FCCheckBox, FCInputDoubleSpinner, RadioSet, \ - FCButton, FCComboBox, FCLabel, FCComboBox2 + FCButton, FCComboBox, FCLabel, FCComboBox2, VerticalScrollArea from shapely.geometry import base, Polygon, MultiPolygon, LinearRing, Point from shapely.ops import unary_union, linemerge @@ -171,7 +171,17 @@ class ToolPaint(AppTool, Gerber): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolPanelize.py b/appPlugins/ToolPanelize.py index cfc78450..fa99b259 100644 --- a/appPlugins/ToolPanelize.py +++ b/appPlugins/ToolPanelize.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtGui, QtCore from appTool import AppTool from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCCheckBox, OptionalInputSection, FCComboBox, \ - FCButton, FCLabel + FCButton, FCLabel, VerticalScrollArea from camlib import grace from copy import deepcopy @@ -72,7 +72,17 @@ class Panelize(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolPcbWizard.py b/appPlugins/ToolPcbWizard.py index 8abc2401..8a6f1f0c 100644 --- a/appPlugins/ToolPcbWizard.py +++ b/appPlugins/ToolPcbWizard.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtCore from appTool import AppTool -from appGUI.GUIElements import RadioSet, FCSpinner, FCButton, FCTable, FCLabel +from appGUI.GUIElements import RadioSet, FCSpinner, FCButton, FCTable, FCLabel, VerticalScrollArea import re import os @@ -73,7 +73,17 @@ class PcbWizard(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolPunchGerber.py b/appPlugins/ToolPunchGerber.py index ec704ca4..d5775117 100644 --- a/appPlugins/ToolPunchGerber.py +++ b/appPlugins/ToolPunchGerber.py @@ -8,7 +8,8 @@ from PyQt5 import QtCore, QtWidgets, QtGui from appTool import AppTool -from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox, FCTable, FCButton, FCLabel +from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox, FCTable, FCButton, FCLabel, \ + VerticalScrollArea from copy import deepcopy import logging @@ -115,7 +116,17 @@ class ToolPunchGerber(AppTool, Gerber): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolQRCode.py b/appPlugins/ToolQRCode.py index 55268092..21790184 100644 --- a/appPlugins/ToolQRCode.py +++ b/appPlugins/ToolQRCode.py @@ -9,7 +9,8 @@ from PyQt5 import QtWidgets, QtCore, QtGui from PyQt5.QtCore import Qt from appTool import AppTool -from appGUI.GUIElements import RadioSet, FCTextArea, FCSpinner, FCEntry, FCCheckBox, FCComboBox, FCFileSaveDialog +from appGUI.GUIElements import RadioSet, FCTextArea, FCSpinner, FCEntry, FCCheckBox, FCComboBox, FCFileSaveDialog, \ + VerticalScrollArea from appParsers.ParseSVG import * from shapely.geometry.base import * @@ -88,7 +89,17 @@ class QRCode(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolReport.py b/appPlugins/ToolReport.py index 2dc8325c..cd51702d 100644 --- a/appPlugins/ToolReport.py +++ b/appPlugins/ToolReport.py @@ -7,7 +7,7 @@ from PyQt5 import QtGui, QtCore, QtWidgets from appTool import AppTool -from appGUI.GUIElements import FCTree +from appGUI.GUIElements import FCTree, VerticalScrollArea from shapely.geometry import MultiPolygon, Polygon from shapely.ops import unary_union @@ -87,7 +87,17 @@ class ObjectReport(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolRulesCheck.py b/appPlugins/ToolRulesCheck.py index 52ae045b..67956b4d 100644 --- a/appPlugins/ToolRulesCheck.py +++ b/appPlugins/ToolRulesCheck.py @@ -8,7 +8,8 @@ from PyQt5 import QtWidgets, QtGui from appTool import AppTool -from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCComboBox, FCLabel, FCButton +from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCComboBox, FCLabel, FCButton, \ + VerticalScrollArea from copy import deepcopy from appPool import * @@ -78,7 +79,17 @@ class RulesCheck(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolSolderPaste.py b/appPlugins/ToolSolderPaste.py index 23c53ee5..6556d50d 100644 --- a/appPlugins/ToolSolderPaste.py +++ b/appPlugins/ToolSolderPaste.py @@ -10,7 +10,7 @@ from PyQt5 import QtGui, QtCore, QtWidgets from appTool import AppTool from appCommon.Common import LoudDict from appGUI.GUIElements import FCComboBox, FCEntry, FCTable, FCDoubleSpinner, FCSpinner, FCFileSaveDialog, \ - FCInputSpinner, FCButton + FCInputSpinner, FCButton, VerticalScrollArea from camlib import distance from appEditors.AppTextEditor import AppTextEditor @@ -84,7 +84,17 @@ class SolderPaste(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolSub.py b/appPlugins/ToolSub.py index 221a29d0..322b2b30 100644 --- a/appPlugins/ToolSub.py +++ b/appPlugins/ToolSub.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool -from appGUI.GUIElements import FCCheckBox, FCButton, FCComboBox, FCLabel +from appGUI.GUIElements import FCCheckBox, FCButton, FCComboBox, FCLabel, VerticalScrollArea from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString from shapely.ops import unary_union @@ -125,7 +125,17 @@ class ToolSub(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/appPlugins/ToolTransform.py b/appPlugins/ToolTransform.py index 170d1f09..0a84b51d 100644 --- a/appPlugins/ToolTransform.py +++ b/appPlugins/ToolTransform.py @@ -8,7 +8,7 @@ from PyQt5 import QtWidgets, QtGui, QtCore from appTool import AppTool from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCButton, OptionalInputSection, FCComboBox, \ - NumericalEvalTupleEntry, FCLabel + NumericalEvalTupleEntry, FCLabel, VerticalScrollArea import numpy as np @@ -50,7 +50,17 @@ class ToolTransform(AppTool): break # show the Tab if not found_idx: - self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + try: + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) + except RuntimeError: + self.app.ui.plugin_tab = QtWidgets.QWidget() + self.app.ui.plugin_tab.setObjectName("plugin_tab") + self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab) + self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2) + + self.app.ui.plugin_scroll_area = VerticalScrollArea() + self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area) + self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin")) # focus on Tool Tab self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab) diff --git a/app_Main.py b/app_Main.py index bc333e86..7ef3f4b3 100644 --- a/app_Main.py +++ b/app_Main.py @@ -8529,7 +8529,8 @@ class App(QtCore.QObject): alpha_level = 'FF' else: self.log.debug( - "App.on_set_color_action_triggered() --> Default alpfa for this object type not supported yet") + "App.on_set_color_action_triggered() --> Default transparency level " + "for this object type not supported yet") continue sel_obj.alpha_level = alpha_level @@ -8551,6 +8552,7 @@ class App(QtCore.QObject): if act_name == _('Black'): new_color = '#000000' + alpha_level + # selection of a custom color will open a QColor dialog if act_name == _('Custom'): new_color = QtGui.QColor(self.defaults['gerber_plot_fill'][:7]) c_dialog = QtWidgets.QColorDialog() @@ -8561,6 +8563,7 @@ class App(QtCore.QObject): new_color = str(plot_fill_color.name()) + alpha_level + # when it is desired the return to the default color set in Preferences if act_name == _("Default"): for sel_obj in sel_obj_list: if sel_obj.kind == 'excellon': @@ -8583,8 +8586,11 @@ class App(QtCore.QObject): sel_obj.shapes.redraw( update_colors=(new_color, new_line_color) ) + + self.set_gerber_color_in_preferences_dict(sel_obj_list, new_color, new_line_color) return + # set of a custom transparency level if act_name == _("Opacity"): # alpha_level, ok_button = QtWidgets.QInputDialog.getInt(self.ui, _("Set alpha level ..."), # '%s:' % _("Value"), @@ -8595,14 +8601,27 @@ class App(QtCore.QObject): alpha_level, ok_button = alpha_dialog.get_results() if ok_button: - alpha_str = str(hex(alpha_level)[2:]) if alpha_level != 0 else '00' - for sel_obj in sel_obj_list: - sel_obj.fill_color = sel_obj.fill_color[:-2] + alpha_str + group = self.collection.group_items["gerber"] + group_index = self.collection.index(group.row(), 0, QtCore.QModelIndex()) + alpha_str = str(hex(alpha_level)[2:]) if alpha_level != 0 else '00' + + for sel_obj in sel_obj_list: + new_color = sel_obj.fill_color[:-2] + alpha_str + new_line_color = sel_obj.outline_color + + sel_obj.fill_color = new_color sel_obj.shapes.redraw( update_colors=(sel_obj.fill_color, sel_obj.outline_color) ) + new_c = (new_line_color, new_color) + if sel_obj.kind == 'gerber': + item = sel_obj.item + item_index = self.collection.index(item.row(), 0, group_index) + idx = item_index.row() + self.defaults["gerber_color_list"][idx] = new_c + return new_line_color = color_variant(new_color[:7], 0.7) @@ -8617,12 +8636,30 @@ class App(QtCore.QObject): update_colors=(new_color, new_line_color) ) + self.set_gerber_color_in_preferences_dict(sel_obj_list, new_color, new_line_color) + + def set_gerber_color_in_preferences_dict(self, list_of_gerber_obj, fill_color, outline_color): + """ + This method will save the set colors into a list that will be used next time when Gerber objects are loaded. + First loaded Gerber will have the first color in the list, second loaded Gerber object will have set the second + color in the list and so on. + + :param list_of_gerber_obj: a list of Gerber objects that are currently loaded and selected + :type list_of_gerber_obj: list + :param fill_color: the fill color that will be set for the selected objects + :type fill_color: str + :param outline_color: the outline color that will be set for the selected objects + :type outline_color: str + :return: None + :rtype: None + """ + # make sure to set the color in the Gerber colors storage self.defaults["gerber_color_list"] group = self.collection.group_items["gerber"] group_index = self.collection.index(group.row(), 0, QtCore.QModelIndex()) - new_c = (new_line_color, new_color) - for sel_obj in sel_obj_list: + new_c = (outline_color, fill_color) + for sel_obj in list_of_gerber_obj: if sel_obj.kind == 'gerber': item = sel_obj.item item_index = self.collection.index(item.row(), 0, group_index)