diff --git a/Bookmark.py b/Bookmark.py index 9edcdeb0..eba75240 100644 --- a/Bookmark.py +++ b/Bookmark.py @@ -46,7 +46,7 @@ class BookmarkManager(QtWidgets.QWidget): layout.addLayout(table_hlay) self.table_widget = FCTable(drag_drop=True, protected_rows=[0, 1]) - self.table_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.table_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) table_hlay.addWidget(self.table_widget) self.table_widget.setColumnCount(3) @@ -170,10 +170,10 @@ class BookmarkManager(QtWidgets.QWidget): horizontal_header = self.table_widget.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.Stretch) self.mark_table_rows_for_actions() diff --git a/CHANGELOG.md b/CHANGELOG.md index e5f891a5..70033bdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta ================================================= +5.08.2021 + +- continuing to fix the PyQt6 port +- added an Exception when App.on_canvas_setup() fails + 4.08.2021 - toggling the plot is now deleting the selection shape, if any diff --git a/appDatabase.py b/appDatabase.py index 208caf20..aa1c72df 100644 --- a/appDatabase.py +++ b/appDatabase.py @@ -38,7 +38,7 @@ class ToolsDB2UI: self.tree_widget.setHeaderLabels([_("ID"), _("Name"), _("Target"), _("Diameter")]) self.tree_widget.setIndentation(0) self.tree_widget.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu) - self.tree_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.tree_widget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) # set alternating colors # self.tree_widget.setAlternatingRowColors(True) @@ -1806,9 +1806,9 @@ class ToolsDB2(QtWidgets.QWidget): self.app.log.error("ToolDB.build_db_ui.add_plugin_table_line() --> %s" % str(e)) header = self.ui.tree_widget.header() - header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) + header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) if self.current_toolid is None or self.current_toolid < 1: if self.db_tool_dict: @@ -2441,9 +2441,9 @@ class ToolsDB2(QtWidgets.QWidget): item.setData(2, QtCore.Qt.ItemDataRole.DisplayRole, op_name) header = self.ui.tree_widget.header() - header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) + header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) def update_tree_tooldia(self): val = self.ui.dia_entry.get_value() @@ -2757,7 +2757,7 @@ class ToolsDB2(QtWidgets.QWidget): # layout.addLayout(table_hlay) # # self.table_widget = FCTable(drag_drop=True) -# self.table_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) +# self.table_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) # table_hlay.addWidget(self.table_widget) # # # set the number of columns and the headers tool tips @@ -3049,13 +3049,13 @@ class ToolsDB2(QtWidgets.QWidget): # for x in range(27): # self.table_widget.resizeColumnToContents(x) # -# horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) -# # horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) -# # horizontal_header.setSectionResizeMode(13, QtWidgets.QHeaderView.Fixed) +# horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) +# # horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) +# # horizontal_header.setSectionResizeMode(13, QtWidgets.QHeaderView.ResizeMode.Fixed) # # horizontal_header.resizeSection(0, 20) -# # horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) -# # horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) +# # horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) +# # horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.Stretch) # # self.ui_connect() # diff --git a/appEditors/AppExcEditor.py b/appEditors/AppExcEditor.py index 4bad092e..aabd37f7 100644 --- a/appEditors/AppExcEditor.py +++ b/appEditors/AppExcEditor.py @@ -2191,15 +2191,15 @@ class AppExcEditor(QtCore.QObject): self.ui.tools_table_exc.resizeRowsToContents() vertical_header = self.ui.tools_table_exc.verticalHeader() - # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) + # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) vertical_header.hide() - self.ui.tools_table_exc.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table_exc.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table_exc.horizontalHeader() - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) # horizontal_header.setStretchLastSection(True) # self.ui.tools_table_exc.setSortingEnabled(True) @@ -3598,7 +3598,7 @@ class AppExcEditor(QtCore.QObject): # first deselect all rows (tools) in the Tools Table self.ui.tools_table_exc.clearSelection() # and select the rows (tools) in the tool table according to the diameter(s) of the selected shape(s) - self.ui.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) + self.ui.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.MultiSelection) for storage in self.storage_dict: for shape_s in self.selected: if shape_s in self.storage_dict[storage].get_objects(): @@ -3616,7 +3616,7 @@ class AppExcEditor(QtCore.QObject): self.ui.tools_table_exc.selectRow(row_to_sel) self.last_tool_selected = int(key_tool_nr) - self.ui.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.ui.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) self.ui.tools_table_exc.cellPressed.connect(self.on_row_selected) self.replot() @@ -4025,7 +4025,7 @@ class AppExcEditorUI: self.tools_table_exc.setColumnCount(4) self.tools_table_exc.setHorizontalHeaderLabels(['#', _('Diameter'), 'D', 'S']) self.tools_table_exc.setSortingEnabled(False) - self.tools_table_exc.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.tools_table_exc.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.ui_vertical_lay.addWidget(self.tools_table_exc) diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index cfaa3763..0c42214d 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -3487,7 +3487,7 @@ class AppGeoEditor(QtCore.QObject): self.tw.setIndentation(0) self.tw.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu) self.tw.header().setStretchLastSection(True) - self.tw.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) + self.tw.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) self.tools_box.addWidget(self.tw) self.geo_font = QtGui.QFont() diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index 82f8a448..1933a3b1 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -2450,13 +2450,13 @@ class EraserEditorGrb(ShapeToolEditorGrb): except Exception as e: log.error("AppGerberEditor.EraserEditorGrb.click_release() --> %s" % str(e)) - self.draw_app.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) + self.draw_app.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.MultiSelection) for aper in sel_aperture: for row in range(self.draw_app.ui.apertures_table.rowCount()): if str(aper) == self.draw_app.ui.apertures_table.item(row, 1).text(): self.draw_app.ui.apertures_table.selectRow(row) self.draw_app.last_aperture_selected = aper - self.draw_app.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.draw_app.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) self.draw_app.ui.apertures_table.cellPressed.connect(self.draw_app.on_row_selected) @@ -2708,14 +2708,14 @@ class SelectEditorGrb(QtCore.QObject, DrawTool): self.sel_aperture.add(storage) # actual row selection is done here - self.draw_app.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) + self.draw_app.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.MultiSelection) for aper in self.sel_aperture: for row in range(self.draw_app.ui.apertures_table.rowCount()): if str(aper) == self.draw_app.ui.apertures_table.item(row, 1).text(): if row not in set(idx.row() for idx in self.draw_app.ui.apertures_table.selectedIndexes()): self.draw_app.ui.apertures_table.selectRow(row) self.draw_app.last_aperture_selected = aper - self.draw_app.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.draw_app.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) # reconnect signal when clicking in the table self.draw_app.ui.apertures_table.cellPressed.connect(self.draw_app.on_row_selected) @@ -3675,21 +3675,21 @@ class AppGerberEditor(QtCore.QObject): self.ui.apertures_table.resizeRowsToContents() vertical_header = self.ui.apertures_table.verticalHeader() - # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) + # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) vertical_header.hide() - self.ui.apertures_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.apertures_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.apertures_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 27) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.Stretch) - self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.apertures_table.setSortingEnabled(False) self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight()) self.ui.apertures_table.setMaximumHeight(self.ui.apertures_table.getHeight()) @@ -5290,14 +5290,14 @@ class AppGerberEditor(QtCore.QObject): except Exception as e: self.app.log.error("AppGerberEditor.draw_selection_Area_handler() --> %s" % str(e)) - self.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) + self.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.MultiSelection) for aper in sel_aperture: for row_to_sel in range(self.ui.apertures_table.rowCount()): if str(aper) == self.ui.apertures_table.item(row_to_sel, 1).text(): if row_to_sel not in set(index.row() for index in self.ui.apertures_table.selectedIndexes()): self.ui.apertures_table.selectRow(row_to_sel) self.last_aperture_selected = aper - self.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.ui.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) # ############################################################################################################# # ######################### calculate vertex numbers for all selected shapes ################################## @@ -6049,7 +6049,7 @@ class AppGerberEditorUI: self.apertures_table.setColumnCount(5) self.apertures_table.setHorizontalHeaderLabels(['#', _('Code'), _('Type'), _('Size'), _('Dim')]) self.apertures_table.setSortingEnabled(False) - self.apertures_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.apertures_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.apertures_table.horizontalHeaderItem(0).setToolTip( _("Index")) diff --git a/appEditors/appGCodeEditor.py b/appEditors/appGCodeEditor.py index e7223233..ab63a37c 100644 --- a/appEditors/appGCodeEditor.py +++ b/appEditors/appGCodeEditor.py @@ -223,22 +223,22 @@ class AppGCodeEditor(QtCore.QObject): self.ui.cnc_tools_table.resizeRowsToContents() vertical_header = self.ui.cnc_tools_table.verticalHeader() - # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) + # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) vertical_header.hide() - self.ui.cnc_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.cnc_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.cnc_tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(4, 40) # horizontal_header.setStretchLastSection(True) - self.ui.cnc_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.cnc_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.cnc_tools_table.setColumnWidth(0, 20) self.ui.cnc_tools_table.setColumnWidth(4, 40) @@ -312,20 +312,20 @@ class AppGCodeEditor(QtCore.QObject): vertical_header = self.ui.exc_cnc_tools_table.verticalHeader() vertical_header.hide() - self.ui.exc_cnc_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.exc_cnc_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.exc_cnc_tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeToContents) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) # horizontal_header.setStretchLastSection(True) - self.ui.exc_cnc_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.exc_cnc_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.exc_cnc_tools_table.setColumnWidth(0, 20) self.ui.exc_cnc_tools_table.setColumnWidth(6, 17) @@ -796,7 +796,7 @@ class AppGCodeEditorUI: # CNC Tools Table when made out of Geometry self.cnc_tools_table = FCTable() self.cnc_tools_table.setSortingEnabled(False) - self.cnc_tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.cnc_tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.edit_box.addWidget(self.cnc_tools_table) self.cnc_tools_table.setColumnCount(6) @@ -807,7 +807,7 @@ class AppGCodeEditorUI: # CNC Tools Table when made out of Excellon self.exc_cnc_tools_table = FCTable() self.exc_cnc_tools_table.setSortingEnabled(False) - self.exc_cnc_tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.exc_cnc_tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.edit_box.addWidget(self.exc_cnc_tools_table) self.exc_cnc_tools_table.setColumnCount(6) diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index c01393b4..6a9b96e7 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -172,7 +172,7 @@ class FCTree(QtWidgets.QTreeWidget): self.setColumnCount(columns) self.setHeaderHidden(header_hidden) - self.tree_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) + self.tree_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Expanding) palette = QtGui.QPalette() @@ -185,9 +185,9 @@ class FCTree(QtWidgets.QTreeWidget): self.setPalette(palette) if extended_sel: - self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) - self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.protected_column = protected_column self.itemDoubleClicked.connect(self.on_double_click) @@ -204,9 +204,9 @@ class FCTree(QtWidgets.QTreeWidget): item.setFlags(tmp_flags ^ QtCore.Qt.ItemFlag.ItemIsEditable) def on_header_double_click(self, column): - self.tree_header.setSectionResizeMode(column, QtWidgets.QHeaderView.ResizeToContents) + self.tree_header.setSectionResizeMode(column, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) width = self.tree_header.sectionSize(column) - self.tree_header.setSectionResizeMode(column, QtWidgets.QHeaderView.Interactive) + self.tree_header.setSectionResizeMode(column, QtWidgets.QHeaderView.ResizeMode.Interactive) self.tree_header.resizeSection(column, width) def is_editable(self, tested_col): @@ -276,9 +276,9 @@ class FCTree(QtWidgets.QTreeWidget): def on_resize(self): header = self.header() for column in range(header.count()): - header.setSectionResizeMode(column, QtWidgets.QHeaderView.ResizeToContents) + header.setSectionResizeMode(column, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) width = header.sectionSize(column) - header.setSectionResizeMode(column, QtWidgets.QHeaderView.Interactive) + header.setSectionResizeMode(column, QtWidgets.QHeaderView.ResizeMode.Interactive) header.resizeSection(column, width) @@ -3503,9 +3503,9 @@ class FCTable(QtWidgets.QTableWidget): self.setDragDropOverwriteMode(False) self.setDropIndicatorShown(True) - self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) - self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) - self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove) + self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) + self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) + self.setDragDropMode(QtWidgets.QAbstractItemView.DragDropMode.InternalMove) self.rows_not_for_drag_and_drop = [] if protected_rows: diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index 1799d12e..4d194143 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -2159,7 +2159,7 @@ class MainGUI(QtWidgets.QMainWindow): :return: """ if self.app.defaults["global_toggle_tooltips"] is False: - if event.type() == QtCore.QEvent.ToolTip: + if event.type() == QtCore.QEvent.Type.ToolTip: return True else: return False @@ -2575,7 +2575,7 @@ class MainGUI(QtWidgets.QMainWindow): if self.app.call_source == 'app': # CTRL + ALT - if modifiers == QtCore.Qt.KeyboardModifierControlModifier | QtCore.Qt.KeyboardModifier.AltModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier | QtCore.Qt.KeyboardModifier.AltModifier: if key == QtCore.Qt.Key.Key_X: self.app.abort_all_tasks() return diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py index d8b7f59d..96654f95 100644 --- a/appGUI/ObjectUI.py +++ b/appGUI/ObjectUI.py @@ -660,8 +660,8 @@ class ExcellonObjectUI(ObjectUI): self.drills_frame.setLayout(self.tools_box) self.tools_table = FCTable() - self.tools_table.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) - self.tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.tools_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) + self.tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.tools_box.addWidget(self.tools_table) self.tools_table.setColumnCount(6) @@ -992,7 +992,7 @@ class GeometryObjectUI(ObjectUI): self.geo_tools_table = FCTable(drag_drop=True) grid0.addWidget(self.geo_tools_table, 1, 0, 1, 2) - self.geo_tools_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) + self.geo_tools_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) self.geo_tools_table.setColumnCount(7) self.geo_tools_table.setColumnWidth(0, 20) diff --git a/appGUI/PlotCanvas.py b/appGUI/PlotCanvas.py index 69ef8c64..970cc451 100644 --- a/appGUI/PlotCanvas.py +++ b/appGUI/PlotCanvas.py @@ -127,10 +127,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): # self.create_native() - gui_widget = self.fcapp.ui - - assert isinstance(gui_widget, QtWidgets.QWidget) - self.native.setParent(gui_widget) + self.native.setParent(self.fcapp.ui) axis_default_color = self.fcapp.defaults['global_axis_color'] self.axis_transparency = 0.8 diff --git a/appGUI/PlotCanvasLegacy.py b/appGUI/PlotCanvasLegacy.py index 8d7cc940..b7bb6ea2 100644 --- a/appGUI/PlotCanvasLegacy.py +++ b/appGUI/PlotCanvasLegacy.py @@ -25,11 +25,16 @@ import gettext import appTranslation as fcTranslate import builtins -# Prevent conflict with Qt5 and above. -from matplotlib import use as mpl_use -mpl_use("Qt5Agg") -from matplotlib.figure import Figure -from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas +MATPLOTLIB_AVAILABLE = True +try: + # Prevent conflict with Qt5 and above. + from matplotlib import use as mpl_use + mpl_use("Qt5Agg") + from matplotlib.figure import Figure + from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas +except ImportError: + MATPLOTLIB_AVAILABLE = False + from matplotlib.lines import Line2D from matplotlib.offsetbox import AnchoredText # from matplotlib.widgets import Cursor @@ -143,6 +148,11 @@ class PlotCanvasLegacy(QtCore.QObject): super(PlotCanvasLegacy, self).__init__() + self.status = 'ok' + if MATPLOTLIB_AVAILABLE is False: + self.status = 'fail' + return + self.app = app if self.app.defaults['global_theme'] == 'white': diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py index e9ef017b..9a88712f 100644 --- a/appObjects/FlatCAMCNCJob.py +++ b/appObjects/FlatCAMCNCJob.py @@ -289,23 +289,23 @@ class CNCJobObject(FlatCAMObj, CNCjob): self.ui.cnc_tools_table.resizeRowsToContents() vertical_header = self.ui.cnc_tools_table.verticalHeader() - # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) + # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) vertical_header.hide() - self.ui.cnc_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.cnc_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.cnc_tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(4, 40) - horizontal_header.setSectionResizeMode(6, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(6, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(4, 17) # horizontal_header.setStretchLastSection(True) - self.ui.cnc_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.cnc_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.cnc_tools_table.setColumnWidth(0, 20) self.ui.cnc_tools_table.setColumnWidth(4, 40) @@ -383,22 +383,22 @@ class CNCJobObject(FlatCAMObj, CNCjob): vertical_header = self.ui.exc_cnc_tools_table.verticalHeader() vertical_header.hide() - self.ui.exc_cnc_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.exc_cnc_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.exc_cnc_tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeToContents) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) - horizontal_header.setSectionResizeMode(6, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(6, QtWidgets.QHeaderView.ResizeMode.Fixed) # horizontal_header.setStretchLastSection(True) - self.ui.exc_cnc_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.exc_cnc_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.exc_cnc_tools_table.setColumnWidth(0, 20) self.ui.exc_cnc_tools_table.setColumnWidth(6, 17) diff --git a/appObjects/FlatCAMExcellon.py b/appObjects/FlatCAMExcellon.py index 6cd38feb..812492cf 100644 --- a/appObjects/FlatCAMExcellon.py +++ b/appObjects/FlatCAMExcellon.py @@ -435,21 +435,21 @@ class ExcellonObject(FlatCAMObj, Excellon): vertical_header = self.ui.tools_table.verticalHeader() # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) vertical_header.hide() - self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(4, 17) - horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(5, 17) self.ui.tools_table.setColumnWidth(5, 17) @@ -457,7 +457,7 @@ class ExcellonObject(FlatCAMObj, Excellon): # horizontal_header.setColumnWidth(2, QtWidgets.QHeaderView.ResizeToContents) # horizontal_header.setStretchLastSection(True) - self.ui.tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.tools_table.setSortingEnabled(False) diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py index 03574a7e..1bc1fb45 100644 --- a/appObjects/FlatCAMGeometry.py +++ b/appObjects/FlatCAMGeometry.py @@ -258,24 +258,24 @@ class GeometryObject(FlatCAMObj, Geometry): self.ui.geo_tools_table.resizeRowsToContents() vertical_header = self.ui.geo_tools_table.verticalHeader() - # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) + # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) vertical_header.hide() - self.ui.geo_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.geo_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.geo_tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(4, 40) - horizontal_header.setSectionResizeMode(6, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(6, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(6, 17) # horizontal_header.setStretchLastSection(True) - self.ui.geo_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.geo_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.geo_tools_table.setColumnWidth(0, 20) self.ui.geo_tools_table.setColumnWidth(4, 40) @@ -359,11 +359,11 @@ class GeometryObject(FlatCAMObj, Geometry): # area_hheader.setMinimumSectionSize(10) # area_hheader.setDefaultSectionSize(70) # - # area_hheader.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + # area_hheader.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) # area_hheader.resizeSection(0, 20) - # area_hheader.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - # area_hheader.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - # area_hheader.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) + # area_hheader.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + # area_hheader.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + # area_hheader.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) # # # area_hheader.setStretchLastSection(True) # self.ui.exclusion_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) diff --git a/appObjects/FlatCAMGerber.py b/appObjects/FlatCAMGerber.py index b92c5b52..1d2244de 100644 --- a/appObjects/FlatCAMGerber.py +++ b/appObjects/FlatCAMGerber.py @@ -337,24 +337,24 @@ class GerberObject(FlatCAMObj, Gerber): self.ui.apertures_table.resizeRowsToContents() vertical_header = self.ui.apertures_table.verticalHeader() - # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) + # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) vertical_header.hide() - self.ui.apertures_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.apertures_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.apertures_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 27) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(5, 17) self.ui.apertures_table.setColumnWidth(5, 17) - self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.apertures_table.setSortingEnabled(False) self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight()) self.ui.apertures_table.setMaximumHeight(self.ui.apertures_table.getHeight()) diff --git a/appObjects/ObjectCollection.py b/appObjects/ObjectCollection.py index fac867bb..834a5411 100644 --- a/appObjects/ObjectCollection.py +++ b/appObjects/ObjectCollection.py @@ -122,7 +122,7 @@ class KeySensitiveListView(QtWidgets.QTreeView): self.filename = str(url.toLocalFile()) # file drop from outside application - if drop_indicator == QtWidgets.QAbstractItemView.OnItem: + if drop_indicator == QtWidgets.QAbstractItemView.DropIndicatorPosition.OnItem: if self.filename == "": self.app.inform.emit(_("Cancelled.")) else: @@ -877,7 +877,7 @@ class ObjectCollection(QtCore.QAbstractItemModel): group_index = self.index(group.row(), 0, QtCore.QModelIndex()) item_index = self.index(item.row(), 0, group_index) - self.view.selectionModel().select(item_index, QtCore.QItemSelectionModel.Select) + self.view.selectionModel().select(item_index, QtCore.QItemSelectionModel.SelectionFlag.Select) except Exception as e: self.app.log.error("[ERROR] Cause: %s" % str(e)) raise @@ -919,7 +919,7 @@ class ObjectCollection(QtCore.QAbstractItemModel): group_index = self.index(group.row(), 0, QtCore.QModelIndex()) item_index = self.index(item.row(), 0, group_index) - self.view.selectionModel().select(item_index, QtCore.QItemSelectionModel.Deselect) + self.view.selectionModel().select(item_index, QtCore.QItemSelectionModel.SelectionFlag.Deselect) def set_all_inactive(self): """ diff --git a/appPlugins/ToolCalibration.py b/appPlugins/ToolCalibration.py index 4213f1bc..e350fc60 100644 --- a/appPlugins/ToolCalibration.py +++ b/appPlugins/ToolCalibration.py @@ -948,7 +948,7 @@ class CalibrationUI: grid_lay.addWidget(self.points_table_label, 15, 0, 1, 3) self.points_table = FCTable() - self.points_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.points_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) # self.points_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) grid_lay.addWidget(self.points_table, 16, 0, 1, 3) @@ -1067,23 +1067,23 @@ class CalibrationUI: vertical_header = self.points_table.verticalHeader() vertical_header.hide() - self.points_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.points_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.points_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - self.points_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) + self.points_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) # for x in range(4): # self.points_table.resizeColumnToContents(x) self.points_table.resizeColumnsToContents() self.points_table.resizeRowsToContents() - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Fixed) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Fixed) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.Stretch) self.points_table.setMinimumHeight(self.points_table.getHeight() + 2) self.points_table.setMaximumHeight(self.points_table.getHeight() + 3) diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py index cbbbd893..3794288e 100644 --- a/appPlugins/ToolDrilling.py +++ b/appPlugins/ToolDrilling.py @@ -810,19 +810,19 @@ class ToolDrilling(AppTool, Excellon): vertical_header = self.ui.tools_table.verticalHeader() vertical_header.hide() - self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table.horizontalHeader() - self.ui.tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeToContents) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) self.ui.tools_table.setSortingEnabled(False) @@ -882,20 +882,20 @@ class ToolDrilling(AppTool, Excellon): area_vheader = self.ui.exclusion_table.verticalHeader() area_vheader.hide() - self.ui.exclusion_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.exclusion_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) area_hheader = self.ui.exclusion_table.horizontalHeader() area_hheader.setMinimumSectionSize(10) area_hheader.setDefaultSectionSize(70) - area_hheader.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + area_hheader.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) area_hheader.resizeSection(0, 20) - area_hheader.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - area_hheader.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - area_hheader.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) + area_hheader.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + area_hheader.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + area_hheader.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) # area_hheader.setStretchLastSection(True) - self.ui.exclusion_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.exclusion_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.exclusion_table.setColumnWidth(0, 20) @@ -2800,7 +2800,7 @@ class DrillingUI: self.exclusion_table = FCTable() self.exclusion_box.addWidget(self.exclusion_table) - self.exclusion_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) + self.exclusion_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) self.exclusion_table.setColumnCount(4) self.exclusion_table.setColumnWidth(0, 20) @@ -2815,7 +2815,7 @@ class DrillingUI: _("If the strategy is to go over the area then this is the height at which the tool will go to avoid the " "exclusion area.")) - self.exclusion_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.exclusion_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) grid_a1 = QtWidgets.QGridLayout() grid_a1.setColumnStretch(0, 0) diff --git a/appPlugins/ToolExtract.py b/appPlugins/ToolExtract.py index c10b5848..48c0764a 100644 --- a/appPlugins/ToolExtract.py +++ b/appPlugins/ToolExtract.py @@ -321,14 +321,14 @@ class ToolExtract(AppTool): horizontal_header = self.ui.apertures_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(3, 17) self.ui.apertures_table.setColumnWidth(3, 17) - self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.apertures_table.setSortingEnabled(False) # self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight()) # self.ui.apertures_table.setMaximumHeight(self.ui.apertures_table.getHeight()) @@ -1022,7 +1022,7 @@ class ExtractUI: sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.apertures_table.setSizePolicy(sizePolicy) - self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) + self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.MultiSelection) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) diff --git a/appPlugins/ToolFiducials.py b/appPlugins/ToolFiducials.py index 2b112f8c..8ce7f032 100644 --- a/appPlugins/ToolFiducials.py +++ b/appPlugins/ToolFiducials.py @@ -812,7 +812,7 @@ class FidoUI: self.layout.addWidget(self.points_label) self.points_table = FCTable() - self.points_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.points_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.points_table.setColumnCount(3) self.points_table.setHorizontalHeaderLabels( @@ -863,22 +863,22 @@ class FidoUI: vertical_header = self.points_table.verticalHeader() vertical_header.hide() - self.points_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.points_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.points_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - self.points_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) + self.points_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) # for x in range(4): # self.points_table.resizeColumnToContents(x) self.points_table.resizeColumnsToContents() self.points_table.resizeRowsToContents() - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Fixed) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Fixed) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.Stretch) self.points_table.setMinimumHeight(self.points_table.getHeight() + 2) self.points_table.setMaximumHeight(self.points_table.getHeight() + 2) diff --git a/appPlugins/ToolIsolation.py b/appPlugins/ToolIsolation.py index 20c35ce2..f5f1fb8b 100644 --- a/appPlugins/ToolIsolation.py +++ b/appPlugins/ToolIsolation.py @@ -614,13 +614,13 @@ class ToolIsolation(AppTool, Gerber): vertical_header = self.ui.tools_table.verticalHeader() vertical_header.hide() - self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) # self.ui.tools_table.setSortingEnabled(True) # sort by tool diameter @@ -3237,7 +3237,7 @@ class IsoUI: self.tools_table.setHorizontalHeaderLabels(['#', _('Diameter'), _('Shape'), '']) self.tools_table.setColumnHidden(3, True) self.tools_table.setSortingEnabled(False) - # self.tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + # self.tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) self.tools_table.horizontalHeaderItem(0).setToolTip( _("This is the Tool Number.\n" diff --git a/appPlugins/ToolLevelling.py b/appPlugins/ToolLevelling.py index 04d98e6f..21c91772 100644 --- a/appPlugins/ToolLevelling.py +++ b/appPlugins/ToolLevelling.py @@ -288,15 +288,15 @@ class ToolLevelling(AppTool, CNCjob): self.ui.al_probe_points_table.resizeRowsToContents() v_header = self.ui.al_probe_points_table.verticalHeader() v_header.hide() - self.ui.al_probe_points_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.al_probe_points_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) h_header = self.ui.al_probe_points_table.horizontalHeader() h_header.setMinimumSectionSize(10) h_header.setDefaultSectionSize(70) - h_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + h_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) h_header.resizeSection(0, 20) - h_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - h_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) + h_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + h_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) self.ui.al_probe_points_table.setMinimumHeight(self.ui.al_probe_points_table.getHeight()) self.ui.al_probe_points_table.setMaximumHeight(self.ui.al_probe_points_table.getHeight()) @@ -461,10 +461,10 @@ class ToolLevelling(AppTool, CNCjob): h_header = self.ui.al_probe_points_table.horizontalHeader() h_header.setMinimumSectionSize(10) h_header.setDefaultSectionSize(70) - h_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + h_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) h_header.resizeSection(0, 20) - h_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - h_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) + h_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + h_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) self.ui.al_probe_points_table.setMinimumHeight(self.ui.al_probe_points_table.getHeight()) self.ui.al_probe_points_table.setMaximumHeight(self.ui.al_probe_points_table.getHeight()) diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index e5651f06..fecca725 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -966,20 +966,20 @@ class ToolMilling(AppTool, Excellon): area_vheader = self.ui.exclusion_table.verticalHeader() area_vheader.hide() - self.ui.exclusion_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.exclusion_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) area_hheader = self.ui.exclusion_table.horizontalHeader() area_hheader.setMinimumSectionSize(10) area_hheader.setDefaultSectionSize(70) - area_hheader.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + area_hheader.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) area_hheader.resizeSection(0, 20) - area_hheader.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - area_hheader.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - area_hheader.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) + area_hheader.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + area_hheader.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + area_hheader.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) # area_hheader.setStretchLastSection(True) - self.ui.exclusion_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.exclusion_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.exclusion_table.setColumnWidth(0, 20) @@ -1072,20 +1072,20 @@ class ToolMilling(AppTool, Excellon): vertical_header = self.ui.geo_tools_table.verticalHeader() # vertical_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) vertical_header.hide() - self.ui.geo_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.geo_tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.geo_tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) # horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Fixed) # horizontal_header.resizeSection(2, 40) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(4, 17) # horizontal_header.setStretchLastSection(True) - self.ui.geo_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.geo_tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.geo_tools_table.setColumnWidth(0, 20) # self.ui.geo_tools_table.setColumnWidth(2, 40) @@ -1239,19 +1239,19 @@ class ToolMilling(AppTool, Excellon): vertical_header = self.ui.tools_table.verticalHeader() vertical_header.hide() - self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table.horizontalHeader() - self.ui.tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeToContents) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) self.ui.tools_table.setSortingEnabled(False) @@ -3667,8 +3667,8 @@ class MillingUI: # Tool Table for Geometry self.geo_tools_table = FCTable(drag_drop=False) - self.geo_tools_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) - self.geo_tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.geo_tools_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) + self.geo_tools_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) grid0.addWidget(self.geo_tools_table, 12, 0, 1, 2) @@ -4409,7 +4409,7 @@ class MillingUI: self.exclusion_table = FCTable() self.exclusion_box.addWidget(self.exclusion_table) - self.exclusion_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) + self.exclusion_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) self.exclusion_table.setColumnCount(4) self.exclusion_table.setColumnWidth(0, 20) @@ -4424,7 +4424,7 @@ class MillingUI: _("If the strategy is to go over the area then this is the height at which the tool will go to avoid the " "exclusion area.")) - self.exclusion_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.exclusion_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows) grid_a1 = QtWidgets.QGridLayout() grid_a1.setColumnStretch(0, 0) diff --git a/appPlugins/ToolNCC.py b/appPlugins/ToolNCC.py index b66e7290..fabce9a8 100644 --- a/appPlugins/ToolNCC.py +++ b/appPlugins/ToolNCC.py @@ -870,13 +870,13 @@ class NonCopperClear(AppTool, Gerber): vertical_header = self.ui.tools_table.verticalHeader() vertical_header.hide() - self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) self.ui.tools_table.setMinimumHeight(self.ui.tools_table.getHeight()) self.ui.tools_table.setMaximumHeight(self.ui.tools_table.getHeight()) diff --git a/appPlugins/ToolPaint.py b/appPlugins/ToolPaint.py index fcaef728..c80f5c81 100644 --- a/appPlugins/ToolPaint.py +++ b/appPlugins/ToolPaint.py @@ -797,13 +797,13 @@ class ToolPaint(AppTool, Gerber): vertical_header = self.ui.tools_table.verticalHeader() vertical_header.hide() - self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) # self.ui.tools_table.setSortingEnabled(True) # sort by tool diameter diff --git a/appPlugins/ToolPcbWizard.py b/appPlugins/ToolPcbWizard.py index 0f729424..319a0239 100644 --- a/appPlugins/ToolPcbWizard.py +++ b/appPlugins/ToolPcbWizard.py @@ -183,15 +183,15 @@ class PcbWizard(AppTool): vertical_header = self.ui.tools_table.verticalHeader() vertical_header.hide() - self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table.horizontalHeader() # horizontal_header.setMinimumSectionSize(10) # horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) - self.ui.tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.tools_table.setSortingEnabled(False) self.ui.tools_table.setMinimumHeight(self.ui.tools_table.getHeight()) self.ui.tools_table.setMaximumHeight(self.ui.tools_table.getHeight()) diff --git a/appPlugins/ToolPunchGerber.py b/appPlugins/ToolPunchGerber.py index 38ba8ef8..697c849b 100644 --- a/appPlugins/ToolPunchGerber.py +++ b/appPlugins/ToolPunchGerber.py @@ -358,14 +358,14 @@ class ToolPunchGerber(AppTool, Gerber): horizontal_header = self.ui.apertures_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) horizontal_header.setDefaultSectionSize(70) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) - horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) - horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(3, 17) self.ui.apertures_table.setColumnWidth(3, 17) - self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.ui.apertures_table.setSortingEnabled(False) # self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight()) # self.ui.apertures_table.setMaximumHeight(self.ui.apertures_table.getHeight()) @@ -2099,9 +2099,10 @@ class PunchUI: self.apertures_table.horizontalHeaderItem(3).setToolTip( _("Mark the aperture instances on canvas.")) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.apertures_table.setSizePolicy(sizePolicy) - self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) + self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.MultiSelection) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) diff --git a/appPlugins/ToolSolderPaste.py b/appPlugins/ToolSolderPaste.py index bd297935..4a90ff07 100644 --- a/appPlugins/ToolSolderPaste.py +++ b/appPlugins/ToolSolderPaste.py @@ -286,13 +286,13 @@ class SolderPaste(AppTool): vertical_header = self.ui.tools_table.verticalHeader() vertical_header.hide() - self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.ui.tools_table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) horizontal_header = self.ui.tools_table.horizontalHeader() horizontal_header.setMinimumSectionSize(10) - horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) + horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) - horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) + horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) # self.ui.tools_table.setSortingEnabled(True) # sort by tool diameter diff --git a/appTool.py b/appTool.py index df78e1d2..b8eabc76 100644 --- a/appTool.py +++ b/appTool.py @@ -6,7 +6,7 @@ # MIT Licence # # ########################################################## ## -from PyQt6 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets, QtGui from shapely.geometry import Polygon, LineString diff --git a/app_Main.py b/app_Main.py index 77727ab0..7df8e784 100644 --- a/app_Main.py +++ b/app_Main.py @@ -1128,12 +1128,17 @@ class App(QtCore.QObject): color=QtGui.QColor("gray")) start_plot_time = time.time() # debug - self.log.debug("Setting up canvas: %s" % str(self.defaults["global_graphic_engine"])) - # setup the PlotCanvas self.plotcanvas = self.on_plotcanvas_setup() if self.plotcanvas == 'fail': - return + self.splash.finish(self.ui) + self.log.debug("Failed to start the Canvas.") + + # terminate workers + # self.workers.__del__() + self.clear_pool() + + raise BaseException("Failed to start the Canvas") # add he PlotCanvas setup to the UI self.on_plotcanvas_add(self.plotcanvas, self.ui.right_layout) @@ -7565,7 +7570,7 @@ class App(QtCore.QObject): else: self.call_source = 'app' except Exception as e: - self.log.error("[ERROR] Something went bad in App.select_objects(). %s" % str(e)) + self.log.error("Something went bad in App.select_objects(). %s" % str(e)) def selected_message(self, curr_sel_obj): """ @@ -8400,10 +8405,16 @@ class App(QtCore.QObject): plot_container = self.ui.right_layout modifier = QtWidgets.QApplication.queryKeyboardModifiers() + if modifier == QtCore.Qt.KeyboardModifier.ControlModifier: + self.defaults["global_graphic_engine"] = "2D" + + self.log.debug("Setting up canvas: %s" % str(self.defaults["global_graphic_engine"])) + if self.is_legacy is True or modifier == QtCore.Qt.KeyboardModifier.ControlModifier: self.is_legacy = True - self.defaults["global_graphic_engine"] = "2D" plotcanvas = PlotCanvasLegacy(self) + if plotcanvas.status != 'ok': + return 'fail' else: try: plotcanvas = PlotCanvas(self)