diff --git a/Bookmark.py b/Bookmark.py index 84814d17..9edcdeb0 100644 --- a/Bookmark.py +++ b/Bookmark.py @@ -1,4 +1,4 @@ -from PyQt5 import QtGui, QtCore, QtWidgets +from PyQt6 import QtGui, QtCore, QtWidgets from appGUI.GUIElements import FCTable, FCEntry, FCButton, FCFileSaveDialog import sys @@ -149,7 +149,7 @@ class BookmarkManager(QtWidgets.QWidget): weblink = bookmark[1] id_item = QtWidgets.QTableWidgetItem('%d' % int(nr_crt)) - # id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # id.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.table_widget.setItem(row, 0, id_item) # Tool name/id title_item = QtWidgets.QTableWidgetItem(title) @@ -157,7 +157,7 @@ class BookmarkManager(QtWidgets.QWidget): weblink_txt = QtWidgets.QTextBrowser() weblink_txt.setOpenExternalLinks(True) - weblink_txt.setFrameStyle(QtWidgets.QFrame.NoFrame) + weblink_txt.setFrameStyle(QtWidgets.QFrame.Shape.NoFrame) weblink_txt.document().setDefaultStyleSheet("a{ text-decoration: none; }") weblink_txt.setHtml('%s' % (weblink, weblink)) @@ -222,7 +222,7 @@ class BookmarkManager(QtWidgets.QWidget): # add the link to the menu but only if it is within the set limit bm_limit = int(self.app.defaults["global_bookmarks_limit"]) if len(self.bm_dict) < bm_limit: - act = QtWidgets.QAction(parent=self.app.ui.menuhelp_bookmarks) + act = QtGui.QAction(parent=self.app.ui.menuhelp_bookmarks) act.setText(title) act.setIcon(QtGui.QIcon(self.app.resource_location + '/link16.png')) act.triggered.connect(lambda: webbrowser.open(link)) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f8f5397..e5f891a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta 4.08.2021 - toggling the plot is now deleting the selection shape, if any +- porting to PyQt6 23.07.2021 diff --git a/FlatCAM.py b/FlatCAM.py index ff996cf5..2c378a12 100644 --- a/FlatCAM.py +++ b/FlatCAM.py @@ -3,8 +3,8 @@ import os import traceback from datetime import datetime -from PyQt5 import QtWidgets -from PyQt5.QtCore import QSettings, Qt +from PyQt6 import QtWidgets +from PyQt6.QtCore import QSettings, Qt from app_Main import App from appGUI import VisPyPatches @@ -25,7 +25,7 @@ def debug_trace(): Set a tracepoint in the Python debugger that works with Qt :return: None """ - from PyQt5.QtCore import pyqtRemoveInputHook + from PyQt6.QtCore import pyqtRemoveInputHook # from pdb import set_trace pyqtRemoveInputHook() # set_trace() @@ -123,10 +123,10 @@ if __name__ == '__main__': # else: # QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, False) - if hdpi_support == 2: - QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) - else: - QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, False) + # if hdpi_support == 2: + # QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) + # else: + # QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, False) def excepthook(exc_type, exc_value, exc_tb): @@ -149,7 +149,7 @@ if __name__ == '__main__': sys.excepthook = excepthook app = QtWidgets.QApplication(sys.argv) - app.setAttribute(Qt.AA_UseHighDpiPixmaps) + # app.setAttribute(Qt.AA_UseHighDpiPixmaps) # apply style settings = QSettings("Open Source", "FlatCAM") @@ -159,5 +159,5 @@ if __name__ == '__main__': fc = App(qapp=app) - sys.exit(app.exec_()) + sys.exit(app.exec()) # app.exec_() diff --git a/appCommon/Common.py b/appCommon/Common.py index c6eae3bc..04970e44 100644 --- a/appCommon/Common.py +++ b/appCommon/Common.py @@ -10,7 +10,7 @@ # File Modified (major mod): Marius Adrian Stanciu # # Date: 11/4/2019 # # ########################################################## -from PyQt5 import QtCore +from PyQt6 import QtCore from shapely.geometry import Polygon, Point, LineString from shapely.ops import unary_union diff --git a/appDatabase.py b/appDatabase.py index 898c9d1f..208caf20 100644 --- a/appDatabase.py +++ b/appDatabase.py @@ -1,4 +1,4 @@ -from PyQt5 import QtGui, QtCore, QtWidgets +from PyQt6 import QtGui, QtCore, QtWidgets from appGUI.GUIElements import FCEntry, FCButton, FCDoubleSpinner, FCComboBox, FCCheckBox, FCSpinner, \ FCTree, RadioSet, FCFileSaveDialog, FCLabel, FCComboBox2 from camlib import to_dict @@ -37,7 +37,7 @@ class ToolsDB2UI: self.tree_widget = FCTree(columns=3, header_hidden=False, protected_column=[0, 2, 3]) self.tree_widget.setHeaderLabels([_("ID"), _("Name"), _("Target"), _("Diameter")]) self.tree_widget.setIndentation(0) - self.tree_widget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.tree_widget.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu) self.tree_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) # set alternating colors @@ -46,7 +46,7 @@ class ToolsDB2UI: # p.setColor(QtGui.QPalette.AlternateBase, QtGui.QColor(226, 237, 253) ) # self.tree_widget.setPalette(p) - self.tree_widget.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) + self.tree_widget.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding) tree_layout.addWidget(self.tree_widget) param_hlay = QtWidgets.QHBoxLayout() @@ -75,7 +75,7 @@ class ToolsDB2UI: self.description_vlay = QtWidgets.QVBoxLayout() self.tool_description_box.setTitle(_("Tool Description")) self.tool_description_box.setMinimumWidth(250) - self.tool_description_box.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) + self.tool_description_box.setSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Minimum) # Milling box self.milling_box = QtWidgets.QGroupBox() @@ -329,8 +329,8 @@ class ToolsDB2UI: self.grid0.addWidget(self.mill_vangle_entry, 6, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid0.addWidget(separator_line, 8, 0, 1, 2) # Tool Type @@ -383,8 +383,8 @@ class ToolsDB2UI: self.grid0.addWidget(self.mill_custom_offset_entry, 14, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid0.addWidget(separator_line, 16, 0, 1, 2) # Cut Z @@ -477,8 +477,8 @@ class ToolsDB2UI: self.grid0.addWidget(self.mill_ecut_length_entry, 28, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid0.addWidget(separator_line, 30, 0, 1, 2) # Feedrate X-Y @@ -526,8 +526,8 @@ class ToolsDB2UI: self.grid0.addWidget(self.mill_frapids_entry, 36, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid0.addWidget(separator_line, 38, 0, 1, 2) # Spindle Spped @@ -979,8 +979,8 @@ class ToolsDB2UI: self.grid5.addWidget(self.drill_travelz_entry, 10, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid5.addWidget(separator_line, 12, 0, 1, 2) # Excellon Feedrate Z @@ -1019,8 +1019,8 @@ class ToolsDB2UI: self.grid5.addWidget(self.drill_feedrate_rapid_entry, 16, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid5.addWidget(separator_line, 18, 0, 1, 2) # Spindlespeed @@ -1066,8 +1066,8 @@ class ToolsDB2UI: self.grid5.addWidget(self.drill_dwelltime_entry, 22, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid5.addWidget(separator_line, 24, 0, 1, 2) # Drill slots @@ -1794,9 +1794,9 @@ class ToolsDB2(QtWidgets.QWidget): try: item = self.ui.tree_widget.addParentEditable( parent=parent, title=[str(row+1), t_name, op_name, str(dia)], editable=True) - item.setData(1, QtCore.Qt.ToolTipRole, t_name) - item.setData(2, QtCore.Qt.ToolTipRole, op_name) - item.setData(3, QtCore.Qt.ToolTipRole, str(dia)) + item.setData(1, QtCore.Qt.ItemDataRole.ToolTipRole, t_name) + item.setData(2, QtCore.Qt.ItemDataRole.ToolTipRole, op_name) + item.setData(3, QtCore.Qt.ItemDataRole.ToolTipRole, str(dia)) except Exception as e: self.app.log.error('FlatCAMCoomn.ToolDB2.build_db_ui() -> ', str(e)) @@ -2068,7 +2068,7 @@ class ToolsDB2(QtWidgets.QWidget): """ new_tool_id = len(self.db_tool_dict) for item in self.ui.tree_widget.selectedItems(): - old_tool_id = item.data(0, QtCore.Qt.DisplayRole) + old_tool_id = item.data(0, QtCore.Qt.ItemDataRole.DisplayRole) for toolid, dict_val in list(self.db_tool_dict.items()): if int(old_tool_id) == int(toolid): @@ -2100,7 +2100,7 @@ class ToolsDB2(QtWidgets.QWidget): :return: """ for item in self.ui.tree_widget.selectedItems(): - pluginName_to_remove = item.data(0, QtCore.Qt.DisplayRole) + pluginName_to_remove = item.data(0, QtCore.Qt.ItemDataRole.DisplayRole) for toolid, dict_val in list(self.db_tool_dict.items()): if int(pluginName_to_remove) == int(toolid): @@ -2419,7 +2419,7 @@ class ToolsDB2(QtWidgets.QWidget): return # I'm setting the value for the second column (designated by 1) because first column holds the ID # and second column holds the Name (this behavior is set in the build_ui method) - item.setData(1, QtCore.Qt.DisplayRole, val) + item.setData(1, QtCore.Qt.ItemDataRole.DisplayRole, val) def update_tree_target(self): val = self.ui.tool_op_combo.get_value() @@ -2438,7 +2438,7 @@ class ToolsDB2(QtWidgets.QWidget): if item is None: return # I'm setting the value for the third column (designated by 2) because first column holds the ID - item.setData(2, QtCore.Qt.DisplayRole, op_name) + item.setData(2, QtCore.Qt.ItemDataRole.DisplayRole, op_name) header = self.ui.tree_widget.header() header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) @@ -2452,7 +2452,7 @@ class ToolsDB2(QtWidgets.QWidget): if item is None: return # I'm setting the value for the forth column (designated by 3) because first column holds the ID - item.setData(3, QtCore.Qt.DisplayRole, val) + item.setData(3, QtCore.Qt.ItemDataRole.DisplayRole, val) def update_storage(self): """ @@ -2465,13 +2465,13 @@ class ToolsDB2(QtWidgets.QWidget): try: wdg = self.sender() - assert isinstance(wdg, QtWidgets.QWidget) or isinstance(wdg, QtWidgets.QAction), \ + assert isinstance(wdg, QtWidgets.QWidget) or isinstance(wdg, QtGui.QAction), \ "Expected a QWidget got %s" % type(wdg) if wdg is None: return - if isinstance(wdg, FCButton) or isinstance(wdg, QtWidgets.QAction): + if isinstance(wdg, FCButton) or isinstance(wdg, QtGui.QAction): # this is called when adding a new tool; no need to run the update below since that section is for # when editing a tool self.on_tools_db_edited() @@ -2494,7 +2494,7 @@ class ToolsDB2(QtWidgets.QWidget): # for now change values only for one tool at once sel_rows = [] for item in self.ui.tree_widget.selectedItems(): - sel_rows.append(item.data(0, QtCore.Qt.DisplayRole)) + sel_rows.append(item.data(0, QtCore.Qt.ItemDataRole.DisplayRole)) len_sel_rows = len(sel_rows) if len_sel_rows > 1: @@ -2663,7 +2663,7 @@ class ToolsDB2(QtWidgets.QWidget): return for item in self.ui.tree_widget.selectedItems(): - tool_uid = item.data(0, QtCore.Qt.DisplayRole) + tool_uid = item.data(0, QtCore.Qt.ItemDataRole.DisplayRole) for key in self.db_tool_dict.keys(): if str(key) == str(tool_uid): @@ -3064,8 +3064,8 @@ class ToolsDB2(QtWidgets.QWidget): # # nr_crt = row + 1 # id_item = QtWidgets.QTableWidgetItem('%d' % int(nr_crt)) -# # id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) -# flags = id_item.flags() & ~QtCore.Qt.ItemIsEditable +# # id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) +# flags = id_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable # id_item.setFlags(flags) # widget.setItem(row, 0, id_item) # Tool name/id # diff --git a/appEditors/AppExcEditor.py b/appEditors/AppExcEditor.py index 39cfdba6..4bad092e 100644 --- a/appEditors/AppExcEditor.py +++ b/appEditors/AppExcEditor.py @@ -5,8 +5,8 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.QtCore import Qt +from PyQt6 import QtGui, QtCore, QtWidgets +from PyQt6.QtCore import Qt from camlib import distance, arc, FlatCAMRTreeStorage from appGUI.GUIElements import FCEntry, FCTable, FCDoubleSpinner, RadioSet, FCSpinner, FCButton, FCLabel @@ -64,9 +64,9 @@ class SelectEditorExc(FCShapeTool): def click(self, point): key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None @@ -115,9 +115,9 @@ class SelectEditorExc(FCShapeTool): else: modifiers = QtWidgets.QApplication.keyboardModifiers() - if modifiers == QtCore.Qt.ShiftModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif modifiers == QtCore.Qt.ControlModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None @@ -183,7 +183,7 @@ class SelectEditorExc(FCShapeTool): # obj_to_add = over_shape_list[int(AppExcEditor.draw_shape_idx)] # # if self.draw_app.app.defaults["global_mselect_key"] == 'Shift': - # if self.draw_app.modifiers == Qt.ShiftModifier: + # if self.draw_app.modifiers == Qt.KeyboardModifier.ShiftModifier: # if obj_to_add in self.draw_app.selected: # self.draw_app.selected.remove(obj_to_add) # else: @@ -194,7 +194,7 @@ class SelectEditorExc(FCShapeTool): # else: # # if CONTROL key is pressed then we add to the selected list the current shape but if it's already # # in the selected list, we removed it. Therefore first click selects, second deselects. - # if self.draw_app.modifiers == Qt.ControlModifier: + # if self.draw_app.modifiers == Qt.KeyboardModifier.ControlModifier: # if obj_to_add in self.draw_app.selected: # self.draw_app.selected.remove(obj_to_add) # else: @@ -602,9 +602,9 @@ class DrillArray(FCShapeTool): def on_key(self, key): key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None @@ -613,7 +613,7 @@ class DrillArray(FCShapeTool): pass elif mod_key is None: # Toggle Drill Array Direction - if key == QtCore.Qt.Key_Space: + if key == QtCore.Qt.Key.Key_Space: if self.draw_app.ui.drill_axis_radio.get_value() == 'X': self.draw_app.ui.drill_axis_radio.set_value('Y') elif self.draw_app.ui.drill_axis_radio.get_value() == 'Y': @@ -828,7 +828,7 @@ class SlotAdd(FCShapeTool): def on_key(self, key): # Toggle Pad Direction - if key == QtCore.Qt.Key_Space: + if key == QtCore.Qt.Key.Key_Space: if self.draw_app.ui.slot_axis_radio.get_value() == 'X': self.draw_app.ui.slot_axis_radio.set_value('Y') elif self.draw_app.ui.slot_axis_radio.get_value() == 'Y': @@ -1243,16 +1243,16 @@ class SlotArray(FCShapeTool): def on_key(self, key): key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None if mod_key == 'Control': # Toggle Pad Array Direction - if key == QtCore.Qt.Key_Space: + if key == QtCore.Qt.Key.Key_Space: if self.draw_app.ui.slot_array_axis_radio.get_value() == 'X': self.draw_app.ui.slot_array_axis_radio.set_value('Y') elif self.draw_app.ui.slot_array_axis_radio.get_value() == 'Y': @@ -1264,7 +1264,7 @@ class SlotArray(FCShapeTool): self.draw_app.update_utility_geometry(data=(self.draw_app.snap_x, self.draw_app.snap_y)) elif mod_key is None: # Toggle Pad Direction - if key == QtCore.Qt.Key_Space: + if key == QtCore.Qt.Key.Key_Space: if self.draw_app.ui.slot_axis_radio.get_value() == 'X': self.draw_app.ui.slot_axis_radio.set_value('Y') elif self.draw_app.ui.slot_axis_radio.get_value() == 'Y': @@ -2091,7 +2091,7 @@ class AppExcEditor(QtCore.QObject): self.tot_slot_cnt += slot_cnt idd = QtWidgets.QTableWidgetItem('%d' % int(tool_id)) - idd.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + idd.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table_exc.setItem(self.tool_row, 0, idd) # Tool name/id # Make sure that the drill diameter when in MM is with no more than 2 decimals @@ -2099,17 +2099,17 @@ class AppExcEditor(QtCore.QObject): # For INCH the decimals should be no more than 4. There are no drills under 10mils dia = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, self.olddia_newdia[tool_no])) - dia.setFlags(QtCore.Qt.ItemIsEnabled) + dia.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) drill_count = QtWidgets.QTableWidgetItem('%d' % drill_cnt) - drill_count.setFlags(QtCore.Qt.ItemIsEnabled) + drill_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # if the slot number is zero is better to not clutter the GUI with zero's so we print a space if slot_cnt > 0: slot_count = QtWidgets.QTableWidgetItem('%d' % slot_cnt) else: slot_count = QtWidgets.QTableWidgetItem('') - slot_count.setFlags(QtCore.Qt.ItemIsEnabled) + slot_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table_exc.setItem(self.tool_row, 1, dia) # Diameter self.ui.tools_table_exc.setItem(self.tool_row, 2, drill_count) # Number of drills per tool @@ -2124,7 +2124,7 @@ class AppExcEditor(QtCore.QObject): # make the diameter column editable for row in range(self.tool_row): self.ui.tools_table_exc.item(row, 1).setFlags( - QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + QtCore.Qt.ItemFlag.ItemIsEditable | QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table_exc.item(row, 2).setForeground(QtGui.QColor(0, 0, 0)) self.ui.tools_table_exc.item(row, 3).setForeground(QtGui.QColor(0, 0, 0)) @@ -2134,15 +2134,15 @@ class AppExcEditor(QtCore.QObject): empty = QtWidgets.QTableWidgetItem('9998') empty.setForeground(QtGui.QColor(255, 255, 255)) - empty.setFlags(empty.flags() ^ QtCore.Qt.ItemIsEnabled) + empty.setFlags(empty.flags() ^ QtCore.Qt.ItemFlag.ItemIsEnabled) empty_b = QtWidgets.QTableWidgetItem('') - empty_b.setFlags(empty_b.flags() ^ QtCore.Qt.ItemIsEnabled) + empty_b.setFlags(empty_b.flags() ^ QtCore.Qt.ItemFlag.ItemIsEnabled) label_tot_drill_count = QtWidgets.QTableWidgetItem(_('Total Drills')) tot_drill_count = QtWidgets.QTableWidgetItem('%d' % self.tot_drill_cnt) - label_tot_drill_count.setFlags(label_tot_drill_count.flags() ^ QtCore.Qt.ItemIsEnabled) - tot_drill_count.setFlags(tot_drill_count.flags() ^ QtCore.Qt.ItemIsEnabled) + label_tot_drill_count.setFlags(label_tot_drill_count.flags() ^ QtCore.Qt.ItemFlag.ItemIsEnabled) + tot_drill_count.setFlags(tot_drill_count.flags() ^ QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table_exc.setItem(self.tool_row, 0, empty) self.ui.tools_table_exc.setItem(self.tool_row, 1, label_tot_drill_count) @@ -2165,15 +2165,15 @@ class AppExcEditor(QtCore.QObject): empty_2 = QtWidgets.QTableWidgetItem('9999') empty_2.setForeground(QtGui.QColor(255, 255, 255)) - empty_2.setFlags(empty_2.flags() ^ QtCore.Qt.ItemIsEnabled) + empty_2.setFlags(empty_2.flags() ^ QtCore.Qt.ItemFlag.ItemIsEnabled) empty_3 = QtWidgets.QTableWidgetItem('') - empty_3.setFlags(empty_3.flags() ^ QtCore.Qt.ItemIsEnabled) + empty_3.setFlags(empty_3.flags() ^ QtCore.Qt.ItemFlag.ItemIsEnabled) label_tot_slot_count = QtWidgets.QTableWidgetItem(_('Total Slots')) tot_slot_count = QtWidgets.QTableWidgetItem('%d' % self.tot_slot_cnt) - label_tot_slot_count.setFlags(label_tot_slot_count.flags() ^ QtCore.Qt.ItemIsEnabled) - tot_slot_count.setFlags(tot_slot_count.flags() ^ QtCore.Qt.ItemIsEnabled) + label_tot_slot_count.setFlags(label_tot_slot_count.flags() ^ QtCore.Qt.ItemFlag.ItemIsEnabled) + tot_slot_count.setFlags(tot_slot_count.flags() ^ QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table_exc.setItem(self.tool_row, 0, empty_2) self.ui.tools_table_exc.setItem(self.tool_row, 1, label_tot_slot_count) @@ -3190,9 +3190,9 @@ class AppExcEditor(QtCore.QObject): def on_row_selected(self, row, col): key_modifier = QtWidgets.QApplication.keyboardModifiers() if self.app.defaults["global_mselect_key"] == 'Control': - modifier_to_use = Qt.ControlModifier + modifier_to_use = Qt.KeyboardModifier.ControlModifier else: - modifier_to_use = Qt.ShiftModifier + modifier_to_use = Qt.KeyboardModifier.ShiftModifier if key_modifier == modifier_to_use: pass @@ -3254,9 +3254,9 @@ class AppExcEditor(QtCore.QObject): # else return to the current tool key_modifier = QtWidgets.QApplication.keyboardModifiers() if self.app.defaults["global_mselect_key"] == 'Control': - modifier_to_use = Qt.ControlModifier + modifier_to_use = Qt.KeyboardModifier.ControlModifier else: - modifier_to_use = Qt.ShiftModifier + modifier_to_use = Qt.KeyboardModifier.ShiftModifier # if modifier key is pressed then we add to the selected list the current shape but if it's already # in the selected list, we removed it. Therefore first click selects, second deselects. @@ -3563,9 +3563,9 @@ class AppExcEditor(QtCore.QObject): # detect if a modifier key was pressed while the left mouse button was released self.modifiers = QtWidgets.QApplication.keyboardModifiers() - if self.modifiers == QtCore.Qt.ShiftModifier: + if self.modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: modifiers = 'Shift' - elif self.modifiers == QtCore.Qt.ControlModifier: + elif self.modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: modifiers = 'Control' if modifiers == self.app.defaults["global_mselect_key"]: @@ -3981,7 +3981,7 @@ class AppExcEditorUI: self.icon.setPixmap(pixmap) self.title_label = FCLabel("%s" % _('Excellon Editor')) - self.title_label.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.title_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.title_box.addWidget(self.icon, stretch=0) self.title_box.addWidget(self.title_label, stretch=1) @@ -3995,7 +3995,7 @@ class AppExcEditorUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -4030,8 +4030,8 @@ class AppExcEditorUI: self.ui_vertical_lay.addWidget(self.tools_table_exc) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.ui_vertical_lay.addWidget(separator_line) self.convert_slots_btn = FCButton('%s' % _("Convert Slots")) @@ -4043,8 +4043,8 @@ class AppExcEditorUI: self.ui_vertical_lay.addWidget(self.convert_slots_btn) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.ui_vertical_lay.addWidget(separator_line) # Add a new Tool @@ -4099,8 +4099,8 @@ class AppExcEditorUI: grid1.addWidget(self.deltool_btn, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid1.addWidget(separator_line, 4, 0, 1, 2) # ############################################################################################################# @@ -4132,7 +4132,7 @@ class AppExcEditorUI: hlay2 = QtWidgets.QHBoxLayout() self.resdrill_entry = FCDoubleSpinner(policy=False) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.resdrill_entry.setSizePolicy(sizePolicy) self.resdrill_entry.set_precision(self.decimals) self.resdrill_entry.set_range(0.0000, 10000.0000) @@ -4151,8 +4151,8 @@ class AppExcEditorUI: self.resize_grid.addLayout(hlay2, 2, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.resize_grid.addWidget(separator_line, 6, 0, 1, 2) self.resize_frame.hide() @@ -4299,8 +4299,8 @@ class AppExcEditorUI: self.circ_grid.addWidget(self.drill_angle_entry, 2, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.array_grid.addWidget(separator_line, 10, 0, 1, 2) # ############################################################################################################# @@ -4376,8 +4376,8 @@ class AppExcEditorUI: self.slot_grid.addWidget(self.slot_angle_spinner, 6, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.slot_grid.addWidget(separator_line, 8, 0, 1, 2) # ############################################################################################################# diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index 18b9ab76..cfaa3763 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -11,8 +11,8 @@ # Date: 3/10/2019 # # ######################################################### ## -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.QtCore import Qt +from PyQt6 import QtGui, QtCore, QtWidgets +from PyQt6.QtCore import Qt # import inspect @@ -776,8 +776,8 @@ class TransformEditorTool(AppTool): grid0.addWidget(self.point_button, 2, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 5, 0, 1, 3) # ## Rotate Title @@ -813,8 +813,8 @@ class TransformEditorTool(AppTool): grid0.addWidget(self.rotate_button, 7, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 8, 0, 1, 3) # ## Skew Title @@ -875,8 +875,8 @@ class TransformEditorTool(AppTool): logic=False) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 14, 0, 1, 3) # ## Scale Title @@ -939,8 +939,8 @@ class TransformEditorTool(AppTool): ], logic=False) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 21, 0, 1, 3) # ## Flip Title @@ -964,8 +964,8 @@ class TransformEditorTool(AppTool): hlay0.addWidget(self.flipy_button) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 27, 0, 1, 3) # ## Offset Title @@ -1013,8 +1013,8 @@ class TransformEditorTool(AppTool): grid0.addWidget(self.offy_button, 32, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 34, 0, 1, 3) # ## Buffer Title @@ -2016,7 +2016,7 @@ class DrawTool(object): def on_key(self, key): # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.draw_app.app.on_jump_to() return @@ -2209,15 +2209,15 @@ class FCArc(FCShapeTool): return "" def on_key(self, key): - if key == 'D' or key == QtCore.Qt.Key_D: + if key == 'D' or key == QtCore.Qt.Key.Key_D: self.direction = 'cw' if self.direction == 'ccw' else 'ccw' return '%s: %s' % (_('Direction'), self.direction.upper()) # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.draw_app.app.on_jump_to() - if key == 'M' or key == QtCore.Qt.Key_M: + if key == 'M' or key == QtCore.Qt.Key.Key_M: # delete the possible points made before this action; we want to start anew self.points[:] = [] # and delete the utility geometry made up until this point @@ -2530,10 +2530,10 @@ class FCPolygon(FCShapeTool): def on_key(self, key): # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.draw_app.app.on_jump_to() - if key == 'Backspace' or key == QtCore.Qt.Key_Backspace: + if key == 'Backspace' or key == QtCore.Qt.Key.Key_Backspace: if len(self.points) > 0: self.points = self.points[0:-1] # Remove any previous utility shape @@ -2596,10 +2596,10 @@ class FCPath(FCPolygon): def on_key(self, key): # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.draw_app.app.on_jump_to() - if key == 'Backspace' or key == QtCore.Qt.Key_Backspace: + if key == 'Backspace' or key == QtCore.Qt.Key.Key_Backspace: if len(self.points) > 0: self.points = self.points[0:-1] # Remove any previous utility shape @@ -2683,9 +2683,9 @@ class FCSelect(DrawTool): key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None @@ -2957,7 +2957,7 @@ class FCMove(FCShapeTool): if self.draw_app.app.defaults["global_mselect_key"] == 'Control': # if CONTROL key is pressed then we add to the selected list the current shape but if it's # already in the selected list, we removed it. Therefore first click selects, second deselects. - if key_modifier == Qt.ControlModifier: + if key_modifier == Qt.KeyboardModifier.ControlModifier: if obj_to_add in self.draw_app.selected: self.draw_app.selected.remove(obj_to_add) else: @@ -2966,7 +2966,7 @@ class FCMove(FCShapeTool): self.draw_app.selected = [] self.draw_app.selected.append(obj_to_add) else: - if key_modifier == Qt.ShiftModifier: + if key_modifier == Qt.KeyboardModifier.ShiftModifier: if obj_to_add in self.draw_app.selected: self.draw_app.selected.remove(obj_to_add) else: @@ -3441,7 +3441,7 @@ class AppGeoEditor(QtCore.QObject): # ## Title label self.title_label = FCLabel("%s" % _('Geometry Editor')) - self.title_label.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.title_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.title_box.addWidget(self.title_label, stretch=1) # App Level label @@ -3485,7 +3485,7 @@ class AppGeoEditor(QtCore.QObject): self.tw = FCTree(columns=3, header_hidden=False, protected_column=[0, 1], extended_sel=True) self.tw.setHeaderLabels(["ID", _("Type"), _("Name")]) self.tw.setIndentation(0) - self.tw.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.tw.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu) self.tw.header().setStretchLastSection(True) self.tw.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) self.tools_box.addWidget(self.tw) @@ -3512,8 +3512,8 @@ class AppGeoEditor(QtCore.QObject): grid0.addWidget(self.geo_zoom, 0, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 2, 0, 1, 3) # Parameters Title @@ -3600,8 +3600,8 @@ class AppGeoEditor(QtCore.QObject): grid0.addWidget(self.geo_vertex_entry, 26, 1, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 28, 0, 1, 3) # Simplification Title @@ -4598,7 +4598,7 @@ class AppGeoEditor(QtCore.QObject): :return: Boolean. Status of the checkbox that toggled the Editor Tool """ cb_widget = self.sender() - assert isinstance(cb_widget, QtWidgets.QAction), "Expected a QAction got %s" % type(cb_widget) + assert isinstance(cb_widget, QtGui.QAction), "Expected a QAction got %s" % type(cb_widget) self.options[key] = cb_widget.isChecked() return 1 if self.options[key] is True else 0 @@ -4698,7 +4698,7 @@ class AppGeoEditor(QtCore.QObject): modifiers = QtWidgets.QApplication.keyboardModifiers() # If the SHIFT key is pressed when LMB is clicked then the coordinates are copied to clipboard - if modifiers == QtCore.Qt.ShiftModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: self.app.clipboard.setText( self.app.defaults["global_point_clipboard_format"] % (self.decimals, self.pos[0], self.decimals, self.pos[1]) @@ -4903,9 +4903,9 @@ class AppGeoEditor(QtCore.QObject): key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index 67001a85..82f8a448 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -5,8 +5,8 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.QtCore import Qt +from PyQt6 import QtGui, QtCore, QtWidgets +from PyQt6.QtCore import Qt from shapely.geometry import LineString, LinearRing, MultiLineString, Point, Polygon, MultiPolygon, box from shapely.ops import unary_union @@ -139,7 +139,7 @@ class DrawTool(object): def on_key(self, key): # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.draw_app.app.on_jump_to() def utility_geometry(self, data=None): @@ -819,9 +819,9 @@ class PadArrayEditorGrb(ShapeToolEditorGrb): def on_key(self, key): key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None @@ -830,7 +830,7 @@ class PadArrayEditorGrb(ShapeToolEditorGrb): pass elif mod_key is None: # Toggle Drill Array Direction - if key == QtCore.Qt.Key_Space: + if key == QtCore.Qt.Key.Key_Space: if self.draw_app.ui.pad_axis_radio.get_value() == 'X': self.draw_app.ui.pad_axis_radio.set_value('Y') elif self.draw_app.ui.pad_axis_radio.get_value() == 'Y': @@ -944,9 +944,9 @@ class PoligonizeEditorGrb(ShapeToolEditorGrb): # else return to the current tool key_modifier = QtWidgets.QApplication.keyboardModifiers() if self.draw_app.app.defaults["global_mselect_key"] == 'Control': - modifier_to_use = Qt.ControlModifier + modifier_to_use = Qt.KeyboardModifier.ControlModifier else: - modifier_to_use = Qt.ShiftModifier + modifier_to_use = Qt.KeyboardModifier.ShiftModifier # if modifier key is pressed then we add to the selected list the current shape but if it's already # in the selected list, we removed it. Therefore first click selects, second deselects. if key_modifier == modifier_to_use: @@ -1254,10 +1254,10 @@ class RegionEditorGrb(ShapeToolEditorGrb): def on_key(self, key): # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.draw_app.app.on_jump_to() - if key == 'Backspace' or key == QtCore.Qt.Key_Backspace: + if key == 'Backspace' or key == QtCore.Qt.Key.Key_Backspace: if len(self.points) > 0: if self.draw_app.bend_mode == 5: self.points = self.points[0:-1] @@ -1269,7 +1269,7 @@ class RegionEditorGrb(ShapeToolEditorGrb): self.draw_app.draw_utility_geometry(geo_shape=geo) return _("Backtracked one point ...") - if key == 'T' or key == QtCore.Qt.Key_T: + if key == 'T' or key == QtCore.Qt.Key.Key_T: if self.draw_app.bend_mode == 1: self.draw_app.bend_mode = 2 msg = _('Corner Mode 2: Reverse 45 degrees ...') @@ -1293,7 +1293,7 @@ class RegionEditorGrb(ShapeToolEditorGrb): return msg - if key == 'R' or key == QtCore.Qt.Key_R: + if key == 'R' or key == QtCore.Qt.Key.Key_R: if self.draw_app.bend_mode == 1: self.draw_app.bend_mode = 5 msg = _('Corner Mode 5: Free angle ...') @@ -1514,7 +1514,7 @@ class TrackEditorGrb(ShapeToolEditorGrb): self.draw_app.app.inform.emit('[success] %s' % _("Done.")) def on_key(self, key): - if key == 'Backspace' or key == QtCore.Qt.Key_Backspace: + if key == 'Backspace' or key == QtCore.Qt.Key.Key_Backspace: if len(self.points) > 0: self.temp_points = self.points[0:-1] # Remove any previous utility shape @@ -1524,14 +1524,14 @@ class TrackEditorGrb(ShapeToolEditorGrb): return _("Backtracked one point ...") # Jump to coords - if key == QtCore.Qt.Key_G or key == 'G': + if key == QtCore.Qt.Key.Key_G or key == 'G': self.draw_app.app.ui.grid_snap_btn.trigger() # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.draw_app.app.on_jump_to() - if key == 'T' or key == QtCore.Qt.Key_T: + if key == 'T' or key == QtCore.Qt.Key.Key_T: try: QtGui.QGuiApplication.restoreOverrideCursor() except Exception as e: @@ -1570,7 +1570,7 @@ class TrackEditorGrb(ShapeToolEditorGrb): return msg - if key == 'R' or key == QtCore.Qt.Key_R: + if key == 'R' or key == QtCore.Qt.Key.Key_R: try: QtGui.QGuiApplication.restoreOverrideCursor() except Exception as e: @@ -1819,15 +1819,15 @@ class DiscSemiEditorGrb(ShapeToolEditorGrb): return "" def on_key(self, key): - if key == 'D' or key == QtCore.Qt.Key_D: + if key == 'D' or key == QtCore.Qt.Key.Key_D: self.direction = 'cw' if self.direction == 'ccw' else 'ccw' return '%s: %s' % (_('Direction'), self.direction.upper()) # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.draw_app.app.on_jump_to() - if key == 'M' or key == QtCore.Qt.Key_M: + if key == 'M' or key == QtCore.Qt.Key.Key_M: # delete the possible points made before this action; we want to start anew self.points = [] # and delete the utility geometry made up until this point @@ -2607,9 +2607,9 @@ class SelectEditorGrb(QtCore.QObject, DrawTool): def click(self, point): key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None @@ -2623,9 +2623,9 @@ class SelectEditorGrb(QtCore.QObject, DrawTool): self.draw_app.ui.apertures_table.clearSelection() key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None @@ -3600,14 +3600,14 @@ class AppGerberEditor(QtCore.QObject): ap_code = ap_code ap_code_item = QtWidgets.QTableWidgetItem('%d' % int(self.apertures_row + 1)) - ap_code_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + ap_code_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.apertures_table.setItem(self.apertures_row, 0, ap_code_item) # Tool name/id ap_code_item = QtWidgets.QTableWidgetItem(ap_code) - ap_code_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + ap_code_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) ap_type_item = QtWidgets.QTableWidgetItem(str(self.storage_dict[ap_code]['type'])) - ap_type_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + ap_type_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) if str(self.storage_dict[ap_code]['type']) == 'R' or str(self.storage_dict[ap_code]['type']) == '0': ap_dim_item = QtWidgets.QTableWidgetItem( @@ -3615,16 +3615,16 @@ class AppGerberEditor(QtCore.QObject): self.decimals, self.storage_dict[ap_code]['height'] ) ) - ap_dim_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable) + ap_dim_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsEditable) elif str(self.storage_dict[ap_code]['type']) == 'P': ap_dim_item = QtWidgets.QTableWidgetItem( '%.*f, %.*f' % (self.decimals, self.storage_dict[ap_code]['diam'], self.decimals, self.storage_dict[ap_code]['nVertices']) ) - ap_dim_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable) + ap_dim_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsEditable) else: ap_dim_item = QtWidgets.QTableWidgetItem('') - ap_dim_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + ap_dim_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) try: if self.storage_dict[ap_code]['size'] is not None: @@ -3636,9 +3636,9 @@ class AppGerberEditor(QtCore.QObject): ap_size_item = QtWidgets.QTableWidgetItem('') if str(self.storage_dict[ap_code]['type']) == 'C': - ap_size_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable) + ap_size_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsEditable) else: - ap_size_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + ap_size_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.apertures_table.setItem(self.apertures_row, 1, ap_code_item) # Aperture Code self.ui.apertures_table.setItem(self.apertures_row, 2, ap_type_item) # Aperture Type @@ -3654,13 +3654,13 @@ class AppGerberEditor(QtCore.QObject): # ap_code = ap_code # # ap_code_item = QtWidgets.QTableWidgetItem('%d' % int(self.apertures_row + 1)) - # ap_code_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # ap_code_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # self.ui.apertures_table.setItem(self.apertures_row, 0, ap_code_item) # Tool name/id # # ap_code_item = QtWidgets.QTableWidgetItem(ap_code) # # ap_type_item = QtWidgets.QTableWidgetItem('AM') - # ap_type_item.setFlags(QtCore.Qt.ItemIsEnabled) + # ap_type_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # # self.ui.apertures_table.setItem(self.apertures_row, 1, ap_code_item) # Aperture Code # self.ui.apertures_table.setItem(self.apertures_row, 2, ap_type_item) # Aperture Type @@ -4728,7 +4728,7 @@ class AppGerberEditor(QtCore.QObject): def run(self): self.worker_job(self.app) - # self.thread.start(QtCore.QThread.NormalPriority) + # self.thread.start(QtCore.QThread.Priority.NormalPriority) executable_edit = Execute_Edit(app=self) # executable_edit.moveToThread(self.thread) @@ -4963,9 +4963,9 @@ class AppGerberEditor(QtCore.QObject): # if col == 0: key_modifier = QtWidgets.QApplication.keyboardModifiers() if self.app.defaults["global_mselect_key"] == 'Control': - modifier_to_use = Qt.ControlModifier + modifier_to_use = Qt.KeyboardModifier.ControlModifier else: - modifier_to_use = Qt.ShiftModifier + modifier_to_use = Qt.KeyboardModifier.ShiftModifier if key_modifier == modifier_to_use: pass @@ -5120,7 +5120,7 @@ class AppGerberEditor(QtCore.QObject): modifiers = QtWidgets.QApplication.keyboardModifiers() # If the SHIFT key is pressed when LMB is clicked then the coordinates are copied to clipboard - if modifiers == QtCore.Qt.ShiftModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: self.app.clipboard.setText( self.app.defaults["global_point_clipboard_format"] % (self.decimals, self.pos[0], self.decimals, self.pos[1]) @@ -5141,9 +5141,9 @@ class AppGerberEditor(QtCore.QObject): # else return to the current tool key_modifier = QtWidgets.QApplication.keyboardModifiers() if self.app.defaults["global_mselect_key"] == 'Control': - modifier_to_use = Qt.ControlModifier + modifier_to_use = Qt.KeyboardModifier.ControlModifier else: - modifier_to_use = Qt.ShiftModifier + modifier_to_use = Qt.KeyboardModifier.ShiftModifier # if modifier key is pressed then we add to the selected list the current shape but if it's already # in the selected list, we removed it. Therefore first click selects, second deselects. @@ -5223,9 +5223,9 @@ class AppGerberEditor(QtCore.QObject): else: key_modifier = QtWidgets.QApplication.keyboardModifiers() if (self.app.defaults["global_mselect_key"] == 'Control' and - key_modifier == Qt.ControlModifier) or \ + key_modifier == Qt.KeyboardModifier.ControlModifier) or \ (self.app.defaults["global_mselect_key"] == 'Shift' and - key_modifier == Qt.ShiftModifier): + key_modifier == Qt.KeyboardModifier.ShiftModifier): self.select_tool(self.active_tool.name) else: @@ -6002,7 +6002,7 @@ class AppGerberEditorUI: # Title label self.title_label = FCLabel("%s" % _('Gerber Editor')) - self.title_label.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.title_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.title_box.addWidget(self.title_label, stretch=1) # App Level label @@ -6065,8 +6065,8 @@ class AppGerberEditorUI: " - (dia, nVertices) for P type")) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.custom_box.addWidget(separator_line) # add a frame and inside add a vertical box layout. Inside this vbox layout I add all the Apertures widgets @@ -6149,8 +6149,8 @@ class AppGerberEditorUI: grid1.addWidget(self.apdim_entry, 4, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid1.addWidget(separator_line, 5, 0, 1, 3) # Aperture Buttons @@ -6158,14 +6158,14 @@ class AppGerberEditorUI: grid1.addLayout(vlay_buttons, 1, 2, 4, 1) self.addaperture_btn = FCButton(_('Add')) - self.addaperture_btn.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.addaperture_btn.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) self.addaperture_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/plus16.png')) self.addaperture_btn.setToolTip( _("Add a new aperture to the aperture list.") ) self.delaperture_btn = FCButton(_('Delete')) - # self.delaperture_btn.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + # self.delaperture_btn.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) self.delaperture_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/trash32.png')) self.delaperture_btn.setToolTip( @@ -6192,8 +6192,8 @@ class AppGerberEditorUI: self.shape_grid.addWidget(self.geo_zoom, 0, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.shape_grid.addWidget(separator_line, 2, 0, 1, 3) # Parameters Title @@ -6260,8 +6260,8 @@ class AppGerberEditorUI: self.shape_grid.addWidget(self.geo_vertex_entry, 10, 1, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.shape_grid.addWidget(separator_line, 12, 0, 1, 3) # Simplification Title @@ -6349,8 +6349,8 @@ class AppGerberEditorUI: buff_grid.addWidget(self.buffer_corner_cb, 2, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) buff_grid.addWidget(separator_line, 4, 0, 1, 2) # Buttons @@ -6398,8 +6398,8 @@ class AppGerberEditorUI: scale_grid.addWidget(self.scale_factor_entry, 0, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) scale_grid.addWidget(separator_line, 2, 0, 1, 2) # Buttons @@ -6419,8 +6419,8 @@ class AppGerberEditorUI: self.ma_tool_frame.hide() separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.ma_tools_box.addWidget(separator_line) # Title @@ -6498,8 +6498,8 @@ class AppGerberEditorUI: self.array_frame.setLayout(self.array_box) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.array_box.addWidget(separator_line) array_grid = QtWidgets.QGridLayout() @@ -6543,8 +6543,8 @@ class AppGerberEditorUI: # ############################ Linear Pad Array ############################################################### # ############################################################################################################# self.lin_separator_line = QtWidgets.QFrame() - self.lin_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.lin_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.lin_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.lin_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) array_grid.addWidget(self.lin_separator_line, 6, 0, 1, 2) # Linear Direction @@ -6597,8 +6597,8 @@ class AppGerberEditorUI: # ################################### Circular Pad Array ###################################################### # ############################################################################################################# self.circ_separator_line = QtWidgets.QFrame() - self.circ_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.circ_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.circ_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.circ_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) array_grid.addWidget(self.circ_separator_line, 14, 0, 1, 2) # Circular Direction @@ -6720,8 +6720,8 @@ class TransformEditorTool(AppTool): grid0.addWidget(self.point_button, 2, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 5, 0, 1, 3) # ## Rotate Title @@ -6757,8 +6757,8 @@ class TransformEditorTool(AppTool): grid0.addWidget(self.rotate_button, 7, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 8, 0, 1, 3) # ## Skew Title @@ -6819,8 +6819,8 @@ class TransformEditorTool(AppTool): logic=False) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 14, 0, 1, 3) # ## Scale Title @@ -6883,8 +6883,8 @@ class TransformEditorTool(AppTool): ], logic=False) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 21, 0, 1, 3) # ## Flip Title @@ -6908,8 +6908,8 @@ class TransformEditorTool(AppTool): hlay0.addWidget(self.flipy_button) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 27, 0, 1, 3) # ## Offset Title @@ -6957,8 +6957,8 @@ class TransformEditorTool(AppTool): grid0.addWidget(self.offy_button, 32, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 34, 0, 1, 3) # ## Buffer Title diff --git a/appEditors/AppTextEditor.py b/appEditors/AppTextEditor.py index 387ceaea..08ef403f 100644 --- a/appEditors/AppTextEditor.py +++ b/appEditors/AppTextEditor.py @@ -6,7 +6,7 @@ # ########################################################## from appGUI.GUIElements import FCFileSaveDialog, FCEntry, FCTextAreaExtended, FCTextAreaLineNumber, FCButton -from PyQt5 import QtPrintSupport, QtWidgets, QtCore, QtGui +from PyQt6 import QtPrintSupport, QtWidgets, QtCore, QtGui from reportlab.platypus import SimpleDocTemplate, Paragraph from reportlab.lib.styles import getSampleStyleSheet @@ -35,8 +35,8 @@ class AppTextEditor(QtWidgets.QWidget): self.callback = lambda x: None self.setSizePolicy( - QtWidgets.QSizePolicy.MinimumExpanding, - QtWidgets.QSizePolicy.MinimumExpanding + QtWidgets.QSizePolicy.Policy.MinimumExpanding, + QtWidgets.QSizePolicy.Policy.MinimumExpanding ) # UI Layout @@ -202,9 +202,9 @@ class AppTextEditor(QtWidgets.QWidget): else: self.code_editor.setHtml(text) if move_to_start: - self.code_editor.moveCursor(QtGui.QTextCursor.Start) + self.code_editor.moveCursor(QtGui.QTextCursor.MoveOperation.Start) elif move_to_end: - self.code_editor.moveCursor(QtGui.QTextCursor.End) + self.code_editor.moveCursor(QtGui.QTextCursor.MoveOperation.End) self.code_editor.textChanged.connect(self.handleTextChanged) def handleOpen(self, filt=None): @@ -333,7 +333,7 @@ class AppTextEditor(QtWidgets.QWidget): r = self.code_editor.find(str(text_to_be_found), flags) if r is False: - self.code_editor.moveCursor(QtGui.QTextCursor.Start) + self.code_editor.moveCursor(QtGui.QTextCursor.MoveOperation.Start) self.code_editor.find(str(text_to_be_found), flags) def handleReplaceGCode(self): @@ -353,7 +353,7 @@ class AppTextEditor(QtWidgets.QWidget): if qc.hasSelection(): qc.insertText(new) else: - self.code_editor.moveCursor(QtGui.QTextCursor.Start) + self.code_editor.moveCursor(QtGui.QTextCursor.MoveOperation.Start) break # Mark end of undo block cursor.endEditBlock() diff --git a/appEditors/appGCodeEditor.py b/appEditors/appGCodeEditor.py index ddb1ab16..e7223233 100644 --- a/appEditors/appGCodeEditor.py +++ b/appEditors/appGCodeEditor.py @@ -8,7 +8,7 @@ from appEditors.AppTextEditor import AppTextEditor from appObjects.FlatCAMCNCJob import CNCJobObject from appGUI.GUIElements import FCTextArea, FCEntry, FCButton, FCTable -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui # from io import StringIO @@ -158,19 +158,19 @@ class AppGCodeEditor(QtCore.QObject): # add the All Gcode selection allgcode_item = QtWidgets.QTableWidgetItem('%s' % _("All")) - allgcode_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + allgcode_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.cnc_tools_table.setItem(row_no, 1, allgcode_item) row_no += 1 # add the Header Gcode selection header_item = QtWidgets.QTableWidgetItem('%s' % _("Header")) - header_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + header_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.cnc_tools_table.setItem(row_no, 1, header_item) row_no += 1 # add the Start Gcode selection start_item = QtWidgets.QTableWidgetItem('%s' % _("Start")) - start_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + start_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.cnc_tools_table.setItem(row_no, 1, start_item) for dia_key, dia_value in self.gcode_obj.tools.items(): @@ -179,7 +179,7 @@ class AppGCodeEditor(QtCore.QObject): row_no += 1 t_id = QtWidgets.QTableWidgetItem('%d' % int(tool_idx)) - # id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # id.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.cnc_tools_table.setItem(row_no, 0, t_id) # Tool name/id dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(dia_value['tooldia']))) @@ -204,11 +204,11 @@ class AppGCodeEditor(QtCore.QObject): tool_shape_item_txt = dia_value['data']['tools_mill_tool_shape'] tool_shape_item = QtWidgets.QTableWidgetItem(tool_shape_item_txt) - t_id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - dia_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - offset_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - job_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - tool_shape_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + t_id.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + offset_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + job_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + tool_shape_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.cnc_tools_table.setItem(row_no, 1, dia_item) # Diameter self.ui.cnc_tools_table.setItem(row_no, 2, offset_item) # Offset @@ -264,19 +264,19 @@ class AppGCodeEditor(QtCore.QObject): # add the All Gcode selection allgcode_item = QtWidgets.QTableWidgetItem('%s' % _("All GCode")) - allgcode_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + allgcode_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exc_cnc_tools_table.setItem(row_no, 1, allgcode_item) row_no += 1 # add the Header Gcode selection header_item = QtWidgets.QTableWidgetItem('%s' % _("Header GCode")) - header_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + header_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exc_cnc_tools_table.setItem(row_no, 1, header_item) row_no += 1 # add the Start Gcode selection start_item = QtWidgets.QTableWidgetItem('%s' % _("Start GCode")) - start_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + start_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exc_cnc_tools_table.setItem(row_no, 1, start_item) for toolid_key, t_value in self.gcode_obj.tools.items(): @@ -291,11 +291,11 @@ class AppGCodeEditor(QtCore.QObject): cutz_item = QtWidgets.QTableWidgetItem('%.*f' % ( self.decimals, float(t_value['offset']) + float(t_value['data']['tools_drill_cutz']))) - t_id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - dia_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - nr_drills_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - nr_slots_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - cutz_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + t_id.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + nr_drills_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + nr_slots_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + cutz_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exc_cnc_tools_table.setItem(row_no, 0, t_id) # Tool name/id self.ui.exc_cnc_tools_table.setItem(row_no, 1, dia_item) # Diameter @@ -382,7 +382,7 @@ class AppGCodeEditor(QtCore.QObject): :rtype: """ flags = QtGui.QTextDocument.FindCaseSensitively - self.edit_area.moveCursor(QtGui.QTextCursor.Start) + self.edit_area.moveCursor(QtGui.QTextCursor.MoveOperation.Start) if self.gcode_obj.options['type'].lower() == 'geometry': t_table = self.ui.cnc_tools_table @@ -420,7 +420,7 @@ class AppGCodeEditor(QtCore.QObject): end_sel = my_text_cursor.selectionEnd() my_text_cursor.setPosition(start_sel) - my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.KeepAnchor) + my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.MoveMode.KeepAnchor) self.edit_area.setTextCursor(my_text_cursor) if 2 in sel_rows: @@ -440,7 +440,7 @@ class AppGCodeEditor(QtCore.QObject): end_sel = my_text_cursor.selectionEnd() my_text_cursor.setPosition(start_sel) - my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.KeepAnchor) + my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.MoveMode.KeepAnchor) self.edit_area.setTextCursor(my_text_cursor) sel_list = [] @@ -490,7 +490,7 @@ class AppGCodeEditor(QtCore.QObject): m6 = self.edit_area.find('M6', flags) if m6 is False: # this mean that we are in the last tool, we take all to the end - self.edit_area.moveCursor(QtGui.QTextCursor.End) + self.edit_area.moveCursor(QtGui.QTextCursor.MoveOperation.End) my_text_cursor = self.edit_area.textCursor() end_sel = my_text_cursor.selectionEnd() else: @@ -522,12 +522,12 @@ class AppGCodeEditor(QtCore.QObject): end_sel = max(belong_to_tool_list) else: # this mean that we are in the last tool, we take all to the end - self.edit_area.moveCursor(QtGui.QTextCursor.End) + self.edit_area.moveCursor(QtGui.QTextCursor.MoveOperation.End) my_text_cursor = self.edit_area.textCursor() end_sel = my_text_cursor.selectionEnd() my_text_cursor.setPosition(start_sel) - my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.KeepAnchor) + my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.MoveMode.KeepAnchor) self.edit_area.setTextCursor(my_text_cursor) tool_selection = QtWidgets.QTextEdit.ExtraSelection() @@ -544,12 +544,12 @@ class AppGCodeEditor(QtCore.QObject): my_text_cursor = self.edit_area.textCursor() start_sel = my_text_cursor.selectionStart() - self.edit_area.moveCursor(QtGui.QTextCursor.End) + self.edit_area.moveCursor(QtGui.QTextCursor.MoveOperation.End) my_text_cursor = self.edit_area.textCursor() end_sel = my_text_cursor.selectionEnd() my_text_cursor.setPosition(start_sel) - my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.KeepAnchor) + my_text_cursor.setPosition(end_sel, QtGui.QTextCursor.MoveMode.KeepAnchor) self.edit_area.setTextCursor(my_text_cursor) self.edit_area.setExtraSelections(sel_list) @@ -731,8 +731,8 @@ class AppGCodeEditorUI: self.units = self.app.defaults['units'].upper() # self.setSizePolicy( - # QtWidgets.QSizePolicy.MinimumExpanding, - # QtWidgets.QSizePolicy.MinimumExpanding + # QtWidgets.QSizePolicy.Policy.MinimumExpanding, + # QtWidgets.QSizePolicy.Policy.MinimumExpanding # ) self.gcode_editor_tab = None @@ -764,7 +764,7 @@ class AppGCodeEditorUI: # ## Title label self.title_label = QtWidgets.QLabel("%s" % _('GCode Editor')) - self.title_label.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.title_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.title_box.addWidget(self.title_label, stretch=1) # App Level label @@ -789,8 +789,8 @@ class AppGCodeEditorUI: self.name_box.addWidget(self.name_entry) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.edit_box.addWidget(separator_line) # CNC Tools Table when made out of Geometry @@ -816,8 +816,8 @@ class AppGCodeEditorUI: self.exc_cnc_tools_table.setColumnHidden(4, True) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.edit_box.addWidget(separator_line) # ############################################################################################################# diff --git a/appGUI/ColumnarFlowLayout.py b/appGUI/ColumnarFlowLayout.py index 2fcdff5a..fdfab2d2 100644 --- a/appGUI/ColumnarFlowLayout.py +++ b/appGUI/ColumnarFlowLayout.py @@ -7,8 +7,8 @@ import sys -from PyQt5.QtCore import QRect, QSize, Qt -from PyQt5.QtWidgets import QLayout +from PyQt6.QtCore import QRect, QSize, Qt +from PyQt6.QtWidgets import QLayout import math diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index 1099b09d..c01393b4 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -11,10 +11,10 @@ # Date: 3/10/2019 # # ########################################################## -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal -from PyQt5.QtWidgets import QTextEdit, QCompleter, QAction -from PyQt5.QtGui import QKeySequence, QTextCursor +from PyQt6 import QtGui, QtCore, QtWidgets +from PyQt6.QtCore import Qt, pyqtSlot, pyqtSignal +from PyQt6.QtWidgets import QTextEdit, QCompleter +from PyQt6.QtGui import QKeySequence, QTextCursor, QAction from copy import copy import re @@ -173,11 +173,11 @@ class FCTree(QtWidgets.QTreeWidget): self.setColumnCount(columns) self.setHeaderHidden(header_hidden) self.tree_header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) - self.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Expanding) + self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Expanding) palette = QtGui.QPalette() - palette.setColor(QtGui.QPalette.Inactive, QtGui.QPalette.Highlight, - palette.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight)) + palette.setColor(QtGui.QPalette.ColorGroup.Inactive, QtGui.QPalette.ColorRole.Highlight, + palette.color(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Highlight)) # make inactive rows text some color as active; may be useful in the future # palette.setColor(QtGui.QPalette.Inactive, QtGui.QPalette.HighlightedText, @@ -199,9 +199,9 @@ class FCTree(QtWidgets.QTreeWidget): # from here: https://stackoverflow.com/questions/2801959/making-only-one-column-of-a-qtreewidgetitem-editable tmp_flags = item.flags() if self.is_editable(column): - item.setFlags(tmp_flags | QtCore.Qt.ItemIsEditable) - elif tmp_flags & QtCore.Qt.ItemIsEditable: - item.setFlags(tmp_flags ^ QtCore.Qt.ItemIsEditable) + item.setFlags(tmp_flags | QtCore.Qt.ItemFlag.ItemIsEditable) + elif tmp_flags & QtCore.Qt.ItemFlag.ItemIsEditable: + item.setFlags(tmp_flags ^ QtCore.Qt.ItemFlag.ItemIsEditable) def on_header_double_click(self, column): self.tree_header.setSectionResizeMode(column, QtWidgets.QHeaderView.ResizeToContents) @@ -218,7 +218,7 @@ class FCTree(QtWidgets.QTreeWidget): def addParent(self, parent, title, expanded=False, color=None, font=None): item = QtWidgets.QTreeWidgetItem(parent, [title]) - item.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ShowIndicator) + item.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ChildIndicatorPolicy.ShowIndicator) item.setExpanded(expanded) if color is not None: # item.setTextColor(0, color) # PyQt4 @@ -229,11 +229,11 @@ class FCTree(QtWidgets.QTreeWidget): def addParentEditable(self, parent, title, color=None, font=None, font_items=None, editable=False): item = QtWidgets.QTreeWidgetItem(parent) - item.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.DontShowIndicator) + item.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ChildIndicatorPolicy.DontShowIndicator) if editable: - item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable) + item.setFlags(item.flags() | QtCore.Qt.ItemFlag.ItemIsEditable) - item.setFlags(item.flags() | QtCore.Qt.ItemIsSelectable) + item.setFlags(item.flags() | QtCore.Qt.ItemFlag.ItemIsSelectable) for t in range(len(title)): item.setText(t, title[t]) @@ -255,7 +255,7 @@ class FCTree(QtWidgets.QTreeWidget): def addChild(self, parent, title, column1=None, font=None, font_items=None, editable=False): item = QtWidgets.QTreeWidgetItem(parent) if editable: - item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable) + item.setFlags(item.flags() | QtCore.Qt.ItemFlag.ItemIsEditable) item.setText(0, str(title[0])) if column1 is not None: @@ -402,7 +402,7 @@ class LengthEntry(FCLineEdit): def focusOutEvent(self, e): # don't focus out if the user requests an popup menu - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(LengthEntry, self).focusOutEvent(e) # required to remove cursor on focusOut self.deselect() self.readyToEdit = True @@ -460,7 +460,7 @@ class FloatEntry(FCLineEdit): def focusOutEvent(self, e): # don't focus out if the user requests an popup menu - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(FloatEntry, self).focusOutEvent(e) # required to remove cursor on focusOut self.deselect() self.readyToEdit = True @@ -513,7 +513,7 @@ class FloatEntry2(FCLineEdit): def focusOutEvent(self, e): # don't focus out if the user requests an popup menu - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(FloatEntry2, self).focusOutEvent(e) # required to remove cursor on focusOut self.deselect() self.readyToEdit = True @@ -558,7 +558,7 @@ class IntEntry(FCLineEdit): def focusOutEvent(self, e): # don't focus out if the user requests an popup menu - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(IntEntry, self).focusOutEvent(e) # required to remove cursor on focusOut self.deselect() self.readyToEdit = True @@ -599,11 +599,11 @@ class FCEntry(FCLineEdit): if alignment: if alignment == 'center': - align_val = QtCore.Qt.AlignHCenter + align_val = QtCore.Qt.AlignmentFlag.AlignHCenter elif alignment == 'right': - align_val = QtCore.Qt.AlignRight + align_val = QtCore.Qt.AlignmentFlag.AlignRight else: - align_val = QtCore.Qt.AlignLeft + align_val = QtCore.Qt.AlignmentFlag.AlignLeft self.setAlignment(align_val) def on_edit_finished(self): @@ -616,7 +616,7 @@ class FCEntry(FCLineEdit): self.readyToEdit = False def focusOutEvent(self, e): - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(FCEntry, self).focusOutEvent(e) # required to remove cursor on focusOut self.deselect() self.readyToEdit = True @@ -691,7 +691,7 @@ class EvalEntry(FCLineEdit): self.readyToEdit = False def focusOutEvent(self, e): - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(EvalEntry, self).focusOutEvent(e) # required to remove cursor on focusOut self.deselect() self.readyToEdit = True @@ -737,7 +737,7 @@ class EvalEntry2(FCLineEdit): self.readyToEdit = False def focusOutEvent(self, e): - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(EvalEntry2, self).focusOutEvent(e) # required to remove cursor on focusOut self.deselect() self.readyToEdit = True @@ -769,8 +769,8 @@ class NumericalEvalEntry(FCEntry): def __init__(self, border_color=None): super().__init__(border_color=border_color) - regex = QtCore.QRegExp("[0-9\/\*\+\-\%\.\,\s]*") - validator = QtGui.QRegExpValidator(regex, self) + regex = QtCore.QRegularExpression("[0-9\/\*\+\-\%\.\,\s]*") + validator = QtGui.QRegularExpressionValidator(regex, self) self.setValidator(validator) def get_value(self): @@ -793,8 +793,8 @@ class NumericalEvalTupleEntry(EvalEntry): def __init__(self, border_color=None): super().__init__(border_color=border_color) - regex = QtCore.QRegExp("[0-9\/\*\+\-\%\.\s\,\[\]\(\)]*") - validator = QtGui.QRegExpValidator(regex, self) + regex = QtCore.QRegularExpression("[0-9\/\*\+\-\%\.\s\,\[\]\(\)]*") + validator = QtGui.QRegularExpressionValidator(regex, self) self.setValidator(validator) def get_value(self): @@ -814,8 +814,8 @@ class FCColorEntry(QtWidgets.QFrame): super().__init__(**kwargs) self.entry = FCEntry() - regex = QtCore.QRegExp("[#A-Fa-f0-9]*") - validator = QtGui.QRegExpValidator(regex, self.entry) + regex = QtCore.QRegularExpression("[#A-Fa-f0-9]*") + validator = QtGui.QRegularExpressionValidator(regex, self.entry) self.entry.setValidator(validator) self.button = QtWidgets.QPushButton() @@ -823,7 +823,7 @@ class FCColorEntry(QtWidgets.QFrame): self.button.setStyleSheet("border-color: dimgray;") self.layout = QtWidgets.QHBoxLayout() - self.layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.addWidget(self.entry) self.layout.addWidget(self.button) @@ -871,7 +871,7 @@ class FCSliderWithSpinner(QtWidgets.QFrame): def __init__(self, min=0, max=100, step=1, **kwargs): super().__init__(**kwargs) - self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) + self.slider = QtWidgets.QSlider(QtCore.Qt.Orientation.Horizontal) self.slider.setMinimum(min) self.slider.setMaximum(max) self.slider.setSingleStep(step) @@ -881,11 +881,11 @@ class FCSliderWithSpinner(QtWidgets.QFrame): self.spinner.set_step(step) self.spinner.setMinimumWidth(70) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) self.spinner.setSizePolicy(sizePolicy) self.layout = QtWidgets.QHBoxLayout() - self.layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.addWidget(self.slider) self.layout.addWidget(self.spinner) @@ -930,22 +930,22 @@ class FCSpinner(QtWidgets.QSpinBox): if alignment: if alignment == 'center': - align_val = QtCore.Qt.AlignHCenter + align_val = QtCore.Qt.AlignmentFlag.AlignHCenter elif alignment == 'right': - align_val = QtCore.Qt.AlignRight + align_val = QtCore.Qt.AlignmentFlag.AlignRight else: - align_val = QtCore.Qt.AlignLeft + align_val = QtCore.Qt.AlignmentFlag.AlignLeft self.setAlignment(align_val) self.prev_readyToEdit = True self.menu = None if policy: - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Preferred) self.setSizePolicy(sizePolicy) def eventFilter(self, object, event): - if event.type() == QtCore.QEvent.MouseButtonPress and self.prev_readyToEdit is True: + if event.type() == QtCore.QEvent.Type.MouseButtonPress and self.prev_readyToEdit is True: self.prev_readyToEdit = False if self.isEnabled(): if self.readyToEdit: @@ -957,7 +957,7 @@ class FCSpinner(QtWidgets.QSpinBox): return False def keyPressEvent(self, event): - if event.key() == Qt.Key_Enter: + if event.key() == Qt.Key.Key_Enter: self.returnPressed.emit() self.clearFocus() else: @@ -980,7 +980,7 @@ class FCSpinner(QtWidgets.QSpinBox): def focusOutEvent(self, e): # don't focus out if the user requests an popup menu - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(FCSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut self.lineEdit().deselect() self.readyToEdit = True @@ -1116,12 +1116,12 @@ class FCSpinner(QtWidgets.QSpinBox): try: if int(text) < min_val or int(text) > max_val: self.confirmation_signal.emit(False, min_val, max_val) - return QtGui.QValidator.Intermediate, text, p_int + return QtGui.QValidator.State.Intermediate, text, p_int except ValueError: pass self.confirmation_signal.emit(True, min_val, max_val) - return QtGui.QValidator.Acceptable, p_str, p_int + return QtGui.QValidator.State.Acceptable, p_str, p_int def set_range(self, min_val, max_val): self.blockSignals(True) @@ -1146,9 +1146,9 @@ class FCDoubleSlider(QtWidgets.QSlider): def __init__(self, decimals=3, orientation='horizontal', *args, **kargs): if orientation == 'horizontal': - super(FCDoubleSlider, self).__init__(QtCore.Qt.Horizontal, *args, **kargs) + super(FCDoubleSlider, self).__init__(QtCore.Qt.Orientation.Horizontal, *args, **kargs) else: - super(FCDoubleSlider, self).__init__(QtCore.Qt.Vertical, *args, **kargs) + super(FCDoubleSlider, self).__init__(QtCore.Qt.Orientation.Vertical, *args, **kargs) self._multi = 10 ** decimals @@ -1206,11 +1206,11 @@ class FCSliderWithDoubleSpinner(QtWidgets.QFrame): self.spinner.set_step(step) self.spinner.setMinimumWidth(70) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) self.spinner.setSizePolicy(sizePolicy) self.layout = QtWidgets.QHBoxLayout() - self.layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.addWidget(self.slider) self.layout.addWidget(self.spinner) @@ -1271,11 +1271,11 @@ class FCButtonWithDoubleSpinner(QtWidgets.QFrame): self.spinner.set_precision(decimals) self.spinner.setMinimumWidth(70) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.spinner.setSizePolicy(sizePolicy) self.layout = QtWidgets.QHBoxLayout() - self.layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.addWidget(self.spinner) self.layout.addWidget(self.button) @@ -1327,25 +1327,25 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox): # by default don't allow the minus sign to be entered as the default for QDoubleSpinBox is the positive range # between 0.00 and 99.00 (2 decimals) self.lineEdit().setValidator( - QtGui.QRegExpValidator(QtCore.QRegExp("\+?[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self)) + QtGui.QRegularExpressionValidator(QtCore.QRegularExpression("\+?[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self)) if suffix: self.setSuffix(' %s' % str(suffix)) if alignment: if alignment == 'center': - align_val = QtCore.Qt.AlignHCenter + align_val = QtCore.Qt.AlignmentFlag.AlignHCenter elif alignment == 'right': - align_val = QtCore.Qt.AlignRight + align_val = QtCore.Qt.AlignmentFlag.AlignRight else: - align_val = QtCore.Qt.AlignLeft + align_val = QtCore.Qt.AlignmentFlag.AlignLeft self.setAlignment(align_val) self.prev_readyToEdit = True self.menu = None if policy: - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Preferred) self.setSizePolicy(sizePolicy) def on_edit_finished(self): @@ -1353,7 +1353,7 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox): self.returnPressed.emit() def eventFilter(self, object, event): - if event.type() == QtCore.QEvent.MouseButtonPress and self.prev_readyToEdit is True: + if event.type() == QtCore.QEvent.Type.MouseButtonPress and self.prev_readyToEdit is True: self.prev_readyToEdit = False if self.isEnabled(): if self.readyToEdit: @@ -1366,7 +1366,7 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox): return False def keyPressEvent(self, event): - if event.key() == Qt.Key_Enter: + if event.key() == Qt.Key.Key_Enter: self.returnPressed.emit() self.clearFocus() else: @@ -1379,7 +1379,7 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox): def focusOutEvent(self, e): # don't focus out if the user requests an popup menu - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(FCDoubleSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut self.lineEdit().deselect() self.readyToEdit = True @@ -1505,12 +1505,12 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox): try: if float(text) < min_val or float(text) > max_val: self.confirmation_signal.emit(False, min_val, max_val) - return QtGui.QValidator.Intermediate, text, p_int + return QtGui.QValidator.State.Intermediate, text, p_int except ValueError: pass self.confirmation_signal.emit(True, min_val, max_val) - return QtGui.QValidator.Acceptable, p_str, p_int + return QtGui.QValidator.State.Acceptable, p_str, p_int def get_value(self): return float(self.value()) @@ -1529,15 +1529,15 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox): # make sure that the user can't type more decimals than the set precision if self.minimum() < 0 or self.maximum() <= 0: self.lineEdit().setValidator( - QtGui.QRegExpValidator(QtCore.QRegExp("-?[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self)) + QtGui.QRegularExpressionValidator(QtCore.QRegularExpression("-?[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self)) else: self.lineEdit().setValidator( - QtGui.QRegExpValidator(QtCore.QRegExp("\+?[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self)) + QtGui.QRegularExpressionValidator(QtCore.QRegularExpression("\+?[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self)) def set_range(self, min_val, max_val): if min_val < 0 or max_val <= 0: self.lineEdit().setValidator( - QtGui.QRegExpValidator(QtCore.QRegExp("-?[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self)) + QtGui.QRegularExpressionValidator(QtCore.QRegularExpression("-?[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self)) self.setRange(min_val, max_val) @@ -1726,7 +1726,7 @@ class FCTextAreaExtended(FCTextEdit): def insert_completion_click(self): self.completer.insertText.emit(self.completer.getSelected()) - self.completer.setCompletionMode(QCompleter.PopupCompletion) + self.completer.setCompletionMode(QCompleter.CompletionMode.PopupCompletion) def insertCompletion(self, completion): tc = self.textCursor() @@ -1738,8 +1738,8 @@ class FCTextAreaExtended(FCTextEdit): self.completer.popup().hide() return - tc.movePosition(QTextCursor.Left) - tc.movePosition(QTextCursor.EndOfWord) + tc.movePosition(QTextCursor.MoveOperation.Left) + tc.movePosition(QTextCursor.MoveOperation.EndOfWord) tc.insertText(completion[-extra:]) # add a space after inserting the word tc.insertText(' ') @@ -1765,7 +1765,7 @@ class FCTextAreaExtended(FCTextEdit): :return: """ modifier = QtWidgets.QApplication.keyboardModifiers() - if modifier == Qt.ShiftModifier: + if modifier == Qt.KeyboardModifier.ShiftModifier: text = data.text() text = text.replace('\\', '/') self.insertPlainText(text) @@ -1781,51 +1781,51 @@ class FCTextAreaExtended(FCTextEdit): key = event.key() modifier = QtWidgets.QApplication.keyboardModifiers() - if modifier & Qt.ControlModifier and modifier & Qt.ShiftModifier: - if key == QtCore.Qt.Key_V: + if modifier & Qt.KeyboardModifier.ControlModifier and modifier & Qt.KeyboardModifier.ShiftModifier: + if key == QtCore.Qt.Key.Key_V: clipboard = QtWidgets.QApplication.clipboard() clip_text = clipboard.text() clip_text = clip_text.replace('\\', '/') self.insertPlainText(clip_text) - elif modifier & Qt.ControlModifier: - if key == Qt.Key_Slash: + elif modifier & Qt.KeyboardModifier.ControlModifier: + if key == Qt.Key.Key_Slash: self.comment() tc = self.textCursor() - if (key == Qt.Key_Tab or key == Qt.Key_Enter or key == Qt.Key_Return) and self.completer.popup().isVisible(): + if (key == Qt.Key.Key_Tab or key == Qt.Key.Key_Enter or key == Qt.Key.Key_Return) and self.completer.popup().isVisible(): self.completer.insertText.emit(self.completer.getSelected()) - self.completer.setCompletionMode(QCompleter.PopupCompletion) + self.completer.setCompletionMode(QCompleter.CompletionMode.PopupCompletion) return - elif key == Qt.Key_BraceLeft: + elif key == Qt.Key.Key_BraceLeft: tc.insertText('{}') - self.moveCursor(QtGui.QTextCursor.Left) - elif key == Qt.Key_BracketLeft: + self.moveCursor(QtGui.QTextCursor.MoveOperation.Left) + elif key == Qt.Key.Key_BracketLeft: tc.insertText('[]') - self.moveCursor(QtGui.QTextCursor.Left) - elif key == Qt.Key_ParenLeft: + self.moveCursor(QtGui.QTextCursor.MoveOperation.Left) + elif key == Qt.Key.Key_ParenLeft: tc.insertText('()') - self.moveCursor(QtGui.QTextCursor.Left) + self.moveCursor(QtGui.QTextCursor.MoveOperation.Left) - elif key == Qt.Key_BraceRight: - tc.select(QtGui.QTextCursor.WordUnderCursor) + elif key == Qt.Key.Key_BraceRight: + tc.select(QtGui.QTextCursor.SelectionType.WordUnderCursor) if tc.selectedText() == '}': - tc.movePosition(QTextCursor.Right) + tc.movePosition(QTextCursor.MoveOperation.Right) self.setTextCursor(tc) else: tc.clearSelection() self.textCursor().insertText('}') - elif key == Qt.Key_BracketRight: - tc.select(QtGui.QTextCursor.WordUnderCursor) + elif key == Qt.Key.Key_BracketRight: + tc.select(QtGui.QTextCursor.SelectionTypeWordUnderCursor) if tc.selectedText() == ']': - tc.movePosition(QTextCursor.Right) + tc.movePosition(QTextCursor.MoveOperation.Right) self.setTextCursor(tc) else: tc.clearSelection() self.textCursor().insertText(']') - elif key == Qt.Key_ParenRight: - tc.select(QtGui.QTextCursor.WordUnderCursor) + elif key == Qt.Key.Key_ParenRight: + tc.select(QtGui.QTextCursor.SelectionTypeWordUnderCursor) if tc.selectedText() == ')': - tc.movePosition(QTextCursor.Right) + tc.movePosition(QTextCursor.MoveOperation.Right) self.setTextCursor(tc) else: tc.clearSelection() @@ -1834,7 +1834,7 @@ class FCTextAreaExtended(FCTextEdit): super(FCTextAreaExtended, self).keyPressEvent(event) if self.completer_enable: - tc.select(QTextCursor.WordUnderCursor) + tc.select(QTextCursor.SelectionTypeWordUnderCursor) cr = self.cursorRect() if len(tc.selectedText()) > 0: @@ -1855,21 +1855,21 @@ class FCTextAreaExtended(FCTextEdit): :return: """ pos = self.textCursor().position() - self.moveCursor(QtGui.QTextCursor.StartOfLine) + self.moveCursor(QtGui.QTextCursor.MoveOperation.StartOfLine) line_text = self.textCursor().block().text() if self.textCursor().block().text().startswith(" "): # skip the white space - self.moveCursor(QtGui.QTextCursor.NextWord) - self.moveCursor(QtGui.QTextCursor.NextCharacter, QtGui.QTextCursor.KeepAnchor) + self.moveCursor(QtGui.QTextCursor.MoveOperation.NextWord) + self.moveCursor(QtGui.QTextCursor.MoveOperation.NextCharacter, QtGui.QTextCursor.MoveMode.KeepAnchor) character = self.textCursor().selectedText() if character == "#": # delete # self.textCursor().deletePreviousChar() # delete white space - self.moveCursor(QtGui.QTextCursor.NextWord, QtGui.QTextCursor.KeepAnchor) + self.moveCursor(QtGui.QTextCursor.MoveOperation.NextWord, QtGui.QTextCursor.MoveMode.KeepAnchor) self.textCursor().removeSelectedText() else: - self.moveCursor(QtGui.QTextCursor.PreviousCharacter, QtGui.QTextCursor.KeepAnchor) + self.moveCursor(QtGui.QTextCursor.MoveOperation.PreviousCharacter, QtGui.QTextCursor.MoveMode.KeepAnchor) self.textCursor().insertText("# ") cursor = QtGui.QTextCursor(self.textCursor()) cursor.setPosition(pos) @@ -1957,7 +1957,7 @@ class FCPlainTextAreaExtended(QtWidgets.QPlainTextEdit): def insert_completion_click(self): self.completer.insertText.emit(self.completer.getSelected()) - self.completer.setCompletionMode(QCompleter.PopupCompletion) + self.completer.setCompletionMode(QCompleter.CompletionMode.PopupCompletion) def insertCompletion(self, completion): tc = self.textCursor() @@ -1969,8 +1969,8 @@ class FCPlainTextAreaExtended(QtWidgets.QPlainTextEdit): self.completer.popup().hide() return - tc.movePosition(QTextCursor.Left) - tc.movePosition(QTextCursor.EndOfWord) + tc.movePosition(QTextCursor.MoveOperation.Left) + tc.movePosition(QTextCursor.MoveOperation.EndOfWord) tc.insertText(completion[-extra:]) # add a space after inserting the word tc.insertText(' ') @@ -2073,7 +2073,7 @@ class FCPlainTextAreaExtended(QtWidgets.QPlainTextEdit): :return: """ modifier = QtWidgets.QApplication.keyboardModifiers() - if modifier == Qt.ShiftModifier: + if modifier == Qt.KeyboardModifier.ShiftModifier: text = data.text() text = text.replace('\\', '/') self.insertPlainText(text) @@ -2089,51 +2089,51 @@ class FCPlainTextAreaExtended(QtWidgets.QPlainTextEdit): key = event.key() modifier = QtWidgets.QApplication.keyboardModifiers() - if modifier & Qt.ControlModifier and modifier & Qt.ShiftModifier: - if key == QtCore.Qt.Key_V: + if modifier & Qt.KeyboardModifier.ControlModifier and modifier & Qt.KeyboardModifier.ShiftModifier: + if key == QtCore.Qt.Key.Key_V: clipboard = QtWidgets.QApplication.clipboard() clip_text = clipboard.text() clip_text = clip_text.replace('\\', '/') self.insertPlainText(clip_text) - if modifier & Qt.ControlModifier and key == Qt.Key_Slash: + if modifier & Qt.KeyboardModifier.ControlModifier and key == Qt.Key.Key_Slash: self.comment() tc = self.textCursor() - if (key == Qt.Key_Tab or key == Qt.Key_Enter or key == Qt.Key_Return) and self.completer.popup().isVisible(): + if (key == Qt.Key.Key_Tab or key == Qt.Key.Key_Enter or key == Qt.Key.Key_Return) and self.completer.popup().isVisible(): self.completer.insertText.emit(self.completer.getSelected()) - self.completer.setCompletionMode(QCompleter.PopupCompletion) + self.completer.setCompletionMode(QCompleter.CompletionMode.PopupCompletion) return - elif key == Qt.Key_BraceLeft: + elif key == Qt.Key.Key_BraceLeft: tc.insertText('{}') - self.moveCursor(QtGui.QTextCursor.Left) - elif key == Qt.Key_BracketLeft: + self.moveCursor(QtGui.QTextCursor.MoveOperation.Left) + elif key == Qt.Key.Key_BracketLeft: tc.insertText('[]') - self.moveCursor(QtGui.QTextCursor.Left) - elif key == Qt.Key_ParenLeft: + self.moveCursor(QtGui.QTextCursor.MoveOperation.Left) + elif key == Qt.Key.Key_ParenLeft: tc.insertText('()') - self.moveCursor(QtGui.QTextCursor.Left) + self.moveCursor(QtGui.QTextCursor.MoveOperation.Left) - elif key == Qt.Key_BraceRight: - tc.select(QtGui.QTextCursor.WordUnderCursor) + elif key == Qt.Key.Key_BraceRight: + tc.select(QtGui.QTextCursor.SelectionType.WordUnderCursor) if tc.selectedText() == '}': - tc.movePosition(QTextCursor.Right) + tc.movePosition(QTextCursor.MoveOperation.Right) self.setTextCursor(tc) else: tc.clearSelection() self.textCursor().insertText('}') - elif key == Qt.Key_BracketRight: - tc.select(QtGui.QTextCursor.WordUnderCursor) + elif key == Qt.Key.Key_BracketRight: + tc.select(QtGui.QTextCursor.SelectionType.WordUnderCursor) if tc.selectedText() == ']': - tc.movePosition(QTextCursor.Right) + tc.movePosition(QTextCursor.MoveOperation.Right) self.setTextCursor(tc) else: tc.clearSelection() self.textCursor().insertText(']') - elif key == Qt.Key_ParenRight: - tc.select(QtGui.QTextCursor.WordUnderCursor) + elif key == Qt.Key.Key_ParenRight: + tc.select(QtGui.QTextCursor.SelectionType.WordUnderCursor) if tc.selectedText() == ')': - tc.movePosition(QTextCursor.Right) + tc.movePosition(QTextCursor.MoveOperation.Right) self.setTextCursor(tc) else: tc.clearSelection() @@ -2142,7 +2142,7 @@ class FCPlainTextAreaExtended(QtWidgets.QPlainTextEdit): super(FCPlainTextAreaExtended, self).keyPressEvent(event) if self.completer_enable: - tc.select(QTextCursor.WordUnderCursor) + tc.select(QTextCursor.SelectionType.WordUnderCursor) cr = self.cursorRect() if len(tc.selectedText()) > 0: @@ -2163,21 +2163,21 @@ class FCPlainTextAreaExtended(QtWidgets.QPlainTextEdit): :return: """ pos = self.textCursor().position() - self.moveCursor(QtGui.QTextCursor.StartOfLine) + self.moveCursor(QtGui.QTextCursor.MoveOperation.StartOfLine) self.textCursor().block().text() if self.textCursor().block().text().startswith(" "): # skip the white space - self.moveCursor(QtGui.QTextCursor.NextWord) - self.moveCursor(QtGui.QTextCursor.NextCharacter, QtGui.QTextCursor.KeepAnchor) + self.moveCursor(QtGui.QTextCursor.MoveOperation.NextWord) + self.moveCursor(QtGui.QTextCursor.MoveOperation.NextCharacter, QtGui.QTextCursor.MoveMode.KeepAnchor) character = self.textCursor().selectedText() if character == "#": # delete # self.textCursor().deletePreviousChar() # delete white space - self.moveCursor(QtGui.QTextCursor.NextWord, QtGui.QTextCursor.KeepAnchor) + self.moveCursor(QtGui.QTextCursor.MoveOperation.NextWord, QtGui.QTextCursor.MoveMode.KeepAnchor) self.textCursor().removeSelectedText() else: - self.moveCursor(QtGui.QTextCursor.PreviousCharacter, QtGui.QTextCursor.KeepAnchor) + self.moveCursor(QtGui.QTextCursor.MoveOperation.PreviousCharacter, QtGui.QTextCursor.MoveMode.KeepAnchor) self.textCursor().insertText("# ") cursor = QtGui.QTextCursor(self.textCursor()) cursor.setPosition(pos) @@ -2188,16 +2188,16 @@ class FCComboBox(QtWidgets.QComboBox): def __init__(self, parent=None, callback=None, policy=True): super(FCComboBox, self).__init__(parent) - self.setFocusPolicy(QtCore.Qt.StrongFocus) + self.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.view = self.view() self.view.viewport().installEventFilter(self) - self.view.setContextMenuPolicy(Qt.CustomContextMenu) + self.view.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self._set_last = False self._obj_type = None if policy is True: - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Preferred) self.setSizePolicy(sizePolicy) # the callback() will be called on customcontextmenu event and will be be passed 2 parameters: @@ -2207,8 +2207,8 @@ class FCComboBox(QtWidgets.QComboBox): self.view.customContextMenuRequested.connect(lambda pos: callback(pos, self)) def eventFilter(self, obj, event): - if event.type() == QtCore.QEvent.MouseButtonRelease: - if event.button() == Qt.RightButton: + if event.type() == QtCore.QEvent.Type.MouseButtonRelease: + if event.button() == Qt.MouseButton.RightButton: return True return False @@ -2245,7 +2245,7 @@ class FCComboBox(QtWidgets.QComboBox): self._obj_type = val def on_model_changed(self, parent, first, last): - if self.model().data(parent, QtCore.Qt.DisplayRole) == self.obj_type: + if self.model().data(parent, QtCore.Qt.ItemDataRole.DisplayRole) == self.obj_type: self.setCurrentIndex(first) @@ -2409,7 +2409,7 @@ class FCInputSpinner(QtWidgets.QDialog): self.wdg.set_step(self.step) self.wdg.set_precision(decimals) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) self.wdg.setSizePolicy(sizePolicy) QBtn = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel @@ -2614,13 +2614,13 @@ class FCLabel(QtWidgets.QLabel): self.right_clicked_state = False def mousePressEvent(self, event): - if event.button() == Qt.LeftButton: + if event.button() == Qt.MouseButton.LeftButton: self.clicked_state = not self.clicked_state self.clicked.emit(self.clicked_state) - elif event.button() == Qt.RightButton: + elif event.button() == Qt.MouseButton.RightButton: self.right_clicked_state = not self.right_clicked_state self.right_clicked.emit(True) - elif event.button() == Qt.MiddleButton: + elif event.button() == Qt.MouseButton.MiddleButton: self.middle_clicked_state = not self.middle_clicked_state self.middle_clicked.emit(True) @@ -2659,7 +2659,7 @@ class FCTab(QtWidgets.QTabWidget): self.removeTab(currentIndex) def protectTab(self, currentIndex): - self.tabBar().setTabButton(currentIndex, QtWidgets.QTabBar.RightSide, None) + self.tabBar().setTabButton(currentIndex, QtWidgets.QTabBar.ButtonPosition.RightSide, None) # class FCTabBar(QtWidgets.QTabBar): @@ -2738,11 +2738,11 @@ class FCDetachableTab(QtWidgets.QTabWidget): return val def setupContextMenu(self): - self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) + self.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.ActionsContextMenu) def addContextMenu(self, entry, call_function, icon=None, initial_checked=False): action_name = str(entry) - action = QtWidgets.QAction(self) + action = QtGui.QAction(self) action.setCheckable(True) action.setText(action_name) if icon: @@ -2789,7 +2789,7 @@ class FCDetachableTab(QtWidgets.QTabWidget): def protectTab(self, currentIndex): # self.FCTabBar().setTabButton(currentIndex, QtWidgets.QTabBar.RightSide, None) - self.tabBar.setTabButton(currentIndex, QtWidgets.QTabBar.RightSide, None) + self.tabBar.setTabButton(currentIndex, QtWidgets.QTabBar.ButtonPosition.RightSide, None) def setMovable(self, movable): """ @@ -2845,7 +2845,7 @@ class FCDetachableTab(QtWidgets.QTabWidget): # Create a new detached tab window detachedTab = self.FCDetachedTab(name, contentWidget) - detachedTab.setWindowModality(QtCore.Qt.NonModal) + detachedTab.setWindowModality(QtCore.Qt.WindowModality.NonModal) detachedTab.setWindowIcon(icon) detachedTab.setGeometry(contentWidgetRect) detachedTab.onCloseSignal.connect(self.attachTab) @@ -3102,7 +3102,7 @@ class FCDetachableTab(QtWidgets.QTabWidget): """ # If a NonClientAreaMouseMove (173) event immediately follows a Move event... - if self.lastEvent == QtCore.QEvent.Move and event.type() == 173: + if self.lastEvent == QtCore.QEvent.Type.Move and event.type() == 173: # Determine the position of the mouse cursor and emit it with the # onDropSignal @@ -3127,8 +3127,8 @@ class FCDetachableTab(QtWidgets.QTabWidget): QtWidgets.QTabBar.__init__(self, parent) self.setAcceptDrops(True) - self.setElideMode(QtCore.Qt.ElideRight) - self.setSelectionBehaviorOnRemove(QtWidgets.QTabBar.SelectLeftTab) + self.setElideMode(QtCore.Qt.TextElideMode.ElideRight) + self.setSelectionBehaviorOnRemove(QtWidgets.QTabBar.SelectionBehavior.SelectLeftTab) self.prev_index = -1 @@ -3159,9 +3159,9 @@ class FCDetachableTab(QtWidgets.QTabWidget): :param event: a mouse press event :return: """ - if event.button() == QtCore.Qt.LeftButton: + if event.button() == QtCore.Qt.MouseButton.LeftButton: self.dragStartPos = event.pos() - elif event.button() == QtCore.Qt.RightButton: + elif event.button() == QtCore.Qt.MouseButton.RightButton: self.prev_index = self.tabAt(event.pos()) self.dragDropedPos.setX(0) @@ -3178,10 +3178,10 @@ class FCDetachableTab(QtWidgets.QTabWidget): :param event: a mouse press event :return: """ - if event.button() == QtCore.Qt.RightButton and self.prev_index == self.tabAt(event.pos()): + if event.button() == QtCore.Qt.MouseButton.RightButton and self.prev_index == self.tabAt(event.pos()): self.right_click.emit(self.prev_index) - if event.button() == QtCore.Qt.MiddleButton: + if event.button() == QtCore.Qt.MouseButton.MiddleButton: self.onCloseTabSignal.emit(int(self.tabAt(event.pos()))) self.prev_index = -1 @@ -3203,11 +3203,12 @@ class FCDetachableTab(QtWidgets.QTabWidget): self.dragInitiated = True # If the current movement is a drag initiated by the left button - if (event.buttons() & QtCore.Qt.LeftButton) and self.dragInitiated and self.can_be_dragged: + if (event.buttons() & QtCore.Qt.MouseButton.LeftButton) and self.dragInitiated and self.can_be_dragged: # Stop the move event finishMoveEvent = QtGui.QMouseEvent( - QtCore.QEvent.MouseMove, event.pos(), QtCore.Qt.NoButton, QtCore.Qt.NoButton, QtCore.Qt.NoModifier + QtCore.QEvent.Type.MouseMove, event.pos(), QtCore.Qt.MouseButton.NoButton, + QtCore.Qt.MouseButton.NoButton, QtCore.Qt.KeyboardModifier.NoModifier ) QtWidgets.QTabBar.mouseMoveEvent(self, finishMoveEvent) @@ -3225,7 +3226,7 @@ class FCDetachableTab(QtWidgets.QTabWidget): return targetPixmap = QtGui.QPixmap(pixmap.size()) - targetPixmap.fill(QtCore.Qt.transparent) + targetPixmap.fill(QtCore.Qt.GlobalColor.transparent) painter = QtGui.QPainter(targetPixmap) painter.setOpacity(0.85) painter.drawPixmap(0, 0, pixmap) @@ -3233,21 +3234,21 @@ class FCDetachableTab(QtWidgets.QTabWidget): drag.setPixmap(targetPixmap) # Initiate the drag - dropAction = drag.exec_(QtCore.Qt.MoveAction | QtCore.Qt.CopyAction) + dropAction = drag.exec_(QtCore.Qt.DropAction.MoveAction | QtCore.Qt.DropAction.CopyAction) # For Linux: Here, drag.exec_() will not return MoveAction on Linux. So it # must be set manually if self.dragDropedPos.x() != 0 and self.dragDropedPos.y() != 0: - dropAction = QtCore.Qt.MoveAction + dropAction = QtCore.Qt.DropAction.MoveAction # If the drag completed outside of the tab bar, detach the tab and move # the content to the current cursor position - if dropAction == QtCore.Qt.IgnoreAction: + if dropAction == QtCore.Qt.DropAction.IgnoreAction: event.accept() self.onDetachTabSignal.emit(self.tabAt(self.dragStartPos), self.mouseCursor.pos()) # Else if the drag completed inside the tab bar, move the selected tab to the new position - elif dropAction == QtCore.Qt.MoveAction: + elif dropAction == QtCore.Qt.DropAction.MoveAction: if not self.dragDropedPos.isNull(): event.accept() self.onMoveTabSignal.emit(self.tabAt(self.dragStartPos), self.tabAt(self.dragDropedPos)) @@ -3340,7 +3341,7 @@ class FCDetachableTab2(FCDetachableTab): """ # if tab is protected don't delete it - if self.tabBar.tabButton(current_index, QtWidgets.QTabBar.RightSide) is not None: + if self.tabBar.tabButton(current_index, QtWidgets.QTabBar.ButtonPosition.RightSide) is not None: self.closeTab(current_index) def closeTab(self, currentIndex): @@ -3368,8 +3369,8 @@ class VerticalScrollArea(QtWidgets.QScrollArea): def __init__(self, parent=None): QtWidgets.QScrollArea.__init__(self, parent=parent) self.setWidgetResizable(True) - self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded) def eventFilter(self, source, event): """ @@ -3380,7 +3381,7 @@ class VerticalScrollArea(QtWidgets.QScrollArea): :param event: :return: """ - if event.type() == QtCore.QEvent.Resize and source == self.widget(): + if event.type() == QtCore.QEvent.Type.Resize and source == self.widget(): # log.debug("VerticalScrollArea: Widget resized:") # log.debug(" minimumSizeHint().width() = %d" % self.widget().minimumSizeHint().width()) # log.debug(" verticalScrollBar().width() = %d" % self.verticalScrollBar().width()) @@ -3487,12 +3488,12 @@ class FCTable(QtWidgets.QTableWidget): super(FCTable, self).__init__(parent) palette = QtGui.QPalette() - palette.setColor(QtGui.QPalette.Inactive, QtGui.QPalette.Highlight, - palette.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight)) + palette.setColor(QtGui.QPalette.ColorGroup.Inactive, QtGui.QPalette.ColorRole.Highlight, + palette.color(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Highlight)) # make inactive rows text some color as active; may be useful in the future - palette.setColor(QtGui.QPalette.Inactive, QtGui.QPalette.HighlightedText, - palette.color(QtGui.QPalette.Active, QtGui.QPalette.HighlightedText)) + palette.setColor(QtGui.QPalette.ColorGroup.Inactive, QtGui.QPalette.ColorRole.HighlightedText, + palette.color(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.HighlightedText)) self.setPalette(palette) if drag_drop: @@ -3553,14 +3554,14 @@ class FCTable(QtWidgets.QTableWidget): super().focusOutEvent(event) def setupContextMenu(self): - self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) + self.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.ActionsContextMenu) def removeContextMenu(self): - self.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.NoContextMenu) def addContextMenu(self, entry, call_function, icon=None): action_name = str(entry) - action = QtWidgets.QAction(self) + action = QtGui.QAction(self) action.setText(action_name) if icon: assert isinstance(icon, QtGui.QIcon), \ @@ -3633,7 +3634,7 @@ class FCTable(QtWidgets.QTableWidget): # return True # # noinspection PyTypeChecker # return rect.contains(pos, True) and not ( - # int(self.model().flags(index)) & Qt.ItemIsDropEnabled) and pos.y() >= rect.center().y() + # int(self.model().flags(index)) & Qt.ItemFlag.ItemIsDropEnabled) and pos.y() >= rect.center().y() def dragEnterEvent(self, e: QtGui.QDragEnterEvent) -> None: if e.source() == self: @@ -3787,7 +3788,7 @@ class FCTable(QtWidgets.QTableWidget): elif rect.bottom() - pos.y() < margin: return True # noinspection PyTypeChecker - drop_enabled = int(self.model().flags(index)) & Qt.ItemIsDropEnabled + drop_enabled = int(self.model().flags(index)) & Qt.ItemFlag.ItemIsDropEnabled return rect.contains(pos, True) and not drop_enabled and pos.y() >= rect.center().y() @@ -3812,7 +3813,7 @@ class SpinBoxDelegate(QtWidgets.QItemDelegate): def setEditorData(self, spinBox, index): try: - value = float(index.model().data(index, Qt.EditRole)) + value = float(index.model().data(index, Qt.ItemDataRole.EditRole)) except ValueError: value = self.current_value # return @@ -3824,7 +3825,7 @@ class SpinBoxDelegate(QtWidgets.QItemDelegate): value = spinBox.value() self.current_value = value - model.setData(index, value, Qt.EditRole) + model.setData(index, value, Qt.ItemDataRole.EditRole) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) @@ -3865,7 +3866,7 @@ class Dialog_box(QtWidgets.QWidget): def focusOutEvent(self, e): # don't focus out if the user requests an popup menu - if e.reason() != QtCore.Qt.PopupFocusReason: + if e.reason() != QtCore.Qt.FocusReason.PopupFocusReason: super(Dialog_box, self).focusOutEvent(e) # required to remove cursor on focusOut self.lineEdit().deselect() self.readyToEdit = True @@ -3927,7 +3928,7 @@ class DialogBoxRadio(QtWidgets.QDialog): grid0.addWidget(self.lineEdit, 6, 1) self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, - orientation=Qt.Horizontal, parent=self) + orientation=Qt.Orientation.Horizontal, parent=self) grid0.addWidget(self.button_box, 8, 0, 1, 2) self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setText(_("Ok")) @@ -4005,13 +4006,13 @@ class _BrowserTextEdit(QTextEdit): # Save if self.app: self.save_action = QAction('%s\t%s' % (_("Save Log"), _('Ctrl+S')), self) - # save_action.setShortcut(QKeySequence(Qt.Key_S)) + # save_action.setShortcut(QKeySequence(Qt.Key.Key_S)) self.menu.addAction(self.save_action) self.save_action.triggered.connect(lambda: self.save_log(app=self.app)) # Clear self.clear_action = QAction('%s\t%s' % (_("Clear All"), _('Shift+Del')), self) - # clear_action.setShortcut(QKeySequence(Qt.Key_Delete)) + # clear_action.setShortcut(QKeySequence(Qt.Key.Key_Delete)) self.menu.addAction(self.clear_action) self.clear_action.triggered.connect(self.clear) @@ -4059,43 +4060,43 @@ class _BrowserTextEdit(QTextEdit): modifiers = QtWidgets.QApplication.keyboardModifiers() key = event.key() - if modifiers == QtCore.Qt.ControlModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: # Select All - if key == QtCore.Qt.Key_A: + if key == QtCore.Qt.Key.Key_A: self.selectAll() # Copy Text - elif key == QtCore.Qt.Key_C: + elif key == QtCore.Qt.Key.Key_C: self.copy_text() # Find Text - elif key == QtCore.Qt.Key_F: + elif key == QtCore.Qt.Key.Key_F: self.find_text() # Save Log - elif key == QtCore.Qt.Key_S: + elif key == QtCore.Qt.Key.Key_S: if self.app: self.save_log(app=self.app) # Cut Text - elif key == QtCore.Qt.Key_X: + elif key == QtCore.Qt.Key.Key_X: self.cut_text() # Undo Text - elif key == QtCore.Qt.Key_Z: + elif key == QtCore.Qt.Key.Key_Z: if self.isUndoAvailable: self.undo() # Redo Text - elif key == QtCore.Qt.Key_Y: + elif key == QtCore.Qt.Key.Key_Y: if self.isRedoAvailable: self.redo() - if modifiers == QtCore.Qt.ShiftModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: # Clear all - if key == QtCore.Qt.Key_Delete: + if key == QtCore.Qt.Key.Key_Delete: self.clear() - elif modifiers == QtCore.Qt.NoModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: # Clear all - if key == QtCore.Qt.Key_Delete: + if key == QtCore.Qt.Key.Key_Delete: self.delete_text() # Shell toggle - if key == QtCore.Qt.Key_S: + if key == QtCore.Qt.Key.Key_S: self.app.ui.toggle_shell_ui() def copy_text(self): @@ -4135,7 +4136,7 @@ class _BrowserTextEdit(QTextEdit): text = text.replace('!', '') text = text.replace('?', '') text += '

' - self.moveCursor(QTextCursor.End) + self.moveCursor(QTextCursor.MoveOperation.End) self.insertHtml(text) def save_log(self, app): @@ -4175,7 +4176,7 @@ class _ExpandableTextEdit(FCTextEdit): def insert_completion_click(self): self.completer.insertText.emit(self.completer.getSelected()) - self.completer.setCompletionMode(QCompleter.PopupCompletion) + self.completer.setCompletionMode(QCompleter.CompletionMode.PopupCompletion) def insertCompletion(self, completion): tc = self.textCursor() @@ -4187,8 +4188,8 @@ class _ExpandableTextEdit(FCTextEdit): self.completer.popup().hide() return - tc.movePosition(QTextCursor.Left) - tc.movePosition(QTextCursor.EndOfWord) + tc.movePosition(QTextCursor.MoveOperation.Left) + tc.movePosition(QTextCursor.MoveOperation.EndOfWord) tc.insertText(completion[-extra:]) # add a space after inserting the word tc.insertText(' ') @@ -4206,17 +4207,17 @@ class _ExpandableTextEdit(FCTextEdit): """ key = event.key() - if (key == Qt.Key_Tab or key == Qt.Key_Return or key == Qt.Key_Enter) and self.completer.popup().isVisible(): + if (key == Qt.Key.Key_Tab or key == Qt.Key.Key_Return or key == Qt.Key.Key_Enter) and self.completer.popup().isVisible(): self.completer.insertText.emit(self.completer.getSelected()) - self.completer.setCompletionMode(QCompleter.PopupCompletion) + self.completer.setCompletionMode(QCompleter.CompletionMode.PopupCompletion) return - if event.matches(QKeySequence.InsertParagraphSeparator): + if event.matches(QKeySequence.StandardKey.InsertParagraphSeparator): text = self.toPlainText() if self._termWidget.is_command_complete(text): self._termWidget.exec_current_command() return - elif event.matches(QKeySequence.MoveToNextLine): + elif event.matches(QKeySequence.StandardKey.MoveToNextLine): text = self.toPlainText() cursor_pos = self.textCursor().position() textBeforeEnd = text[cursor_pos:] @@ -4224,7 +4225,7 @@ class _ExpandableTextEdit(FCTextEdit): if len(textBeforeEnd.split('\n')) <= 1: self.historyNext.emit() return - elif event.matches(QKeySequence.MoveToPreviousLine): + elif event.matches(QKeySequence.StandardKey.MoveToPreviousLine): text = self.toPlainText() cursor_pos = self.textCursor().position() text_before_start = text[:cursor_pos] @@ -4236,15 +4237,15 @@ class _ExpandableTextEdit(FCTextEdit): if line_count <= 1: self.historyPrev.emit() return - elif event.matches(QKeySequence.MoveToNextPage) or event.matches(QKeySequence.MoveToPreviousPage): + elif event.matches(QKeySequence.StandardKey.MoveToNextPage) or event.matches(QKeySequence.StandardKey.MoveToPreviousPage): return self._termWidget.browser().keyPressEvent(event) - elif event.key() == QtCore.Qt.Key_Escape: + elif event.key() == QtCore.Qt.Key.Key_Escape: self.on_escape_key() tc = self.textCursor() QTextEdit.keyPressEvent(self, event) - tc.select(QTextCursor.WordUnderCursor) + tc.select(QTextCursor.SelectionType.WordUnderCursor) cr = self.cursorRect() if len(tc.selectedText()) > 0: @@ -4285,7 +4286,7 @@ class MyCompleter(QCompleter): def __init__(self, parent=None): QCompleter.__init__(self, parent=parent) - self.setCompletionMode(QCompleter.PopupCompletion) + self.setCompletionMode(QCompleter.CompletionMode.PopupCompletion) self.highlighted.connect(self.setHighlighted) self.lastSelected = '' @@ -4321,7 +4322,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): def adjustWidth(self, count): # three spaces added to the width to make up for the space added in the line number - width = self.fontMetrics().width(str(count) + ' ') + width = self.fontMetrics().boundingRect(str(count) + ' ').width() if self.width() != width: self.setFixedWidth(width) @@ -4349,7 +4350,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): self.color_storage = color_dict if color_dict else {} # self.setFrameStyle(QFrame.NoFrame) - self.setFrameStyle(QtWidgets.QFrame.NoFrame) + self.setFrameStyle(QtWidgets.QFrame.Shape.NoFrame) self.highlight() # self.setLineWrapMode(QPlainTextEdit.NoWrap) self.cursorPositionChanged.connect(self.highlight) @@ -4377,107 +4378,107 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): comment = QtGui.QTextCharFormat() # comment - brush = QtGui.QBrush(Qt.gray, Qt.SolidPattern) - pattern = QtCore.QRegExp("\(.*\)") + brush = QtGui.QBrush(Qt.GlobalColor.gray, Qt.BrushStyle.SolidPattern) + pattern = QtCore.QRegularExpression("\(.*\)") comment.setForeground(brush) rule = (pattern, comment) self.highlightingRules.append(rule) # Marlin comment - brush = QtGui.QBrush(Qt.gray, Qt.SolidPattern) - pattern = QtCore.QRegExp("^;\s*.*$") + brush = QtGui.QBrush(Qt.GlobalColor.gray, Qt.BrushStyle.SolidPattern) + pattern = QtCore.QRegularExpression("^;\s*.*$") comment.setForeground(brush) rule = (pattern, comment) self.highlightingRules.append(rule) # Python comment - brush = QtGui.QBrush(Qt.gray, Qt.SolidPattern) - pattern = QtCore.QRegExp("^\#\s*.*$") + brush = QtGui.QBrush(Qt.GlobalColor.gray, Qt.BrushStyle.SolidPattern) + pattern = QtCore.QRegularExpression("^\#\s*.*$") comment.setForeground(brush) rule = (pattern, comment) self.highlightingRules.append(rule) keyword = QtGui.QTextCharFormat() # keyword - brush = QtGui.QBrush(Qt.blue, Qt.SolidPattern) + brush = QtGui.QBrush(Qt.GlobalColor.blue, Qt.BrushStyle.SolidPattern) keyword.setForeground(brush) - keyword.setFontWeight(QtGui.QFont.Bold) + keyword.setFontWeight(QtGui.QFont.Weight.Bold) keywords = ["G", "T"] for word in keywords: - # pattern = QtCore.QRegExp("\\b" + word + "\\b") - pattern = QtCore.QRegExp("\\b" + word + "\d+(\.\d*)?\s?" + "\\b") + # pattern = QtCore.QRegularExpression("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\\b" + word + "\d+(\.\d*)?\s?" + "\\b") rule = (pattern, keyword) self.highlightingRules.append(rule) keyword1 = QtGui.QTextCharFormat() # keyword 1 - brush = QtGui.QBrush(QtGui.QColor("teal"), Qt.SolidPattern) + brush = QtGui.QBrush(QtGui.QColor("teal"), Qt.BrushStyle.SolidPattern) keyword1.setForeground(brush) - keyword1.setFontWeight(QtGui.QFont.Bold) + keyword1.setFontWeight(QtGui.QFont.Weight.Bold) keywords = ["F"] for word in keywords: - # pattern = QtCore.QRegExp("\\b" + word + "\\b") - pattern = QtCore.QRegExp("\\b" + word + "\d+(\.\d*)?\s?" + "\\b") + # pattern = QtCore.QRegularExpression("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\\b" + word + "\d+(\.\d*)?\s?" + "\\b") rule = (pattern, keyword1) self.highlightingRules.append(rule) # keyword 2 keyword2 = QtGui.QTextCharFormat() # SVG colors: https://doc.qt.io/qt-5/qml-color.html#svg-color-reference - brush = QtGui.QBrush(QtGui.QColor("coral"), Qt.SolidPattern) + brush = QtGui.QBrush(QtGui.QColor("coral"), Qt.BrushStyle.SolidPattern) keyword2.setForeground(brush) - keyword2.setFontWeight(QtGui.QFont.Bold) + keyword2.setFontWeight(QtGui.QFont.Weight.Bold) keywords = ["M"] for word in keywords: - # pattern = QtCore.QRegExp("\\b" + word + "\\b") - pattern = QtCore.QRegExp("\\b" + word + "\d+(\.\d*)?\s?" + "\\b") + # pattern = QtCore.QRegularExpression("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\\b" + word + "\d+(\.\d*)?\s?" + "\\b") rule = (pattern, keyword2) self.highlightingRules.append(rule) # keyword 3 keyword3 = QtGui.QTextCharFormat() # SVG colors: https://doc.qt.io/qt-5/qml-color.html#svg-color-reference - brush = QtGui.QBrush(QtGui.QColor("purple"), Qt.SolidPattern) + brush = QtGui.QBrush(QtGui.QColor("purple"), Qt.BrushStyle.SolidPattern) keyword3.setForeground(brush) - keyword3.setFontWeight(QtGui.QFont.Bold) + keyword3.setFontWeight(QtGui.QFont.Weight.Bold) keywords = ["Z"] for word in keywords: - # pattern = QtCore.QRegExp("\\b" + word + "\\b") - pattern = QtCore.QRegExp("\\b" + word + "[\-|\+]?\d+(\.\d*)?\s?" + "\\b") + # pattern = QtCore.QRegularExpression("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\\b" + word + "[\-|\+]?\d+(\.\d*)?\s?" + "\\b") rule = (pattern, keyword3) self.highlightingRules.append(rule) # reservedClasses reservedClasses.setForeground(brush) - reservedClasses.setFontWeight(QtGui.QFont.Bold) + reservedClasses.setFontWeight(QtGui.QFont.Weight.Bold) keywords = ["array", "character", "complex", "data.frame", "double", "factor", "function", "integer", "list", "logical", "matrix", "numeric", "vector"] for word in keywords: - pattern = QtCore.QRegExp("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\\b" + word + "\\b") rule = (pattern, reservedClasses) self.highlightingRules.append(rule) # parameter - brush = QtGui.QBrush(Qt.darkBlue, Qt.SolidPattern) - pattern = QtCore.QRegExp("\-[0-9a-zA-Z]*\s") + brush = QtGui.QBrush(Qt.GlobalColor.darkBlue, Qt.BrushStyle.SolidPattern) + pattern = QtCore.QRegularExpression("\-[0-9a-zA-Z]*\s") parameterOperator.setForeground(brush) - parameterOperator.setFontWeight(QtGui.QFont.Bold) + parameterOperator.setFontWeight(QtGui.QFont.Weight.Bold) rule = (pattern, parameterOperator) self.highlightingRules.append(rule) # delimiter - pattern = QtCore.QRegExp("[\)\(]+|[\{\}]+|[][]+") + pattern = QtCore.QRegularExpression("[\)\(]+|[\{\}]+|[][]+") delimiter.setForeground(brush) - delimiter.setFontWeight(QtGui.QFont.Bold) + delimiter.setFontWeight(QtGui.QFont.Weight.Bold) rule = (pattern, delimiter) self.highlightingRules.append(rule) # specialConstant - brush = QtGui.QBrush(Qt.green, Qt.SolidPattern) + brush = QtGui.QBrush(Qt.GlobalColor.green, Qt.BrushStyle.SolidPattern) specialConstant.setForeground(brush) keywords = ["Inf", "NA", "NaN", "NULL"] for word in keywords: - pattern = QtCore.QRegExp("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\\b" + word + "\\b") rule = (pattern, specialConstant) self.highlightingRules.append(rule) @@ -4485,46 +4486,46 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): boolean.setForeground(brush) keywords = ["TRUE", "True","FALSE", "False"] for word in keywords: - pattern = QtCore.QRegExp("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\\b" + word + "\\b") rule = (pattern, boolean) self.highlightingRules.append(rule) # number - # pattern = QtCore.QRegExp("[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?") + # pattern = QtCore.QRegularExpression("[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?") # pattern.setMinimal(True) # number.setForeground(brush) # rule = (pattern, number) # self.highlightingRules.append(rule) # string - brush = QtGui.QBrush(Qt.red, Qt.SolidPattern) - pattern = QtCore.QRegExp("\".*\"") + brush = QtGui.QBrush(Qt.GlobalColor.red, Qt.BrushStyle.SolidPattern) + pattern = QtCore.QRegularExpression("\".*\"") pattern.setMinimal(True) string.setForeground(brush) rule = (pattern, string) self.highlightingRules.append(rule) # singleQuotedString - pattern = QtCore.QRegExp("\'.*\'") + pattern = QtCore.QRegularExpression("\'.*\'") pattern.setMinimal(True) singleQuotedString.setForeground(brush) rule = (pattern, singleQuotedString) self.highlightingRules.append(rule) # X coordinate - brush = QtGui.QBrush(Qt.darkBlue, Qt.SolidPattern) - pattern = QtCore.QRegExp("X") + brush = QtGui.QBrush(Qt.GlobalColor.darkBlue, Qt.BrushStyle.SolidPattern) + pattern = QtCore.QRegularExpression("X") pattern.setMinimal(True) - x_chars.setFontWeight(QtGui.QFont.Bold) + x_chars.setFontWeight(QtGui.QFont.Weight.Bold) x_chars.setForeground(brush) rule = (pattern, x_chars) self.highlightingRules.append(rule) # Y coordinate - brush = QtGui.QBrush(Qt.darkBlue, Qt.SolidPattern) - pattern = QtCore.QRegExp("Y") + brush = QtGui.QBrush(Qt.GlobalColor.darkBlue, Qt.BrushStyle.SolidPattern) + pattern = QtCore.QRegularExpression("Y") pattern.setMinimal(True) - y_chars.setFontWeight(QtGui.QFont.Bold) + y_chars.setFontWeight(QtGui.QFont.Weight.Bold) y_chars.setForeground(brush) rule = (pattern, y_chars) self.highlightingRules.append(rule) @@ -4542,7 +4543,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): # go in reverse from the last element to the first for rule in self.highlightingRules[::-1]: - expression = QtCore.QRegExp(rule[0]) + expression = QtCore.QRegularExpression(rule[0]) index = expression.indexIn(text) while index >= 0: length = expression.matchedLength() @@ -4562,7 +4563,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): hi_selection = QTextEdit.ExtraSelection() hi_selection.format.setBackground(self.palette().alternateBase()) - hi_selection.format.setProperty(QtGui.QTextFormat.FullWidthSelection, True) + hi_selection.format.setProperty(QtGui.QTextFormat.Property.FullWidthSelection, True) hi_selection.cursor = self.textCursor() hi_selection.cursor.clearSelection() @@ -4573,7 +4574,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): current_line = self.document().findBlock(self.textCursor().position()).blockNumber() + 1 painter = QtGui.QPainter(number_bar) - painter.fillRect(event.rect(), QtCore.Qt.lightGray) + painter.fillRect(event.rect(), QtCore.Qt.GlobalColor.lightGray) block = self.firstVisibleBlock() line_count = int(block.blockNumber()) @@ -4592,7 +4593,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): if line_count == current_line: font = painter.font() font.setBold(True) - painter.setPen(QtCore.Qt.blue) + painter.setPen(QtCore.Qt.GlobalColor.blue) painter.setFont(font) else: font = painter.font() @@ -4604,7 +4605,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): paint_rect = QtCore.QRect(0, block_top, number_bar.width(), font_metrics.height()) # I add some spaces to the line_count to prettify; make sure to remember adjust the width in the # NumberBar() class above - painter.drawText(paint_rect, Qt.AlignRight, ' ' + str(line_count) + ' ') + painter.drawText(paint_rect, Qt.AlignmentFlag.AlignRight, ' ' + str(line_count) + ' ') block = block.next() block_top = block_bottom @@ -4615,7 +4616,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): def __init__(self, *args, color_dict=None): QtWidgets.QFrame.__init__(self, *args) - self.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Sunken) + self.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Shadow.Sunken) self.edit = self.PlainTextEdit(color_dict=color_dict) self.number_bar = self.NumberBar(self.edit) @@ -4675,10 +4676,10 @@ class FCDock(QtWidgets.QDockWidget): super(FCDock, self).__init__(*args) self.close_callback = kwargs["close_callback"] if "close_callback" in kwargs else None - self.setContextMenuPolicy(Qt.PreventContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu.PreventContextMenu) def mousePressEvent(self, event: QtGui.QMouseEvent) -> None: - if event.button() == Qt.MiddleButton: + if event.button() == Qt.MouseButton.MiddleButton: try: self.close_callback() except Exception: @@ -4705,7 +4706,7 @@ class FCJog(QtWidgets.QFrame): # JOG axes grbl_jog_grid = QtWidgets.QGridLayout() - grbl_jog_grid.setAlignment(QtCore.Qt.AlignCenter) + grbl_jog_grid.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) grbl_jog_grid.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) grbl_jog_grid.setContentsMargins(2, 4, 2, 4) @@ -4756,7 +4757,7 @@ class FCJog(QtWidgets.QFrame): self.jog_z_up_button = QtWidgets.QToolButton() self.jog_z_up_button.setIcon(QtGui.QIcon(self.app.resource_location + '/up-arrow32.png')) self.jog_z_up_button.setText('Z') - self.jog_z_up_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) + self.jog_z_up_button.setToolButtonStyle(QtCore.Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.jog_z_up_button.setToolTip( _("Jog the Z axis.") ) @@ -4766,7 +4767,7 @@ class FCJog(QtWidgets.QFrame): self.jog_z_down_button = QtWidgets.QToolButton() self.jog_z_down_button.setIcon(QtGui.QIcon(self.app.resource_location + '/down-arrow32.png')) self.jog_z_down_button.setText('Z') - self.jog_z_down_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) + self.jog_z_down_button.setToolButtonStyle(QtCore.Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.jog_z_down_button.setToolTip( _("Jog the Z axis.") ) @@ -4821,7 +4822,7 @@ class FCZeroAxes(QtWidgets.QFrame): # Zeroo all axes self.grbl_zero_all_button = QtWidgets.QToolButton() self.grbl_zero_all_button.setText(_("All")) - self.grbl_zero_all_button.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.grbl_zero_all_button.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) self.grbl_zero_all_button.setToolTip( _("Zero all CNC axes at current position.") @@ -4977,7 +4978,7 @@ class FlatCAMActivityView(QtWidgets.QWidget): layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(5, 0, 5, 0) - layout.setAlignment(QtCore.Qt.AlignLeft) + layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) self.setLayout(layout) layout.addWidget(self.icon) @@ -5089,7 +5090,7 @@ class FlatCAMSystemTray(QtWidgets.QSystemTrayIcon): menu = QtWidgets.QMenu(parent) - menu_runscript = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/script14.png'), + menu_runscript = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/script14.png'), '%s' % _('Run Script ...'), self) menu_runscript.setToolTip( _("Will run the opened Tcl Script thus\n" @@ -5104,23 +5105,23 @@ class FlatCAMSystemTray(QtWidgets.QSystemTrayIcon): self.menu_open = menu.addMenu(QtGui.QIcon(self.app.resource_location + '/folder32_bis.png'), _('Open')) # Open Project ... - menu_openproject = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/folder16.png'), + menu_openproject = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/folder16.png'), '%s ...' % _('Open Project'), self) self.menu_open.addAction(menu_openproject) self.menu_open.addSeparator() # Open Gerber ... - menu_opengerber = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/flatcam_icon24.png'), + menu_opengerber = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/flatcam_icon24.png'), '%s ...\t%s' % (_('Open Gerber'), _('Ctrl+G')), self) self.menu_open.addAction(menu_opengerber) # Open Excellon ... - menu_openexcellon = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), + menu_openexcellon = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), '%s ...\t%s' % (_('Open Excellon'), _('Ctrl+E')), self) self.menu_open.addAction(menu_openexcellon) # Open G-Code ... - menu_opengcode = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/code.png'), + menu_opengcode = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/code.png'), '%s ...' % _('Open G-Code'), self) self.menu_open.addAction(menu_opengcode) diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index 38620f9e..1799d12e 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -10,7 +10,7 @@ # File Modified (major mod): Marius Adrian Stanciu # # Date: 3/10/2019 # # ########################################################## -from PyQt5.QtCore import QSettings +from PyQt6.QtCore import QSettings import platform @@ -68,12 +68,12 @@ class MainGUI(QtWidgets.QMainWindow): # ####################################################################### self.menu = self.menuBar() - self.menu_toggle_nb = QtWidgets.QAction( + self.menu_toggle_nb = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/notebook32.png'), _("Toggle Panel")) self.menu_toggle_nb.setToolTip( _("Toggle Panel") ) - # self.menu_toggle_nb = QtWidgets.QAction("NB") + # self.menu_toggle_nb = QtGui.QAction("NB") self.menu_toggle_nb.setCheckable(True) self.menu.addAction(self.menu_toggle_nb) @@ -85,8 +85,8 @@ class MainGUI(QtWidgets.QMainWindow): self.menufile.setToolTipsVisible(True) # New Project - self.menufilenewproject = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/file16.png'), - '%s...\t%s' % (_('New Project'), _("Ctrl+N")), self) + self.menufilenewproject = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/file16.png'), + '%s...\t%s' % (_('New Project'), _("Ctrl+N")), self) self.menufilenewproject.setToolTip( _("Will create a new, blank project") ) @@ -124,31 +124,31 @@ class MainGUI(QtWidgets.QMainWindow): self.menufile_open.setToolTipsVisible(True) # Open Project ... - self.menufileopenproject = QtWidgets.QAction( + self.menufileopenproject = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/folder16.png'), '%s...\t%s' % (_('Open Project'), _('Ctrl+O')), self) self.menufile_open.addAction(self.menufileopenproject) self.menufile_open.addSeparator() # Open Gerber ... - self.menufileopengerber = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/flatcam_icon24.png'), + self.menufileopengerber = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/flatcam_icon24.png'), '%s...\t%s' % (_('Open Gerber'), _('Ctrl+G')), self) self.menufile_open.addAction(self.menufileopengerber) # Open Excellon ... - self.menufileopenexcellon = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), + self.menufileopenexcellon = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), '%s...\t%s' % (_('Open Excellon'), _('Ctrl+E')), self) self.menufile_open.addAction(self.menufileopenexcellon) # Open G-Code ... - self.menufileopengcode = QtWidgets.QAction( + self.menufileopengcode = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/code.png'), '%s...\t%s' % (_('Open G-Code'), ''), self) self.menufile_open.addAction(self.menufileopengcode) self.menufile_open.addSeparator() # Open Config File... - self.menufileopenconfig = QtWidgets.QAction( + self.menufileopenconfig = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/folder16.png'), '%s...\t%s' % (_('Open Config'), ''), self) self.menufile_open.addAction(self.menufileopenconfig) @@ -162,18 +162,18 @@ class MainGUI(QtWidgets.QMainWindow): self.menufile_save = self.menufile.addMenu(QtGui.QIcon(self.app.resource_location + '/save_as.png'), _('Save')) # Save Project - self.menufilesaveproject = QtWidgets.QAction( + self.menufilesaveproject = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/floppy16.png'), '%s...\t%s' % (_('Save Project'), _('Ctrl+S')), self) self.menufile_save.addAction(self.menufilesaveproject) # Save Project As ... - self.menufilesaveprojectas = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/floppy16.png'), + self.menufilesaveprojectas = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/floppy16.png'), '%s...\t%s' % (_('Save Project As'), _('Ctrl+Shift+S')), self) self.menufile_save.addAction(self.menufilesaveprojectas) # Save Project Copy ... - # self.menufilesaveprojectcopy = QtWidgets.QAction( + # self.menufilesaveprojectcopy = QtGui.QAction( # QtGui.QIcon(self.app.resource_location + '/floppy16.png'), _('Save Project Copy ...'), self) # self.menufile_save.addAction(self.menufilesaveprojectcopy) @@ -187,14 +187,14 @@ class MainGUI(QtWidgets.QMainWindow): QtGui.QIcon(self.app.resource_location + '/script16.png'), _('Scripting')) self.menufile_scripting.setToolTipsVisible(True) - self.menufilenewscript = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/script_new16.png'), + self.menufilenewscript = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/script_new16.png'), '%s...\t%s' % (_('New Script'), ''), self) - self.menufileopenscript = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/open_script32.png'), + self.menufileopenscript = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/open_script32.png'), '%s...\t%s' % (_('Open Script'), ''), self) - self.menufileopenscriptexample = QtWidgets.QAction( + self.menufileopenscriptexample = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/open_script32.png'), '%s...\t%s' % (_('Open Example'), ''), self) - self.menufilerunscript = QtWidgets.QAction( + self.menufilerunscript = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/script16.png'), '%s...\t%s' % (_('Run Script'), _('Shift+S')), self) self.menufilerunscript.setToolTip( @@ -214,26 +214,26 @@ class MainGUI(QtWidgets.QMainWindow): # Import ... self.menufileimport = self.menufile.addMenu( QtGui.QIcon(self.app.resource_location + '/import.png'), _('Import')) - self.menufileimportsvg = QtWidgets.QAction( + self.menufileimportsvg = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/svg16.png'), '%s...\t%s' % (_('SVG as Geometry Object'), ''), self) self.menufileimport.addAction(self.menufileimportsvg) - self.menufileimportsvg_as_gerber = QtWidgets.QAction( + self.menufileimportsvg_as_gerber = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/svg16.png'), '%s...\t%s' % (_('SVG as Gerber Object'), ''), self) self.menufileimport.addAction(self.menufileimportsvg_as_gerber) self.menufileimport.addSeparator() - self.menufileimportdxf = QtWidgets.QAction( + self.menufileimportdxf = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/dxf16.png'), '%s...\t%s' % (_('DXF as Geometry Object'), ''), self) self.menufileimport.addAction(self.menufileimportdxf) - self.menufileimportdxf_as_gerber = QtWidgets.QAction( + self.menufileimportdxf_as_gerber = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/dxf16.png'), '%s...\t%s' % (_('DXF as Gerber Object'), ''), self) self.menufileimport.addAction(self.menufileimportdxf_as_gerber) self.menufileimport.addSeparator() - self.menufileimport_hpgl2_as_geo = QtWidgets.QAction( + self.menufileimport_hpgl2_as_geo = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/dxf16.png'), '%s...\t%s' % (_('HPGL2 as Geometry Object'), ''), self) self.menufileimport.addAction(self.menufileimport_hpgl2_as_geo) @@ -244,19 +244,19 @@ class MainGUI(QtWidgets.QMainWindow): QtGui.QIcon(self.app.resource_location + '/export.png'), _('Export')) self.menufileexport.setToolTipsVisible(True) - self.menufileexportsvg = QtWidgets.QAction( + self.menufileexportsvg = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/export.png'), '%s...\t%s' % (_('Export SVG'), ''), self) self.menufileexport.addAction(self.menufileexportsvg) - self.menufileexportdxf = QtWidgets.QAction( + self.menufileexportdxf = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/export.png'), '%s...\t%s' % (_('Export DXF'), ''), self) self.menufileexport.addAction(self.menufileexportdxf) self.menufileexport.addSeparator() - self.menufileexportpng = QtWidgets.QAction( + self.menufileexportpng = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/export_png32.png'), '%s...\t%s' % (_('Export PNG'), ''), self) self.menufileexportpng.setToolTip( @@ -268,7 +268,7 @@ class MainGUI(QtWidgets.QMainWindow): self.menufileexport.addSeparator() - self.menufileexportexcellon = QtWidgets.QAction( + self.menufileexportexcellon = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/drill32.png'), '%s...\t%s' % (_('Export Excellon'), ''), self) self.menufileexportexcellon.setToolTip( @@ -278,7 +278,7 @@ class MainGUI(QtWidgets.QMainWindow): ) self.menufileexport.addAction(self.menufileexportexcellon) - self.menufileexportgerber = QtWidgets.QAction( + self.menufileexportgerber = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/flatcam_icon32.png'), '%s...\t%s' % (_('Export Gerber'), ''), self) self.menufileexportgerber.setToolTip( @@ -295,14 +295,14 @@ class MainGUI(QtWidgets.QMainWindow): QtGui.QIcon(self.app.resource_location + '/backup24.png'), _('Backup')) # Import Preferences - self.menufileimportpref = QtWidgets.QAction( + self.menufileimportpref = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/backup_import24.png'), '%s...\t%s' % (_('Import Preferences from file'), ''), self ) self.menufile_backup.addAction(self.menufileimportpref) # Export Preferences - self.menufileexportpref = QtWidgets.QAction( + self.menufileexportpref = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/backup_export24.png'), '%s...\t%s' % (_('Export Preferences to file'), ''), self) self.menufile_backup.addAction(self.menufileexportpref) @@ -311,14 +311,14 @@ class MainGUI(QtWidgets.QMainWindow): self.menufile_backup.addSeparator() # Save Defaults - self.menufilesavedefaults = QtWidgets.QAction( + self.menufilesavedefaults = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/defaults.png'), '%s\t%s' % (_('Save Preferences'), ''), self) self.menufile_backup.addAction(self.menufilesavedefaults) # Separator self.menufile.addSeparator() - self.menufile_print = QtWidgets.QAction( + self.menufile_print = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/printer32.png'), '%s\t%s' % (_('Print (PDF)'), _('Ctrl+P'))) self.menufile.addAction(self.menufile_print) @@ -327,7 +327,7 @@ class MainGUI(QtWidgets.QMainWindow): self.menufile.addSeparator() # Quit - self.menufile_exit = QtWidgets.QAction( + self.menufile_exit = QtGui.QAction( QtGui.QIcon(self.app.resource_location + '/power16.png'), '%s\t%s' % (_('Exit'), ''), self) # exitAction.setShortcut('Ctrl+Q') @@ -912,7 +912,7 @@ class MainGUI(QtWidgets.QMainWindow): self.splitter.addWidget(self.notebook) - self.splitter_left = QtWidgets.QSplitter(Qt.Vertical) + self.splitter_left = QtWidgets.QSplitter(Qt.Orientation.Vertical) self.splitter.addWidget(self.splitter_left) self.splitter_left.addWidget(self.notebook) self.splitter_left.setHandleWidth(0) @@ -1382,11 +1382,11 @@ class MainGUI(QtWidgets.QMainWindow): # ####################################################################### self.shell_dock = FCDock(_("TCL Shell"), close_callback=self.toggle_shell_ui) self.shell_dock.setObjectName('Shell_DockWidget') - self.shell_dock.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas) - self.shell_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | - QtWidgets.QDockWidget.DockWidgetFloatable | - QtWidgets.QDockWidget.DockWidgetClosable) - self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.shell_dock) + self.shell_dock.setAllowedAreas(QtCore.Qt.DockWidgetArea.AllDockWidgetAreas) + self.shell_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetMovable | + QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetFloatable | + QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetClosable) + self.addDockWidget(QtCore.Qt.DockWidgetArea.BottomDockWidgetArea, self.shell_dock) # ######################################################################## # ########################## Notebook # ################################## @@ -1443,7 +1443,7 @@ class MainGUI(QtWidgets.QMainWindow): # ########################## RIGHT Widget # ############################## # ######################################################################## self.right_widget = QtWidgets.QWidget() - self.right_widget.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored) + self.right_widget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Ignored) self.splitter.addWidget(self.right_widget) self.right_lay = QtWidgets.QVBoxLayout() @@ -1579,11 +1579,12 @@ class MainGUI(QtWidgets.QMainWindow): self.fa_tab_lay.addWidget(self.fa_scroll_area) self.pref_tab_bottom_layout = QtWidgets.QHBoxLayout() - self.pref_tab_bottom_layout.setAlignment(QtCore.Qt.AlignVCenter) + self.pref_tab_bottom_layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignVCenter) self.pref_tab_layout.addLayout(self.pref_tab_bottom_layout) self.pref_tab_bottom_layout_1 = QtWidgets.QHBoxLayout() - self.pref_tab_bottom_layout_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.pref_tab_bottom_layout_1.setAlignment( + QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_1) self.pref_defaults_button = FCButton(_("Restore Defaults")) @@ -1615,7 +1616,7 @@ class MainGUI(QtWidgets.QMainWindow): self.pref_tab_bottom_layout_1.addWidget(self.clear_btn) self.pref_tab_bottom_layout_2 = QtWidgets.QHBoxLayout() - self.pref_tab_bottom_layout_2.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.pref_tab_bottom_layout_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_2) self.pref_apply_button = FCButton() @@ -1909,7 +1910,7 @@ class MainGUI(QtWidgets.QMainWindow): log.debug("MainGUI.__init__() --> UI layout restored from defaults. QSettings set to 'standard'") # construct the Toolbar Lock menu entry to the context menu of the QMainWindow - self.lock_action = QtWidgets.QAction() + self.lock_action = QtGui.QAction() self.lock_action.setText(_("Lock Toolbars")) self.lock_action.setCheckable(True) @@ -1969,14 +1970,14 @@ class MainGUI(QtWidgets.QMainWindow): # Notebook and Plot Tab Area signals # make the right click on the notebook tab and plot tab area tab raise a menu - self.notebook.tabBar.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) - self.plot_tab_area.tabBar.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) + self.notebook.tabBar.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.ActionsContextMenu) + self.plot_tab_area.tabBar.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.ActionsContextMenu) self.on_tab_setup_context_menu() # activate initial state self.on_detachable_tab_rmb_click(self.app.defaults["global_tabs_detachable"]) # status bar activation/deactivation - self.infobar.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) + self.infobar.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.ActionsContextMenu) self.build_infobar_context_menu() def set_ui_title(self, name): @@ -2079,7 +2080,7 @@ class MainGUI(QtWidgets.QMainWindow): def on_tab_setup_context_menu(self): initial_checked = self.app.defaults["global_tabs_detachable"] action_name = str(_("Detachable Tabs")) - action = QtWidgets.QAction(self) + action = QtGui.QAction(self) action.setCheckable(True) action.setText(action_name) action.setChecked(initial_checked) @@ -2102,7 +2103,7 @@ class MainGUI(QtWidgets.QMainWindow): def build_infobar_context_menu(self): delta_coords_action_name = str(_("Delta Coordinates Toolbar")) - delta_coords_action = QtWidgets.QAction(self) + delta_coords_action = QtGui.QAction(self) delta_coords_action.setCheckable(True) delta_coords_action.setText(delta_coords_action_name) delta_coords_action.setChecked(self.app.defaults["global_delta_coordsbar_show"]) @@ -2110,7 +2111,7 @@ class MainGUI(QtWidgets.QMainWindow): delta_coords_action.triggered.connect(self.toggle_delta_coords) coords_action_name = str(_("Coordinates Toolbar")) - coords_action = QtWidgets.QAction(self) + coords_action = QtGui.QAction(self) coords_action.setCheckable(True) coords_action.setText(coords_action_name) coords_action.setChecked(self.app.defaults["global_coordsbar_show"]) @@ -2118,7 +2119,7 @@ class MainGUI(QtWidgets.QMainWindow): coords_action.triggered.connect(self.toggle_coords) grid_action_name = str(_("Grid Toolbar")) - grid_action = QtWidgets.QAction(self) + grid_action = QtGui.QAction(self) grid_action.setCheckable(True) grid_action.setText(grid_action_name) grid_action.setChecked(self.app.defaults["global_gridbar_show"]) @@ -2126,7 +2127,7 @@ class MainGUI(QtWidgets.QMainWindow): grid_action.triggered.connect(self.toggle_gridbar) status_action_name = str(_("Status Toolbar")) - status_action = QtWidgets.QAction(self) + status_action = QtGui.QAction(self) status_action.setCheckable(True) status_action.setText(status_action_name) status_action.setChecked(self.app.defaults["global_statusbar_show"]) @@ -2559,13 +2560,13 @@ class MainGUI(QtWidgets.QMainWindow): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - modifiers = QtCore.Qt.ControlModifier + modifiers = QtCore.Qt.KeyboardModifier.ControlModifier elif mod.lower() == 'alt': - modifiers = QtCore.Qt.AltModifier + modifiers = QtCore.Qt.KeyboardModifier.AltModifier elif mod.lower() == 'shift': - modifiers = QtCore.Qt.ShiftModifier + modifiers = QtCore.Qt.KeyboardModifier.ShiftModifier else: - modifiers = QtCore.Qt.NoModifier + modifiers = QtCore.Qt.KeyboardModifier.NoModifier key = QtGui.QKeySequence(key_text) # events from Vispy are of type KeyEvent @@ -2574,23 +2575,23 @@ class MainGUI(QtWidgets.QMainWindow): if self.app.call_source == 'app': # CTRL + ALT - if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier: - if key == QtCore.Qt.Key_X: + if modifiers == QtCore.Qt.KeyboardModifierControlModifier | QtCore.Qt.KeyboardModifier.AltModifier: + if key == QtCore.Qt.Key.Key_X: self.app.abort_all_tasks() return # CTRL + SHIFT - if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier: - if key == QtCore.Qt.Key_S: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier | QtCore.Qt.KeyboardModifier.ShiftModifier: + if key == QtCore.Qt.Key.Key_S: self.app.f_handlers.on_file_saveprojectas() return # CTRL - elif modifiers == QtCore.Qt.ControlModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: # Select All - if key == QtCore.Qt.Key_A: + if key == QtCore.Qt.Key.Key_A: self.app.on_selectall() # Copy an FlatCAM object - if key == QtCore.Qt.Key_C: + if key == QtCore.Qt.Key.Key_C: widget_name = self.plot_tab_area.currentWidget().objectName() if widget_name == 'database_tab': # Tools DB saved, update flag @@ -2601,15 +2602,15 @@ class MainGUI(QtWidgets.QMainWindow): self.app.on_copy_command() # Copy an FlatCAM object - if key == QtCore.Qt.Key_D: + if key == QtCore.Qt.Key.Key_D: self.app.on_tools_database() # Open Excellon file - if key == QtCore.Qt.Key_E: + if key == QtCore.Qt.Key.Key_E: self.app.f_handlers.on_fileopenexcellon(signal=None) # Open Gerber file - if key == QtCore.Qt.Key_G: + if key == QtCore.Qt.Key.Key_G: widget_name = self.plot_tab_area.currentWidget().objectName() if 'editor' in widget_name.lower(): self.app.goto_text_line() @@ -2617,27 +2618,27 @@ class MainGUI(QtWidgets.QMainWindow): self.app.f_handlers.on_fileopengerber(signal=None) # Distance Tool - if key == QtCore.Qt.Key_M: + if key == QtCore.Qt.Key.Key_M: self.app.distance_tool.run() # Create New Project - if key == QtCore.Qt.Key_N: + if key == QtCore.Qt.Key.Key_N: self.app.f_handlers.on_file_new_click() # Open Project - if key == QtCore.Qt.Key_O: + if key == QtCore.Qt.Key.Key_O: self.app.f_handlers.on_file_openproject(signal=None) # Open Project - if key == QtCore.Qt.Key_P: + if key == QtCore.Qt.Key.Key_P: self.app.f_handlers.on_file_save_objects_pdf(use_thread=True) # PDF Import - if key == QtCore.Qt.Key_Q: + if key == QtCore.Qt.Key.Key_Q: self.app.pdf_tool.run() # Save Project - if key == QtCore.Qt.Key_S: + if key == QtCore.Qt.Key.Key_S: widget_name = self.plot_tab_area.currentWidget().objectName() if widget_name == 'preferences_tab': self.app.preferencesUiManager.on_save_button(save_to_file=False) @@ -2652,242 +2653,242 @@ class MainGUI(QtWidgets.QMainWindow): self.app.f_handlers.on_file_saveproject() # Toggle Plot Area - if key == QtCore.Qt.Key_F10 or key == 'F10': + if key == QtCore.Qt.Key.Key_F10 or key == 'F10': self.on_toggle_plotarea() return # SHIFT - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: # Toggle axis - if key == QtCore.Qt.Key_A: + if key == QtCore.Qt.Key.Key_A: self.app.plotcanvas.on_toggle_axis() # Copy Object Name - if key == QtCore.Qt.Key_C: + if key == QtCore.Qt.Key.Key_C: self.app.on_copy_name() # Toggle Code Editor - if key == QtCore.Qt.Key_E: + if key == QtCore.Qt.Key.Key_E: self.app.on_toggle_code_editor() # Toggle Grid lines - if key == QtCore.Qt.Key_G: + if key == QtCore.Qt.Key.Key_G: self.app.plotcanvas.on_toggle_grid_lines() return # Toggle HUD (Heads-Up Display) - if key == QtCore.Qt.Key_H: + if key == QtCore.Qt.Key.Key_H: self.app.plotcanvas.on_toggle_hud() # Locate in Object - if key == QtCore.Qt.Key_J: + if key == QtCore.Qt.Key.Key_J: self.app.on_locate(obj=self.app.collection.get_active()) # Run Distance Minimum Tool - if key == QtCore.Qt.Key_M: + if key == QtCore.Qt.Key.Key_M: self.app.distance_min_tool.run() return # Open Preferences Window - if key == QtCore.Qt.Key_P: + if key == QtCore.Qt.Key.Key_P: self.app.on_preferences() return # Rotate Object by 90 degree CCW - if key == QtCore.Qt.Key_R: + if key == QtCore.Qt.Key.Key_R: self.app.on_rotate(silent=True, preset=-float(self.app.defaults['tools_transform_rotate'])) return # Run a Script - if key == QtCore.Qt.Key_S: + if key == QtCore.Qt.Key.Key_S: self.app.f_handlers.on_filerunscript() return # Toggle Workspace - if key == QtCore.Qt.Key_W: + if key == QtCore.Qt.Key.Key_W: self.app.on_workspace_toggle() return # Skew on X axis - if key == QtCore.Qt.Key_X: + if key == QtCore.Qt.Key.Key_X: self.app.on_skewx() return # Skew on Y axis - if key == QtCore.Qt.Key_Y: + if key == QtCore.Qt.Key.Key_Y: self.app.on_skewy() return # ALT - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: # Eanble all plots - if key == Qt.Key_1: + if key == Qt.Key.Key_1: self.app.enable_all_plots() # Disable all plots - if key == Qt.Key_2: + if key == Qt.Key.Key_2: self.app.disable_all_plots() # Disable all other plots - if key == Qt.Key_3: + if key == Qt.Key.Key_3: self.app.enable_other_plots() # Disable all other plots - if key == Qt.Key_4: + if key == Qt.Key.Key_4: self.app.disable_other_plots() # Align in Object Tool - if key == QtCore.Qt.Key_A: + if key == QtCore.Qt.Key.Key_A: self.app.align_objects_tool.run(toggle=True) # Corner Markers Tool - if key == QtCore.Qt.Key_B: + if key == QtCore.Qt.Key.Key_B: self.app.corners_tool.run(toggle=True) return # Calculator Tool - if key == QtCore.Qt.Key_C: + if key == QtCore.Qt.Key.Key_C: self.app.calculator_tool.run(toggle=True) # 2-Sided PCB Tool - if key == QtCore.Qt.Key_D: + if key == QtCore.Qt.Key.Key_D: self.app.dblsidedtool.run(toggle=True) return # Extract Drills Tool - if key == QtCore.Qt.Key_E: + if key == QtCore.Qt.Key.Key_E: # self.app.cal_exc_tool.run(toggle=True) self.app.extract_tool.run(toggle=True) return # Fiducials Tool - if key == QtCore.Qt.Key_F: + if key == QtCore.Qt.Key.Key_F: self.app.fiducial_tool.run(toggle=True) return # Punch Gerber Tool - if key == QtCore.Qt.Key_G: + if key == QtCore.Qt.Key.Key_G: self.app.invert_tool.run(toggle=True) # Punch Gerber Tool - if key == QtCore.Qt.Key_H: + if key == QtCore.Qt.Key.Key_H: self.app.punch_tool.run(toggle=True) # Isolation Tool - if key == QtCore.Qt.Key_I: + if key == QtCore.Qt.Key.Key_I: self.app.isolation_tool.run(toggle=True) # Copper Thieving Tool - if key == QtCore.Qt.Key_J: + if key == QtCore.Qt.Key.Key_J: self.app.copper_thieving_tool.run(toggle=True) return # Solder Paste Dispensing Tool - if key == QtCore.Qt.Key_K: + if key == QtCore.Qt.Key.Key_K: self.app.paste_tool.run(toggle=True) return # Film Tool - if key == QtCore.Qt.Key_L: + if key == QtCore.Qt.Key.Key_L: self.app.film_tool.run(toggle=True) return # Milling Tool - if key == QtCore.Qt.Key_M: + if key == QtCore.Qt.Key.Key_M: self.app.milling_tool.run(toggle=True) return # Non-Copper Clear Tool - if key == QtCore.Qt.Key_N: + if key == QtCore.Qt.Key.Key_N: self.app.ncclear_tool.run(toggle=True) return # Optimal Tool - if key == QtCore.Qt.Key_O: + if key == QtCore.Qt.Key.Key_O: self.app.optimal_tool.run(toggle=True) return # Paint Tool - if key == QtCore.Qt.Key_P: + if key == QtCore.Qt.Key.Key_P: self.app.paint_tool.run(toggle=True) return # QRCode Tool - if key == QtCore.Qt.Key_Q: + if key == QtCore.Qt.Key.Key_Q: self.app.qrcode_tool.run() return # Rules Tool - if key == QtCore.Qt.Key_R: + if key == QtCore.Qt.Key.Key_R: self.app.rules_tool.run(toggle=True) return # View Source Object Content - if key == QtCore.Qt.Key_S: + if key == QtCore.Qt.Key.Key_S: self.app.on_view_source() return # Transformation Tool - if key == QtCore.Qt.Key_T: + if key == QtCore.Qt.Key.Key_T: self.app.transform_tool.run(toggle=True) return # Substract Tool - if key == QtCore.Qt.Key_W: + if key == QtCore.Qt.Key.Key_W: self.app.sub_tool.run(toggle=True) return # Cutout Tool - if key == QtCore.Qt.Key_X: + if key == QtCore.Qt.Key.Key_X: self.app.cutout_tool.run(toggle=True) return # Panelize Tool - if key == QtCore.Qt.Key_Z: + if key == QtCore.Qt.Key.Key_Z: self.app.panelize_tool.run(toggle=True) return # Toggle Fullscreen - if key == QtCore.Qt.Key_F10 or key == 'F10': + if key == QtCore.Qt.Key.Key_F10 or key == 'F10': self.on_fullscreen() return # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: # Open Manual - if key == QtCore.Qt.Key_F1 or key == 'F1': + if key == QtCore.Qt.Key.Key_F1 or key == 'F1': webbrowser.open(self.app.manual_url) # Rename Objects in the Project Tab - if key == QtCore.Qt.Key_F2: + if key == QtCore.Qt.Key.Key_F2: self.app.collection.view.edit(self.app.collection.view.currentIndex()) # Show shortcut list - if key == QtCore.Qt.Key_F3 or key == 'F3': + if key == QtCore.Qt.Key.Key_F3 or key == 'F3': self.on_shortcut_list() # Open Video Help - if key == QtCore.Qt.Key_F4 or key == 'F4': + if key == QtCore.Qt.Key.Key_F4 or key == 'F4': webbrowser.open(self.app.video_url) # Open Video Help - if key == QtCore.Qt.Key_F5 or key == 'F5': + if key == QtCore.Qt.Key.Key_F5 or key == 'F5': self.app.plot_all() # Switch to Project Tab - if key == QtCore.Qt.Key_1: + if key == QtCore.Qt.Key.Key_1: self.on_select_tab('project') # Switch to Selected Tab - if key == QtCore.Qt.Key_2: + if key == QtCore.Qt.Key.Key_2: self.on_select_tab('properties') # Switch to Tool Tab - if key == QtCore.Qt.Key_3: + if key == QtCore.Qt.Key.Key_3: self.on_select_tab('tool') # Delete from PyQt # It's meant to make a difference between delete objects and delete tools in # Geometry Selected tool table - if key == QtCore.Qt.Key_Delete and matplotlib_key_flag is False: + if key == QtCore.Qt.Key.Key_Delete and matplotlib_key_flag is False: widget_name = self.plot_tab_area.currentWidget().objectName() if widget_name == 'database_tab': # Tools DB saved, update flag @@ -2905,7 +2906,7 @@ class MainGUI(QtWidgets.QMainWindow): active.app.on_delete() # Escape = Deselect All - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': self.app.on_deselect_all() # if in full screen, exit to normal view @@ -2920,7 +2921,7 @@ class MainGUI(QtWidgets.QMainWindow): self.app.inform.emit("") # Space = Toggle Active/Inactive - if key == QtCore.Qt.Key_Space: + if key == QtCore.Qt.Key.Key_Space: for select in selected: select.ui.plot_cb.toggle() QtWidgets.QApplication.processEvents() @@ -2928,7 +2929,7 @@ class MainGUI(QtWidgets.QMainWindow): self.app.delete_selection_shape() # Select the object in the Tree above the current one - if key == QtCore.Qt.Key_Up: + if key == QtCore.Qt.Key.Key_Up: # make sure it works only for the Project Tab who is an instance of KeySensitiveListView focused_wdg = QtWidgets.QApplication.focusWidget() if isinstance(focused_wdg, KeySensitiveListView): @@ -2943,7 +2944,7 @@ class MainGUI(QtWidgets.QMainWindow): self.app.collection.set_active(names_list[active_index - 1]) # Select the object in the Tree below the current one - if key == QtCore.Qt.Key_Down: + if key == QtCore.Qt.Key.Key_Down: # make sure it works only for the Project Tab who is an instance of KeySensitiveListView focused_wdg = QtWidgets.QApplication.focusWidget() if isinstance(focused_wdg, KeySensitiveListView): @@ -2958,49 +2959,49 @@ class MainGUI(QtWidgets.QMainWindow): self.app.collection.set_active(names_list[active_index + 1]) # New Geometry - if key == QtCore.Qt.Key_B: + if key == QtCore.Qt.Key.Key_B: self.app.app_obj.new_gerber_object() # New Document Object - if key == QtCore.Qt.Key_D: + if key == QtCore.Qt.Key.Key_D: self.app.app_obj.new_document_object() # Copy Object Name - if key == QtCore.Qt.Key_E: + if key == QtCore.Qt.Key.Key_E: self.app.object2editor() # Grid toggle - if key == QtCore.Qt.Key_G: + if key == QtCore.Qt.Key.Key_G: self.app.ui.grid_snap_btn.trigger() # Jump to coords - if key == QtCore.Qt.Key_J: + if key == QtCore.Qt.Key.Key_J: self.app.on_jump_to() # New Excellon - if key == QtCore.Qt.Key_L: + if key == QtCore.Qt.Key.Key_L: self.app.app_obj.new_excellon_object() # Move tool toggle - if key == QtCore.Qt.Key_M: + if key == QtCore.Qt.Key.Key_M: self.app.move_tool.toggle() # New Geometry - if key == QtCore.Qt.Key_N: + if key == QtCore.Qt.Key.Key_N: self.app.app_obj.new_geometry_object() # Set Origin - if key == QtCore.Qt.Key_O: + if key == QtCore.Qt.Key.Key_O: self.app.on_set_origin() return # Properties Tool - if key == QtCore.Qt.Key_P: + if key == QtCore.Qt.Key.Key_P: self.app.report_tool.run(toggle=True) return # Change Units - if key == QtCore.Qt.Key_Q: + if key == QtCore.Qt.Key.Key_Q: # if self.app.defaults["units"] == 'MM': # self.app.ui.general_pref_form.general_app_group.units_radio.set_value("IN") # else: @@ -3009,15 +3010,15 @@ class MainGUI(QtWidgets.QMainWindow): self.app.on_toggle_units_click() # Rotate Object by 90 degree CW - if key == QtCore.Qt.Key_R: + if key == QtCore.Qt.Key.Key_R: self.app.on_rotate(silent=True, preset=self.app.defaults['tools_transform_rotate']) # Shell toggle - if key == QtCore.Qt.Key_S: + if key == QtCore.Qt.Key.Key_S: self.toggle_shell_ui() # Add a Tool from shortcut - if key == QtCore.Qt.Key_T: + if key == QtCore.Qt.Key.Key_T: widget_name = self.plot_tab_area.currentWidget().objectName() if widget_name == 'database_tab': # Tools DB saved, update flag @@ -3028,45 +3029,45 @@ class MainGUI(QtWidgets.QMainWindow): self.app.on_tool_add_keypress() # Zoom Fit - if key == QtCore.Qt.Key_V: + if key == QtCore.Qt.Key.Key_V: self.app.on_zoom_fit() # Mirror on X the selected object(s) - if key == QtCore.Qt.Key_X: + if key == QtCore.Qt.Key.Key_X: self.app.on_flipx() # Mirror on Y the selected object(s) - if key == QtCore.Qt.Key_Y: + if key == QtCore.Qt.Key.Key_Y: self.app.on_flipy() # Zoom In - if key == QtCore.Qt.Key_Equal: + if key == QtCore.Qt.Key.Key_Equal: self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'], self.app.mouse) # Zoom Out - if key == QtCore.Qt.Key_Minus: + if key == QtCore.Qt.Key.Key_Minus: self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'], self.app.mouse) # toggle display of Notebook area - if key == QtCore.Qt.Key_QuoteLeft: + if key == QtCore.Qt.Key.Key_QuoteLeft: self.on_toggle_notebook() return elif self.app.call_source == 'geo_editor': # CTRL - if modifiers == QtCore.Qt.ControlModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: # save (update) the current geometry and return to the App - if key == QtCore.Qt.Key_S or key == 'S': + if key == QtCore.Qt.Key.Key_S or key == 'S': self.app.editor2object() return # toggle the measurement tool - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.distance_tool.run() return # Cut Action Tool - if key == QtCore.Qt.Key_X or key == 'X': + if key == QtCore.Qt.Key.Key_X or key == 'X': if self.app.geo_editor.get_selected() is not None: self.app.geo_editor.cutpath() else: @@ -3086,47 +3087,47 @@ class MainGUI(QtWidgets.QMainWindow): messagebox.exec() return # SHIFT - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: # Run Distance Minimum Tool - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.distance_min_tool.run() return # Skew on X axis - if key == QtCore.Qt.Key_X or key == 'X': + if key == QtCore.Qt.Key.Key_X or key == 'X': self.app.geo_editor.transform_tool.on_skewx_key() return # Skew on Y axis - if key == QtCore.Qt.Key_Y or key == 'Y': + if key == QtCore.Qt.Key.Key_Y or key == 'Y': self.app.geo_editor.transform_tool.on_skewy_key() return # ALT - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: # Transformation Tool - if key == QtCore.Qt.Key_R or key == 'R': + if key == QtCore.Qt.Key.Key_R or key == 'R': self.app.geo_editor.select_tool('transform') return # Offset on X axis - if key == QtCore.Qt.Key_X or key == 'X': + if key == QtCore.Qt.Key.Key_X or key == 'X': self.app.geo_editor.transform_tool.on_offx_key() return # Offset on Y axis - if key == QtCore.Qt.Key_Y or key == 'Y': + if key == QtCore.Qt.Key.Key_Y or key == 'Y': self.app.geo_editor.transform_tool.on_offy_key() return # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: # toggle display of Notebook area - if key == QtCore.Qt.Key_QuoteLeft or key == '`': + if key == QtCore.Qt.Key.Key_QuoteLeft or key == '`': self.on_toggle_notebook() # Finish the current action. Use with tools that do not # complete automatically, like a polygon or path. - if key == QtCore.Qt.Key_Enter or key == 'Enter': + if key == QtCore.Qt.Key.Key_Enter or key == 'Enter': if isinstance(self.app.geo_editor.active_tool, FCShapeTool): if self.app.geo_editor.active_tool.name == 'rotate': self.app.geo_editor.active_tool.make() @@ -3150,7 +3151,7 @@ class MainGUI(QtWidgets.QMainWindow): self.app.geo_editor.select_tool('select') # Abort the current action - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': # self.on_tool_select("select") self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled.")) @@ -3161,38 +3162,38 @@ class MainGUI(QtWidgets.QMainWindow): return # Delete selected object - if key == QtCore.Qt.Key_Delete or key == 'Delete': + if key == QtCore.Qt.Key.Key_Delete or key == 'Delete': self.app.geo_editor.delete_selected() self.app.geo_editor.plot_all() # Rotate - if key == QtCore.Qt.Key_Space or key == 'Space': + if key == QtCore.Qt.Key.Key_Space or key == 'Space': self.app.geo_editor.transform_tool.on_rotate_key() # Zoom Out - if key == QtCore.Qt.Key_Minus or key == '-': + if key == QtCore.Qt.Key.Key_Minus or key == '-': self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'], [self.app.geo_editor.snap_x, self.app.geo_editor.snap_y]) # Zoom In - if key == QtCore.Qt.Key_Equal or key == '=': + if key == QtCore.Qt.Key.Key_Equal or key == '=': self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'], [self.app.geo_editor.snap_x, self.app.geo_editor.snap_y]) # Switch to Project Tab - if key == QtCore.Qt.Key_1 or key == '1': + if key == QtCore.Qt.Key.Key_1 or key == '1': self.on_select_tab('project') # Switch to Selected Tab - if key == QtCore.Qt.Key_2 or key == '2': + if key == QtCore.Qt.Key.Key_2 or key == '2': self.on_select_tab('selected') # Switch to Tool Tab - if key == QtCore.Qt.Key_3 or key == '3': + if key == QtCore.Qt.Key.Key_3 or key == '3': self.on_select_tab('tool') # Grid Snap - if key == QtCore.Qt.Key_G or key == 'G': + if key == QtCore.Qt.Key.Key_G or key == 'G': self.app.ui.grid_snap_btn.trigger() # make sure that the cursor shape is enabled/disabled, too @@ -3202,10 +3203,10 @@ class MainGUI(QtWidgets.QMainWindow): self.app.app_cursor.enabled = False # Corner Snap - if key == QtCore.Qt.Key_K or key == 'K': + if key == QtCore.Qt.Key.Key_K or key == 'K': self.app.geo_editor.on_corner_snap() - if key == QtCore.Qt.Key_V or key == 'V': + if key == QtCore.Qt.Key.Key_V or key == 'V': self.app.on_zoom_fit() # we do this so we can reuse the following keys while inside a Tool @@ -3216,19 +3217,19 @@ class MainGUI(QtWidgets.QMainWindow): self.app.inform.emit(response) else: # Arc Tool - if key == QtCore.Qt.Key_A or key == 'A': + if key == QtCore.Qt.Key.Key_A or key == 'A': self.app.geo_editor.select_tool('arc') # Buffer - if key == QtCore.Qt.Key_B or key == 'B': + if key == QtCore.Qt.Key.Key_B or key == 'B': self.app.geo_editor.select_tool('buffer') # Copy - if key == QtCore.Qt.Key_C or key == 'C': + if key == QtCore.Qt.Key.Key_C or key == 'C': self.app.geo_editor.on_copy_click() # Substract Tool - if key == QtCore.Qt.Key_E or key == 'E': + if key == QtCore.Qt.Key.Key_E or key == 'E': if self.app.geo_editor.get_selected() is not None: self.app.geo_editor.intersection() else: @@ -3246,35 +3247,35 @@ class MainGUI(QtWidgets.QMainWindow): messagebox.exec() # Paint - if key == QtCore.Qt.Key_I or key == 'I': + if key == QtCore.Qt.Key.Key_I or key == 'I': self.app.geo_editor.select_tool('paint') # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.app.on_jump_to() # Move - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.geo_editor.on_move_click() # Polygon Tool - if key == QtCore.Qt.Key_N or key == 'N': + if key == QtCore.Qt.Key.Key_N or key == 'N': self.app.geo_editor.select_tool('polygon') # Circle Tool - if key == QtCore.Qt.Key_O or key == 'O': + if key == QtCore.Qt.Key.Key_O or key == 'O': self.app.geo_editor.select_tool('circle') # Path Tool - if key == QtCore.Qt.Key_P or key == 'P': + if key == QtCore.Qt.Key.Key_P or key == 'P': self.app.geo_editor.select_tool('path') # Rectangle Tool - if key == QtCore.Qt.Key_R or key == 'R': + if key == QtCore.Qt.Key.Key_R or key == 'R': self.app.geo_editor.select_tool('rectangle') # Substract Tool - if key == QtCore.Qt.Key_S or key == 'S': + if key == QtCore.Qt.Key.Key_S or key == 'S': if self.app.geo_editor.get_selected() is not None: self.app.geo_editor.subtract() else: @@ -3293,11 +3294,11 @@ class MainGUI(QtWidgets.QMainWindow): messagebox.exec() # Add Text Tool - if key == QtCore.Qt.Key_T or key == 'T': + if key == QtCore.Qt.Key.Key_T or key == 'T': self.app.geo_editor.select_tool('text') # Substract Tool - if key == QtCore.Qt.Key_U or key == 'U': + if key == QtCore.Qt.Key.Key_U or key == 'U': if self.app.geo_editor.get_selected() is not None: self.app.geo_editor.union() else: @@ -3315,12 +3316,12 @@ class MainGUI(QtWidgets.QMainWindow): messagebox.exec() # Flip on X axis - if key == QtCore.Qt.Key_X or key == 'X': + if key == QtCore.Qt.Key.Key_X or key == 'X': self.app.geo_editor.transform_tool.on_flipx() return # Flip on Y axis - if key == QtCore.Qt.Key_Y or key == 'Y': + if key == QtCore.Qt.Key.Key_Y or key == 'Y': self.app.geo_editor.transform_tool.on_flipy() return @@ -3329,46 +3330,46 @@ class MainGUI(QtWidgets.QMainWindow): self.on_shortcut_list() elif self.app.call_source == 'grb_editor': # CTRL - if modifiers == QtCore.Qt.ControlModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: # Eraser Tool - if key == QtCore.Qt.Key_E or key == 'E': + if key == QtCore.Qt.Key.Key_E or key == 'E': self.app.grb_editor.on_eraser() return # save (update) the current geometry and return to the App - if key == QtCore.Qt.Key_S or key == 'S': + if key == QtCore.Qt.Key.Key_S or key == 'S': self.app.editor2object() return # toggle the measurement tool - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.distance_tool.run() return # SHIFT - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: # Run Distance Minimum Tool - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.distance_min_tool.run() return # ALT - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: # Mark Area Tool - if key == QtCore.Qt.Key_A or key == 'A': + if key == QtCore.Qt.Key.Key_A or key == 'A': self.app.grb_editor.on_markarea() return # Poligonize Tool - if key == QtCore.Qt.Key_N or key == 'N': + if key == QtCore.Qt.Key.Key_N or key == 'N': self.app.grb_editor.on_poligonize() return # Transformation Tool - if key == QtCore.Qt.Key_R or key == 'R': + if key == QtCore.Qt.Key.Key_R or key == 'R': self.app.grb_editor.on_transform() return # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: # Abort the current action - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': # self.on_tool_select("select") self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled.")) @@ -3390,43 +3391,43 @@ class MainGUI(QtWidgets.QMainWindow): return # Delete aperture in apertures table if delete key event comes from the Selected Tab - if key == QtCore.Qt.Key_Delete: + if key == QtCore.Qt.Key.Key_Delete: self.app.grb_editor.launched_from_shortcuts = True self.app.grb_editor.on_aperture_delete() return - if key == QtCore.Qt.Key_Minus or key == '-': + if key == QtCore.Qt.Key.Key_Minus or key == '-': self.app.grb_editor.launched_from_shortcuts = True self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'], [self.app.grb_editor.snap_x, self.app.grb_editor.snap_y]) return - if key == QtCore.Qt.Key_Equal or key == '=': + if key == QtCore.Qt.Key.Key_Equal or key == '=': self.app.grb_editor.launched_from_shortcuts = True self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'], [self.app.grb_editor.snap_x, self.app.grb_editor.snap_y]) return # toggle display of Notebook area - if key == QtCore.Qt.Key_QuoteLeft or key == '`': + if key == QtCore.Qt.Key.Key_QuoteLeft or key == '`': self.app.grb_editor.launched_from_shortcuts = True self.on_toggle_notebook() return # Switch to Project Tab - if key == QtCore.Qt.Key_1 or key == '1': + if key == QtCore.Qt.Key.Key_1 or key == '1': self.app.grb_editor.launched_from_shortcuts = True self.on_select_tab('project') return # Switch to Selected Tab - if key == QtCore.Qt.Key_2 or key == '2': + if key == QtCore.Qt.Key.Key_2 or key == '2': self.app.grb_editor.launched_from_shortcuts = True self.on_select_tab('selected') return # Switch to Tool Tab - if key == QtCore.Qt.Key_3 or key == '3': + if key == QtCore.Qt.Key.Key_3 or key == '3': self.app.grb_editor.launched_from_shortcuts = True self.on_select_tab('tool') return @@ -3440,11 +3441,11 @@ class MainGUI(QtWidgets.QMainWindow): else: # Rotate - if key == QtCore.Qt.Key_Space or key == 'Space': + if key == QtCore.Qt.Key.Key_Space or key == 'Space': self.app.grb_editor.transform_tool.on_rotate_key() # Add Array of pads - if key == QtCore.Qt.Key_A or key == 'A': + if key == QtCore.Qt.Key.Key_A or key == 'A': self.app.grb_editor.launched_from_shortcuts = True self.app.inform.emit("Click on target point.") self.app.ui.add_pad_ar_btn.setChecked(True) @@ -3456,13 +3457,13 @@ class MainGUI(QtWidgets.QMainWindow): return # Scale Tool - if key == QtCore.Qt.Key_B or key == 'B': + if key == QtCore.Qt.Key.Key_B or key == 'B': self.app.grb_editor.launched_from_shortcuts = True self.app.grb_editor.select_tool('buffer') return # Copy - if key == QtCore.Qt.Key_C or key == 'C': + if key == QtCore.Qt.Key.Key_C or key == 'C': self.app.grb_editor.launched_from_shortcuts = True if self.app.grb_editor.selected: self.app.inform.emit(_("Click on target point.")) @@ -3475,19 +3476,19 @@ class MainGUI(QtWidgets.QMainWindow): return # Add Disc Tool - if key == QtCore.Qt.Key_D or key == 'D': + if key == QtCore.Qt.Key.Key_D or key == 'D': self.app.grb_editor.launched_from_shortcuts = True self.app.grb_editor.select_tool('disc') return # Add SemiDisc Tool - if key == QtCore.Qt.Key_E or key == 'E': + if key == QtCore.Qt.Key.Key_E or key == 'E': self.app.grb_editor.launched_from_shortcuts = True self.app.grb_editor.select_tool('semidisc') return # Grid Snap - if key == QtCore.Qt.Key_G or key == 'G': + if key == QtCore.Qt.Key.Key_G or key == 'G': self.app.grb_editor.launched_from_shortcuts = True # make sure that the cursor shape is enabled/disabled, too if self.app.grb_editor.options['grid_snap'] is True: @@ -3498,17 +3499,17 @@ class MainGUI(QtWidgets.QMainWindow): return # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.app.on_jump_to() # Corner Snap - if key == QtCore.Qt.Key_K or key == 'K': + if key == QtCore.Qt.Key.Key_K or key == 'K': self.app.grb_editor.launched_from_shortcuts = True self.app.ui.corner_snap_btn.trigger() return # Move - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.grb_editor.launched_from_shortcuts = True if self.app.grb_editor.selected: self.app.inform.emit(_("Click on target point.")) @@ -3521,13 +3522,13 @@ class MainGUI(QtWidgets.QMainWindow): return # Add Region Tool - if key == QtCore.Qt.Key_N or key == 'N': + if key == QtCore.Qt.Key.Key_N or key == 'N': self.app.grb_editor.launched_from_shortcuts = True self.app.grb_editor.select_tool('region') return # Add Pad Tool - if key == QtCore.Qt.Key_P or key == 'P': + if key == QtCore.Qt.Key.Key_P or key == 'P': self.app.grb_editor.launched_from_shortcuts = True self.app.inform.emit(_("Click on target point.")) self.app.ui.add_pad_ar_btn.setChecked(True) @@ -3539,38 +3540,38 @@ class MainGUI(QtWidgets.QMainWindow): return # Scale Tool - if key == QtCore.Qt.Key_S or key == 'S': + if key == QtCore.Qt.Key.Key_S or key == 'S': self.app.grb_editor.launched_from_shortcuts = True self.app.grb_editor.select_tool('scale') return # Add Track - if key == QtCore.Qt.Key_T or key == 'T': + if key == QtCore.Qt.Key.Key_T or key == 'T': self.app.grb_editor.launched_from_shortcuts = True # ## Current application units in Upper Case self.app.grb_editor.select_tool('track') return # Zoom fit - if key == QtCore.Qt.Key_V or key == 'V': + if key == QtCore.Qt.Key.Key_V or key == 'V': self.app.grb_editor.launched_from_shortcuts = True self.app.grb_editor.on_zoom_fit() return # Show Shortcut list - if key == QtCore.Qt.Key_F3 or key == 'F3': + if key == QtCore.Qt.Key.Key_F3 or key == 'F3': self.on_shortcut_list() return elif self.app.call_source == 'exc_editor': # CTRL - if modifiers == QtCore.Qt.ControlModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: # save (update) the current geometry and return to the App - if key == QtCore.Qt.Key_S or key == 'S': + if key == QtCore.Qt.Key.Key_S or key == 'S': self.app.editor2object() return # toggle the measurement tool - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.distance_tool.run() return @@ -3583,18 +3584,18 @@ class MainGUI(QtWidgets.QMainWindow): else: pass # SHIFT - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: # Run Distance Minimum Tool - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.distance_min_tool.run() return # ALT - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: pass # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: # Abort the current action - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled.")) self.app.exc_editor.delete_utility_geometry() @@ -3613,49 +3614,49 @@ class MainGUI(QtWidgets.QMainWindow): return # Delete tools in tools table if delete key event comes from the Selected Tab - if key == QtCore.Qt.Key_Delete: + if key == QtCore.Qt.Key.Key_Delete: self.app.exc_editor.launched_from_shortcuts = True self.app.exc_editor.on_tool_delete() return - if key == QtCore.Qt.Key_Minus or key == '-': + if key == QtCore.Qt.Key.Key_Minus or key == '-': self.app.exc_editor.launched_from_shortcuts = True self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'], [self.app.exc_editor.snap_x, self.app.exc_editor.snap_y]) return - if key == QtCore.Qt.Key_Equal or key == '=': + if key == QtCore.Qt.Key.Key_Equal or key == '=': self.app.exc_editor.launched_from_shortcuts = True self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'], [self.app.exc_editor.snap_x, self.app.exc_editor.snap_y]) return # toggle display of Notebook area - if key == QtCore.Qt.Key_QuoteLeft or key == '`': + if key == QtCore.Qt.Key.Key_QuoteLeft or key == '`': self.app.exc_editor.launched_from_shortcuts = True self.on_toggle_notebook() return # Switch to Project Tab - if key == QtCore.Qt.Key_1 or key == '1': + if key == QtCore.Qt.Key.Key_1 or key == '1': self.app.exc_editor.launched_from_shortcuts = True self.on_select_tab('project') return # Switch to Selected Tab - if key == QtCore.Qt.Key_2 or key == '2': + if key == QtCore.Qt.Key.Key_2 or key == '2': self.app.exc_editor.launched_from_shortcuts = True self.on_select_tab('selected') return # Switch to Tool Tab - if key == QtCore.Qt.Key_3 or key == '3': + if key == QtCore.Qt.Key.Key_3 or key == '3': self.app.exc_editor.launched_from_shortcuts = True self.on_select_tab('tool') return # Grid Snap - if key == QtCore.Qt.Key_G or key == 'G': + if key == QtCore.Qt.Key.Key_G or key == 'G': self.app.exc_editor.launched_from_shortcuts = True # make sure that the cursor shape is enabled/disabled, too if self.app.exc_editor.options['grid_snap'] is True: @@ -3666,19 +3667,19 @@ class MainGUI(QtWidgets.QMainWindow): return # Corner Snap - if key == QtCore.Qt.Key_K or key == 'K': + if key == QtCore.Qt.Key.Key_K or key == 'K': self.app.exc_editor.launched_from_shortcuts = True self.app.ui.corner_snap_btn.trigger() return # Zoom Fit - if key == QtCore.Qt.Key_V or key == 'V': + if key == QtCore.Qt.Key.Key_V or key == 'V': self.app.exc_editor.launched_from_shortcuts = True self.app.on_zoom_fit() return # Add Slot Hole Tool - if key == QtCore.Qt.Key_W or key == 'W': + if key == QtCore.Qt.Key.Key_W or key == 'W': self.app.exc_editor.launched_from_shortcuts = True self.app.inform.emit(_("Click on target point.")) self.app.ui.add_slot_btn.setChecked(True) @@ -3690,7 +3691,7 @@ class MainGUI(QtWidgets.QMainWindow): return # Show Shortcut list - if key == QtCore.Qt.Key_F3 or key == 'F3': + if key == QtCore.Qt.Key.Key_F3 or key == 'F3': self.on_shortcut_list() return @@ -3703,7 +3704,7 @@ class MainGUI(QtWidgets.QMainWindow): self.app.inform.emit(response) else: # Add Array of Drill Hole Tool - if key == QtCore.Qt.Key_A or key == 'A': + if key == QtCore.Qt.Key.Key_A or key == 'A': self.app.exc_editor.launched_from_shortcuts = True self.app.inform.emit("Click on target point.") self.app.ui.add_drill_array_btn.setChecked(True) @@ -3715,7 +3716,7 @@ class MainGUI(QtWidgets.QMainWindow): return # Copy - if key == QtCore.Qt.Key_C or key == 'C': + if key == QtCore.Qt.Key.Key_C or key == 'C': self.app.exc_editor.launched_from_shortcuts = True if self.app.exc_editor.selected: self.app.inform.emit(_("Click on target point.")) @@ -3728,7 +3729,7 @@ class MainGUI(QtWidgets.QMainWindow): return # Add Drill Hole Tool - if key == QtCore.Qt.Key_D or key == 'D': + if key == QtCore.Qt.Key.Key_D or key == 'D': self.app.exc_editor.launched_from_shortcuts = True self.app.inform.emit(_("Click on target point.")) self.app.ui.add_drill_btn.setChecked(True) @@ -3740,11 +3741,11 @@ class MainGUI(QtWidgets.QMainWindow): return # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.app.on_jump_to() # Move - if key == QtCore.Qt.Key_M or key == 'M': + if key == QtCore.Qt.Key.Key_M or key == 'M': self.app.exc_editor.launched_from_shortcuts = True if self.app.exc_editor.selected: self.app.inform.emit(_("Click on target location ...")) @@ -3757,7 +3758,7 @@ class MainGUI(QtWidgets.QMainWindow): return # Add Array of Slots Hole Tool - if key == QtCore.Qt.Key_Q or key == 'Q': + if key == QtCore.Qt.Key.Key_Q or key == 'Q': self.app.exc_editor.launched_from_shortcuts = True self.app.inform.emit("Click on target point.") self.app.ui.add_slot_array_btn.setChecked(True) @@ -3769,13 +3770,13 @@ class MainGUI(QtWidgets.QMainWindow): return # Resize Tool - if key == QtCore.Qt.Key_R or key == 'R': + if key == QtCore.Qt.Key.Key_R or key == 'R': self.app.exc_editor.launched_from_shortcuts = True self.app.exc_editor.select_tool('drill_resize') return # Add Tool - if key == QtCore.Qt.Key_T or key == 'T': + if key == QtCore.Qt.Key.Key_T or key == 'T': self.app.exc_editor.launched_from_shortcuts = True # ## Current application units in Upper Case self.units = self.general_pref_form.general_app_group.units_radio.get_value().upper() @@ -3796,103 +3797,103 @@ class MainGUI(QtWidgets.QMainWindow): return elif self.app.call_source == 'gcode_editor': # CTRL - if modifiers == QtCore.Qt.ControlModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: # save (update) the current geometry and return to the App - if key == QtCore.Qt.Key_S or key == 'S': + if key == QtCore.Qt.Key.Key_S or key == 'S': self.app.editor2object(force_cancel=True) return # SHIFT - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: pass # ALT - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: pass # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: pass elif self.app.call_source == 'measurement': - if modifiers == QtCore.Qt.ControlModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: pass - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: pass - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: pass # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: - if key == QtCore.Qt.Key_Escape or key == 'Escape': + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': # abort the measurement action self.app.distance_tool.deactivate_measure_tool() self.app.inform.emit(_("Distance Tool exit...")) return - if key == QtCore.Qt.Key_G or key == 'G': + if key == QtCore.Qt.Key.Key_G or key == 'G': self.app.ui.grid_snap_btn.trigger() return # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.app.on_jump_to() elif self.app.call_source == 'qrcode_tool': # CTRL + ALT - if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier: - if key == QtCore.Qt.Key_X: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier | QtCore.Qt.KeyboardModifier.AltModifier: + if key == QtCore.Qt.Key.Key_X: self.app.abort_all_tasks() return - elif modifiers == QtCore.Qt.ControlModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: pass - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: pass - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: pass # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: # Escape = Deselect All - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': self.app.qrcode_tool.on_exit() # Grid toggle - if key == QtCore.Qt.Key_G: + if key == QtCore.Qt.Key.Key_G: self.app.ui.grid_snap_btn.trigger() # Jump to coords - if key == QtCore.Qt.Key_J: + if key == QtCore.Qt.Key.Key_J: self.app.on_jump_to() elif self.app.call_source == 'copper_thieving_tool': # CTRL + ALT - if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier: - if key == QtCore.Qt.Key_X: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier | QtCore.Qt.KeyboardModifier.AltModifier: + if key == QtCore.Qt.Key.Key_X: self.app.abort_all_tasks() return - elif modifiers == QtCore.Qt.ControlModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: pass - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: pass - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: pass # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: # Escape = Deselect All - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': self.app.copperfill_tool.on_exit() # Grid toggle - if key == QtCore.Qt.Key_G: + if key == QtCore.Qt.Key.Key_G: self.app.ui.grid_snap_btn.trigger() # Jump to coords - if key == QtCore.Qt.Key_J: + if key == QtCore.Qt.Key.Key_J: self.app.on_jump_to() elif self.app.call_source == 'geometry': - if modifiers == QtCore.Qt.ControlModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: pass - elif modifiers == QtCore.Qt.AltModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier: pass - elif modifiers == QtCore.Qt.ShiftModifier: + elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: pass # NO MODIFIER - elif modifiers == QtCore.Qt.NoModifier: - if key == QtCore.Qt.Key_Escape or key == 'Escape': + elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier: + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': sel_obj = self.app.collection.get_active() assert sel_obj.kind == 'geometry' or sel_obj.kind == 'excellon', \ "Expected a Geometry or Excellon Object, got %s" % type(sel_obj) @@ -3900,12 +3901,12 @@ class MainGUI(QtWidgets.QMainWindow): sel_obj.area_disconnect() return - if key == QtCore.Qt.Key_G or key == 'G': + if key == QtCore.Qt.Key.Key_G or key == 'G': self.app.ui.grid_snap_btn.trigger() return # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.app.on_jump_to() def on_shortcut_list(self): @@ -4052,7 +4053,7 @@ class MainGUI(QtWidgets.QMainWindow): flags = self.windowFlags() if self.toggle_fscreen is False and disable is False: # self.ui.showFullScreen() - self.setWindowFlags(flags | Qt.FramelessWindowHint) + self.setWindowFlags(flags | Qt.WindowType.FramelessWindowHint) a = self.geometry() self.x_pos = a.x() self.y_pos = a.y() @@ -4089,7 +4090,7 @@ class MainGUI(QtWidgets.QMainWindow): self.splitter.setSizes([0, 1]) self.toggle_fscreen = True elif self.toggle_fscreen is True or disable is True: - self.setWindowFlags(flags & ~Qt.FramelessWindowHint) + self.setWindowFlags(flags & ~Qt.WindowType.FramelessWindowHint) # the additions are made to account for the pixels we subtracted/added above in the (x, y, h, w) self.setGeometry(self.x_pos+1, self.y_pos+self.titlebar_height+4, self.width, self.height) self.showNormal() @@ -4153,7 +4154,7 @@ class MainGUI(QtWidgets.QMainWindow): QtCore.QTimer.singleShot(0, lambda: self.shell_dock.widget()._edit.setFocus()) # HACK - simulate a mouse click - alternative - # no_km = QtCore.Qt.KeyboardModifier(QtCore.Qt.NoModifier) # no KB modifier + # no_km = QtCore.Qt.KeyboardModifier(QtCore.Qt.KeyboardModifier.NoModifier) # no KB modifier # pos = QtCore.QPoint((self.shell._edit.width() - 40), (self.shell._edit.height() - 2)) # e = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonPress, pos, QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, # no_km) @@ -4189,8 +4190,8 @@ class ShortcutsTab(QtWidgets.QWidget): self.sh_hlay = QtWidgets.QHBoxLayout() self.sh_title = QtWidgets.QTextEdit('%s' % _('Shortcut Key List')) - self.sh_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) - self.sh_title.setFrameStyle(QtWidgets.QFrame.NoFrame) + self.sh_title.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.NoTextInteraction) + self.sh_title.setFrameStyle(QtWidgets.QFrame.Shape.NoFrame) self.sh_title.setMaximumHeight(30) font = self.sh_title.font() @@ -4696,10 +4697,10 @@ class ShortcutsTab(QtWidgets.QWidget): ) self.sh_app = QtWidgets.QTextEdit() - self.sh_app.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) + self.sh_app.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.NoTextInteraction) self.sh_app.setText(self.app_sh_msg) - self.sh_app.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + self.sh_app.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) self.sh_hlay.addWidget(self.sh_app) editor_title = """ @@ -5148,9 +5149,9 @@ class ShortcutsTab(QtWidgets.QWidget): self.editor_sh_msg = editor_title + geo_sh_messages + grb_sh_messages + exc_sh_messages self.sh_editor = QtWidgets.QTextEdit() - self.sh_editor.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) + self.sh_editor.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.NoTextInteraction) self.sh_editor.setText(self.editor_sh_msg) - self.sh_editor.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + self.sh_editor.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) self.sh_hlay.addWidget(self.sh_editor) # end of file diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py index 11f6e508..d8b7f59d 100644 --- a/appGUI/ObjectUI.py +++ b/appGUI/ObjectUI.py @@ -62,7 +62,7 @@ class ObjectUI(QtWidgets.QWidget): # ## Title label self.title_label = FCLabel("%s" % title) - self.title_label.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.title_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.title_box.addWidget(self.title_label, stretch=1) # App Level label @@ -93,8 +93,8 @@ class ObjectUI(QtWidgets.QWidget): # self.common_grid.addWidget(FCLabel(''), 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.common_grid.addWidget(separator_line, 1, 0, 1, 2) self.transform_label = FCLabel('%s' % _('Transformations')) @@ -179,7 +179,7 @@ class GerberObjectUI(ObjectUI): # Plot options grid0 = QtWidgets.QGridLayout() - grid0.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + grid0.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.custom_box.addLayout(grid0) grid0.setColumnStretch(0, 0) grid0.setColumnStretch(1, 1) @@ -208,7 +208,7 @@ class GerberObjectUI(ObjectUI): name_label = FCLabel("%s:" % _("Name")) self.name_entry = FCEntry() - self.name_entry.setFocusPolicy(QtCore.Qt.StrongFocus) + self.name_entry.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.name_hlay.addWidget(name_label) self.name_hlay.addWidget(self.name_entry) @@ -280,7 +280,7 @@ class GerberObjectUI(ObjectUI): self.aperture_table_visibility_cb.setToolTip( _("Toggle the display of the Tools Table.") ) - # self.aperture_table_visibility_cb.setLayoutDirection(QtCore.Qt.RightToLeft) + # self.aperture_table_visibility_cb.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) grid0.addWidget(self.aperture_table_visibility_cb, 8, 1) hlay_plot = QtWidgets.QHBoxLayout() @@ -294,7 +294,7 @@ class GerberObjectUI(ObjectUI): "that are drawn on canvas.") ) - self.mark_all_cb.setLayoutDirection(QtCore.Qt.RightToLeft) + self.mark_all_cb.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) hlay_plot.addStretch() hlay_plot.addWidget(self.mark_all_cb) @@ -336,8 +336,8 @@ class GerberObjectUI(ObjectUI): grid0.addWidget(self.create_buffer_button, 12, 0, 1, 3) separator_line1 = QtWidgets.QFrame() - separator_line1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line1, 13, 0, 1, 3) self.tool_lbl = FCLabel('%s' % _("Plugins")) @@ -400,8 +400,8 @@ class GerberObjectUI(ObjectUI): grid0.addWidget(self.generate_follow_button, 22, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 24, 0, 1, 3) # UTILITIES BUTTON @@ -471,8 +471,8 @@ class GerberObjectUI(ObjectUI): util_grid.addWidget(self.generate_noncopper_button, 4, 1, 1, 2) separator_line1 = QtWidgets.QFrame() - separator_line1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) util_grid.addWidget(separator_line1, 6, 0, 1, 3) # ## Bounding box @@ -541,7 +541,7 @@ class ExcellonObjectUI(ObjectUI): app=self.app) grid0 = QtWidgets.QGridLayout() - grid0.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + grid0.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) grid0.setColumnStretch(0, 0) grid0.setColumnStretch(1, 1) self.custom_box.addLayout(grid0) @@ -570,7 +570,7 @@ class ExcellonObjectUI(ObjectUI): name_label = FCLabel("%s:" % _("Name")) self.name_entry = FCEntry() - self.name_entry.setFocusPolicy(QtCore.Qt.StrongFocus) + self.name_entry.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.name_hlay.addWidget(name_label) self.name_hlay.addWidget(self.name_entry) @@ -636,7 +636,7 @@ class ExcellonObjectUI(ObjectUI): self.plot_cb.setToolTip( _("Plot (show) this object.") ) - self.plot_cb.setLayoutDirection(QtCore.Qt.RightToLeft) + self.plot_cb.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) hlay_plot.addStretch() hlay_plot.addWidget(self.plot_cb) @@ -712,8 +712,8 @@ class ExcellonObjectUI(ObjectUI): grid0.addLayout(grid2, 12, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid2.addWidget(separator_line, 0, 0, 1, 2) self.tool_lbl = FCLabel('%s' % _("Plugins")) @@ -748,8 +748,8 @@ class ExcellonObjectUI(ObjectUI): grid2.addWidget(self.milling_button, 6, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid2.addWidget(separator_line, 8, 0, 1, 2) # UTILITIES BUTTON @@ -869,7 +869,7 @@ class GeometryObjectUI(ObjectUI): # Plot options grid_header = QtWidgets.QGridLayout() - grid_header.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + grid_header.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.custom_box.addLayout(grid_header) grid_header.setColumnStretch(0, 0) grid_header.setColumnStretch(1, 1) @@ -893,7 +893,7 @@ class GeometryObjectUI(ObjectUI): name_label = FCLabel("%s:" % _("Name")) self.name_entry = FCEntry() - self.name_entry.setFocusPolicy(QtCore.Qt.StrongFocus) + self.name_entry.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.name_hlay.addWidget(name_label) self.name_hlay.addWidget(self.name_entry) @@ -987,7 +987,7 @@ class GeometryObjectUI(ObjectUI): self.plot_cb.setToolTip( _("Plot (show) this object.") ) - self.plot_cb.setLayoutDirection(QtCore.Qt.RightToLeft) + self.plot_cb.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) grid0.addWidget(self.plot_cb, 0, 1) self.geo_tools_table = FCTable(drag_drop=True) @@ -1083,8 +1083,8 @@ class GeometryObjectUI(ObjectUI): self.grid4.addWidget(self.generate_ncc_button, 38, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid4.addWidget(separator_line, 40, 0, 1, 2) # UTILITIES BUTTON @@ -1240,7 +1240,7 @@ class CNCObjectUI(ObjectUI): # ## Object name name_label = FCLabel("%s:" % _("Name")) self.name_entry = FCEntry() - self.name_entry.setFocusPolicy(QtCore.Qt.StrongFocus) + self.name_entry.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.name_hlay.addWidget(name_label) self.name_hlay.addWidget(self.name_entry) @@ -1296,8 +1296,8 @@ class CNCObjectUI(ObjectUI): f_lay.addWidget(self.annotation_cb, 8, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) f_lay.addWidget(separator_line, 10, 0, 1, 3) # Travelled Distance @@ -1332,8 +1332,8 @@ class CNCObjectUI(ObjectUI): self.t_time_entry.setVisible(False) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) f_lay.addWidget(separator_line, 16, 0, 1, 3) hlay = QtWidgets.QHBoxLayout() @@ -1362,7 +1362,7 @@ class CNCObjectUI(ObjectUI): self.plot_cb.setToolTip( _("Plot (show) this object.") ) - self.plot_cb.setLayoutDirection(QtCore.Qt.RightToLeft) + self.plot_cb.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) hlay.addStretch() hlay.addWidget(self.plot_cb) @@ -1407,8 +1407,8 @@ class CNCObjectUI(ObjectUI): self.custom_box.addWidget(self.snippets_cb) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.custom_box.addWidget(separator_line) # ############################################################################################################# @@ -1438,8 +1438,8 @@ class CNCObjectUI(ObjectUI): # ## Export G-Code ## # ############################################################################################################# separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.custom_box.addWidget(separator_line) g_export_lay = QtWidgets.QHBoxLayout() @@ -1451,7 +1451,7 @@ class CNCObjectUI(ObjectUI): self.export_gcode_button.setToolTip( _("Opens dialog to save CNC Code file.") ) - self.export_gcode_button.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.export_gcode_button.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) g_export_lay.addWidget(self.export_gcode_button) self.review_gcode_button = QtWidgets.QToolButton() @@ -1501,12 +1501,12 @@ class ScriptObjectUI(ObjectUI): name_label = FCLabel("%s:" % _("Name")) self.name_entry = FCEntry() - self.name_entry.setFocusPolicy(QtCore.Qt.StrongFocus) + self.name_entry.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.name_hlay.addWidget(name_label) self.name_hlay.addWidget(self.name_entry) h_lay = QtWidgets.QHBoxLayout() - h_lay.setAlignment(QtCore.Qt.AlignVCenter) + h_lay.setAlignment(QtCore.Qt.AlignmentFlag.AlignVCenter) self.custom_box.addLayout(h_lay) self.autocomplete_cb = FCCheckBox("%s" % _("Auto Completer")) @@ -1524,7 +1524,7 @@ class ScriptObjectUI(ObjectUI): # Plot CB - this is added only for compatibility; other FlatCAM objects expect it and the mechanism is already # established and I don't want to changed it right now self.plot_cb = FCCheckBox() - self.plot_cb.setLayoutDirection(QtCore.Qt.RightToLeft) + self.plot_cb.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) self.custom_box.addWidget(self.plot_cb) self.plot_cb.hide() @@ -1568,19 +1568,19 @@ class DocumentObjectUI(ObjectUI): name_label = FCLabel("%s:" % _("Name")) self.name_entry = FCEntry() - self.name_entry.setFocusPolicy(QtCore.Qt.StrongFocus) + self.name_entry.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.name_hlay.addWidget(name_label) self.name_hlay.addWidget(self.name_entry) # Plot CB - this is added only for compatibility; other FlatCAM objects expect it and the mechanism is already # established and I don't want to changed it right now self.plot_cb = FCCheckBox() - self.plot_cb.setLayoutDirection(QtCore.Qt.RightToLeft) + self.plot_cb.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) self.custom_box.addWidget(self.plot_cb) self.plot_cb.hide() h_lay = QtWidgets.QHBoxLayout() - h_lay.setAlignment(QtCore.Qt.AlignVCenter) + h_lay.setAlignment(QtCore.Qt.AlignmentFlag.AlignVCenter) self.custom_box.addLayout(h_lay) self.autocomplete_cb = FCCheckBox("%s" % _("Auto Completer")) @@ -1703,7 +1703,7 @@ class DocumentObjectUI(ObjectUI): self.grid0_child_1.addWidget(self.font_color_entry) self.grid0_child_1.addWidget(self.font_color_button) - self.grid0_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.grid0_child_1.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.grid0.addWidget(self.font_color_label, 6, 0) self.grid0.addLayout(self.grid0_child_1, 6, 1) @@ -1722,7 +1722,7 @@ class DocumentObjectUI(ObjectUI): self.grid0_child_2.addWidget(self.sel_color_entry) self.grid0_child_2.addWidget(self.sel_color_button) - self.grid0_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.grid0_child_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) self.grid0.addWidget(self.sel_color_label, 8, 0) self.grid0.addLayout(self.grid0_child_2, 8, 1) diff --git a/appGUI/PlotCanvas.py b/appGUI/PlotCanvas.py index fbe134b3..69ef8c64 100644 --- a/appGUI/PlotCanvas.py +++ b/appGUI/PlotCanvas.py @@ -5,13 +5,15 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtCore +from PyQt6 import QtCore import logging from appGUI.VisPyCanvas import VisPyCanvas, Color from appGUI.VisPyVisuals import ShapeGroup, ShapeCollection, TextCollection, TextGroup, Cursor from vispy.scene.visuals import InfiniteLine, Line, Rectangle, Text +from PyQt6 import QtWidgets + import gettext import appTranslation as fcTranslate import builtins @@ -125,7 +127,10 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): # self.create_native() - self.native.setParent(self.fcapp.ui) + gui_widget = self.fcapp.ui + + assert isinstance(gui_widget, QtWidgets.QWidget) + self.native.setParent(gui_widget) axis_default_color = self.fcapp.defaults['global_axis_color'] self.axis_transparency = 0.8 diff --git a/appGUI/PlotCanvas3d.py b/appGUI/PlotCanvas3d.py index f259ae03..b83d8a05 100644 --- a/appGUI/PlotCanvas3d.py +++ b/appGUI/PlotCanvas3d.py @@ -5,9 +5,9 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtCore -from PyQt5.QtGui import QPalette -# from PyQt5.QtCore import QSettings +from PyQt6 import QtCore +from PyQt6.QtGui import QPalette +# from PyQt6.QtCore import QSettings import time @@ -74,7 +74,7 @@ class PlotCanvas3d(QtCore.QObject, scene.SceneCanvas): if theme == 'white': theme_color = Color('#FFFFFF') tick_color = Color('#000000') - back_color = str(QPalette().color(QPalette.Window).name()) + back_color = str(QPalette().color(QPalette.ColorRole.Window).name()) else: theme_color = Color('#000000') tick_color = Color('gray') diff --git a/appGUI/PlotCanvasLegacy.py b/appGUI/PlotCanvasLegacy.py index 4b92c91b..8d7cc940 100644 --- a/appGUI/PlotCanvasLegacy.py +++ b/appGUI/PlotCanvasLegacy.py @@ -7,8 +7,8 @@ # Modified by Marius Stanciu 09/21/2019 # ############################################################ -from PyQt5 import QtCore -from PyQt5.QtCore import pyqtSignal +from PyQt6 import QtCore +from PyQt6.QtCore import pyqtSignal # needed for legacy mode # Used for solid polygons in Matplotlib @@ -257,7 +257,7 @@ class PlotCanvasLegacy(QtCore.QObject): # The canvas is the top level container (FigureCanvasQTAgg) self.canvas = FigureCanvas(self.figure) - self.canvas.setFocusPolicy(QtCore.Qt.ClickFocus) + self.canvas.setFocusPolicy(QtCore.Qt.FocusPolicy.ClickFocus) self.canvas.setFocus() self.native = self.canvas diff --git a/appGUI/VisPyCanvas.py b/appGUI/VisPyCanvas.py index aa55675f..36f322f4 100644 --- a/appGUI/VisPyCanvas.py +++ b/appGUI/VisPyCanvas.py @@ -6,8 +6,8 @@ # MIT Licence # # ########################################################## -from PyQt5.QtGui import QPalette -from PyQt5.QtCore import QSettings +from PyQt6.QtGui import QPalette +from PyQt6.QtCore import QSettings import numpy as np @@ -44,7 +44,7 @@ class VisPyCanvas(scene.SceneCanvas): if theme == 'white': theme_color = Color('#FFFFFF') tick_color = Color('#000000') - back_color = str(QPalette().color(QPalette.Window).name()) + back_color = str(QPalette().color(QPalette.ColorRole.Window).name()) else: theme_color = Color('#000000') tick_color = Color('gray') diff --git a/appGUI/preferences/OptionUI.py b/appGUI/preferences/OptionUI.py index 325ea78f..e9a99467 100644 --- a/appGUI/preferences/OptionUI.py +++ b/appGUI/preferences/OptionUI.py @@ -1,7 +1,7 @@ from typing import Union, Sequence, List -from PyQt5 import QtWidgets, QtGui -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets, QtGui +from PyQt6.QtCore import QSettings from appGUI.GUIElements import RadioSet, FCCheckBox, FCButton, FCComboBox, FCEntry, FCSpinner, FCColorEntry, \ FCSliderWithSpinner, FCDoubleSpinner, FloatEntry, FCTextArea, FCLabel @@ -294,8 +294,8 @@ class SeparatorOptionUI(OptionUI): @staticmethod def build_separator_widget(): separator = QtWidgets.QFrame() - separator.setFrameShape(QtWidgets.QFrame.HLine) - separator.setFrameShadow(QtWidgets.QFrame.Sunken) + separator.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) return separator def add_to_grid(self, grid: QtWidgets.QGridLayout, row: int) -> int: diff --git a/appGUI/preferences/OptionsGroupUI.py b/appGUI/preferences/OptionsGroupUI.py index 04a846ae..9e03f7c2 100644 --- a/appGUI/preferences/OptionsGroupUI.py +++ b/appGUI/preferences/OptionsGroupUI.py @@ -7,7 +7,7 @@ from typing import Dict -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets import gettext import appTranslation as fcTranslate diff --git a/appGUI/preferences/PreferencesSectionUI.py b/appGUI/preferences/PreferencesSectionUI.py index 1ce11ae8..8c341b02 100644 --- a/appGUI/preferences/PreferencesSectionUI.py +++ b/appGUI/preferences/PreferencesSectionUI.py @@ -1,5 +1,5 @@ from typing import Dict -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.ColumnarFlowLayout import ColumnarFlowLayout from appGUI.preferences.OptionUI import OptionUI diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index b3a2661c..1ca2563a 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -1,6 +1,6 @@ import os -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.QtCore import QSettings +from PyQt6 import QtGui, QtCore, QtWidgets +from PyQt6.QtCore import QSettings from defaults import FlatCAMDefaults import logging diff --git a/appGUI/preferences/cncjob/CNCJobAdvOptPrefGroupUI.py b/appGUI/preferences/cncjob/CNCJobAdvOptPrefGroupUI.py index 4884670b..8f6c04aa 100644 --- a/appGUI/preferences/cncjob/CNCJobAdvOptPrefGroupUI.py +++ b/appGUI/preferences/cncjob/CNCJobAdvOptPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCComboBox, FCSpinner, FCColorEntry, FCLabel, FCDoubleSpinner, RadioSet from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/cncjob/CNCJobEditorPrefGroupUI.py b/appGUI/preferences/cncjob/CNCJobEditorPrefGroupUI.py index b1c10cf9..b94da063 100644 --- a/appGUI/preferences/cncjob/CNCJobEditorPrefGroupUI.py +++ b/appGUI/preferences/cncjob/CNCJobEditorPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtGui -from PyQt5.QtCore import QSettings +from PyQt6 import QtGui +from PyQt6.QtCore import QSettings from appGUI.GUIElements import FCTextArea, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/cncjob/CNCJobGenPrefGroupUI.py b/appGUI/preferences/cncjob/CNCJobGenPrefGroupUI.py index ad8bf7be..3434b0db 100644 --- a/appGUI/preferences/cncjob/CNCJobGenPrefGroupUI.py +++ b/appGUI/preferences/cncjob/CNCJobGenPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCCheckBox, RadioSet, FCSpinner, FCDoubleSpinner, FCSliderWithSpinner, FCColorEntry, \ FCLabel @@ -121,8 +121,8 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.line_ending_cb, 9, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 12, 0, 1, 2) # Travel Line Color @@ -162,8 +162,8 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.cncjob_alpha_entry, 16, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 17, 0, 1, 2) # CNCJob Object Color diff --git a/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py b/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py index 2515864c..c8dda552 100644 --- a/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py +++ b/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets, QtGui -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets, QtGui +from PyQt6.QtCore import QSettings from appGUI.GUIElements import RadioSet, FCCheckBox, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/cncjob/CNCJobPreferencesUI.py b/appGUI/preferences/cncjob/CNCJobPreferencesUI.py index fc8e3bfc..4256ee93 100644 --- a/appGUI/preferences/cncjob/CNCJobPreferencesUI.py +++ b/appGUI/preferences/cncjob/CNCJobPreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.cncjob.CNCJobAdvOptPrefGroupUI import CNCJobAdvOptPrefGroupUI from appGUI.preferences.cncjob.CNCJobOptPrefGroupUI import CNCJobOptPrefGroupUI diff --git a/appGUI/preferences/excellon/ExcellonAdvOptPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonAdvOptPrefGroupUI.py index 327bc5a9..c31f6044 100644 --- a/appGUI/preferences/excellon/ExcellonAdvOptPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonAdvOptPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCCheckBox, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/excellon/ExcellonEditorPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonEditorPrefGroupUI.py index bd3f6c28..d04d6fee 100644 --- a/appGUI/preferences/excellon/ExcellonEditorPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonEditorPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/excellon/ExcellonExpPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonExpPrefGroupUI.py index 10aa51da..eef029d8 100644 --- a/appGUI/preferences/excellon/ExcellonExpPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonExpPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appGUI.GUIElements import RadioSet, FCSpinner, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -65,11 +65,11 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): _("This numbers signify the number of digits in\n" "the whole part of Excellon coordinates.") ) - hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft) + hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignmentFlag.AlignLeft) excellon_separator_label = FCLabel(':') excellon_separator_label.setFixedWidth(5) - hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft) + hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignmentFlag.AlignLeft) self.format_dec_entry = FCSpinner() self.format_dec_entry.set_range(0, 9) @@ -78,7 +78,7 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): _("This numbers signify the number of digits in\n" "the decimal part of Excellon coordinates.") ) - hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft) + hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignmentFlag.AlignLeft) hlay1.addStretch() grid0.addWidget(self.digits_label, 2, 0) @@ -110,7 +110,7 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): # Excellon Zeros self.zeros_label = FCLabel('%s:' % _('Zeros')) - self.zeros_label.setAlignment(QtCore.Qt.AlignLeft) + self.zeros_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) self.zeros_label.setToolTip( _("This sets the type of Excellon zeros.\n" "If LZ then Leading Zeros are kept and\n" @@ -134,7 +134,7 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): # Slot type self.slot_type_label = FCLabel('%s:' % _('Slot type')) - self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft) + self.slot_type_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) self.slot_type_label.setToolTip( _("This sets how the slots will be exported.\n" "If ROUTED then the slots will be routed\n" diff --git a/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py index 52f8bb07..c3368e32 100644 --- a/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py @@ -1,6 +1,6 @@ import platform -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCSliderWithSpinner, FCColorEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -51,8 +51,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): grid1.addWidget(self.multicolored_cb, 0, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid1.addWidget(separator_line, 1, 0, 1, 3) grid2 = QtWidgets.QGridLayout() @@ -130,7 +130,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): excellon_separator_mm_label = FCLabel(':') excellon_separator_mm_label.setFixedWidth(5) - hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft) + hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignmentFlag.AlignLeft) self.excellon_format_lower_mm_entry = FCSpinner() self.excellon_format_lower_mm_entry.set_range(0, 9) @@ -145,7 +145,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): grid2.addLayout(hlay2, 2, 1) self.excellon_zeros_label = FCLabel('%s:' % _('Zeros')) - self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft) + self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) self.excellon_zeros_label.setToolTip( _("This sets the type of Excellon zeros.\n" "If LZ then Leading Zeros are kept and\n" @@ -163,7 +163,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): grid2.addWidget(self.excellon_zeros_radio, 3, 1) self.excellon_units_label = FCLabel('%s:' % _('Units')) - self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft) + self.excellon_units_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) self.excellon_units_label.setToolTip( _("This sets the default units of Excellon files.\n" "If it is not detected in the parsed file the value here\n" @@ -196,8 +196,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): grid2.addWidget(self.excellon_defaults_button, 6, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid2.addWidget(separator_line, 7, 0, 1, 2) self.excellon_general_label = FCLabel("%s:" % _("Path Optimization")) @@ -224,7 +224,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): grid2.addWidget(self.excellon_optimization_radio, 9, 1) self.optimization_time_label = FCLabel('%s:' % _('Duration')) - self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft) + self.optimization_time_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) self.optimization_time_label.setToolTip( _("When OR-Tools Metaheuristic (MH) is enabled there is a\n" "maximum threshold for how much time is spent doing the\n" @@ -240,8 +240,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): grid2.addWidget(self.optimization_time_entry, 10, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid2.addWidget(separator_line, 11, 0, 1, 2) # Fuse Tools @@ -256,8 +256,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): grid2.addWidget(self.fuse_tools_cb, 13, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid2.addWidget(separator_line, 14, 0, 1, 2) # Excellon Object Color diff --git a/appGUI/preferences/excellon/ExcellonOptPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonOptPrefGroupUI.py index d0b17c4f..6b71d3b7 100644 --- a/appGUI/preferences/excellon/ExcellonOptPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonOptPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/excellon/ExcellonPreferencesUI.py b/appGUI/preferences/excellon/ExcellonPreferencesUI.py index 28e17488..2a6f2e9e 100644 --- a/appGUI/preferences/excellon/ExcellonPreferencesUI.py +++ b/appGUI/preferences/excellon/ExcellonPreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.excellon.ExcellonEditorPrefGroupUI import ExcellonEditorPrefGroupUI from appGUI.preferences.excellon.ExcellonExpPrefGroupUI import ExcellonExpPrefGroupUI diff --git a/appGUI/preferences/general/GeneralAPPSetGroupUI.py b/appGUI/preferences/general/GeneralAPPSetGroupUI.py index c220bc6a..e1715577 100644 --- a/appGUI/preferences/general/GeneralAPPSetGroupUI.py +++ b/appGUI/preferences/general/GeneralAPPSetGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtCore, QtWidgets -from PyQt5.QtCore import QSettings +from PyQt6 import QtCore, QtWidgets +from PyQt6.QtCore import QSettings from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCComboBox, RadioSet, OptionalInputSection, FCSpinner, \ FCColorEntry, FCLabel @@ -77,8 +77,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): grid0.addWidget(self.snap_max_dist_entry, 6, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 8, 0, 1, 2) # Workspace @@ -174,8 +174,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): grid0.addWidget(self.wk_orientation_radio, 16, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 18, 0, 1, 2) # Font Size @@ -262,8 +262,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): grid0.addWidget(self.hud_font_size_spinner, 28, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 30, 0, 1, 2) # Axis Color @@ -277,8 +277,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): grid0.addWidget(self.axis_color_entry, 32, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 34, 0, 1, 2) # ----------------------------------------------------------- @@ -380,8 +380,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): grid0.addWidget(self.mselect_radio, 50, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 52, 0, 1, 2) # Delete confirmation diff --git a/appGUI/preferences/general/GeneralAppPrefGroupUI.py b/appGUI/preferences/general/GeneralAppPrefGroupUI.py index 9ab579e4..9baa35aa 100644 --- a/appGUI/preferences/general/GeneralAppPrefGroupUI.py +++ b/appGUI/preferences/general/GeneralAppPrefGroupUI.py @@ -1,7 +1,7 @@ import sys -from PyQt5 import QtWidgets -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets +from PyQt6.QtCore import QSettings from appGUI.GUIElements import RadioSet, FCSpinner, FCCheckBox, FCComboBox, FCButton, OptionalInputSection, \ FCDoubleSpinner, FCLabel @@ -84,8 +84,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.ge_radio, 6, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 8, 0, 1, 2) # Application Level for FlatCAM @@ -118,8 +118,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.verbose_cb, 16, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 18, 0, 1, 2) # Languages for FlatCAM @@ -137,8 +137,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.language_apply_btn, 24, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 26, 0, 1, 2) # ----------------------------------------------------------- @@ -207,8 +207,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb]) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 42, 0, 1, 2) # Worker Numbers @@ -245,8 +245,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.tol_entry, 46, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 48, 0, 1, 2) # Save Settings @@ -304,8 +304,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): # self.as_ois = OptionalInputSection(self.autosave_cb, [self.autosave_label, self.autosave_entry], True) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 60, 0, 1, 2) self.pdf_param_label = FCLabel('%s:' % _("Text to PDF parameters")) diff --git a/appGUI/preferences/general/GeneralAppSettingsGroupUI.py b/appGUI/preferences/general/GeneralAppSettingsGroupUI.py index e6e90ad1..a7c8105a 100644 --- a/appGUI/preferences/general/GeneralAppSettingsGroupUI.py +++ b/appGUI/preferences/general/GeneralAppSettingsGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore +from PyQt6 import QtCore from appGUI.GUIElements import OptionalInputSection from appGUI.preferences.OptionUI import * from appGUI.preferences.OptionsGroupUI import OptionsGroupUI2 diff --git a/appGUI/preferences/general/GeneralGUIPrefGroupUI.py b/appGUI/preferences/general/GeneralGUIPrefGroupUI.py index 14bc44dc..5f48fc86 100644 --- a/appGUI/preferences/general/GeneralGUIPrefGroupUI.py +++ b/appGUI/preferences/general/GeneralGUIPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets, QtCore -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets, QtCore +from PyQt6.QtCore import QSettings from appGUI.GUIElements import RadioSet, FCCheckBox, FCComboBox, FCSliderWithSpinner, FCColorEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -59,8 +59,8 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): # grid0.addWidget(self.theme_button, 2, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 3, 0, 1, 2) # Layout selection @@ -95,9 +95,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.style_combo.addItems(QtWidgets.QStyleFactory.keys()) # find current style current_style = QtCore.QCoreApplication.instance().style().objectName() - index = self.style_combo.findText(current_style, QtCore.Qt.MatchFixedString) + index = self.style_combo.findText(current_style, QtCore.Qt.MatchFlag.MatchFixedString) self.style_combo.setCurrentIndex(index) - self.style_combo.activated[str].connect(self.handle_style) + self.style_combo.activated.connect(self.handle_style) grid0.addWidget(self.style_label, 5, 0) grid0.addWidget(self.style_combo, 5, 1) @@ -138,8 +138,8 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.selection_cb, 9, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 14, 0, 1, 2) # Plot Selection (left - right) Color @@ -178,8 +178,8 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.left_right_alpha_entry, 18, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 19, 0, 1, 2) # Plot Selection (left - right) Color @@ -220,8 +220,8 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.right_left_alpha_entry, 23, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 24, 0, 1, 2) # ------------------------------------------------------------------ @@ -252,8 +252,8 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.sel_draw_color_entry, 27, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 28, 0, 1, 2) # ------------------------------------------------------------------ @@ -327,7 +327,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): def handle_style(style): # set current style qsettings = QSettings("Open Source", "FlatCAM") - qsettings.setValue('style', style) + qsettings.setValue('style', str(style)) # This will write the setting to the platform specific storage. del qsettings diff --git a/appGUI/preferences/general/GeneralPreferencesUI.py b/appGUI/preferences/general/GeneralPreferencesUI.py index fcfd43ac..05110da0 100644 --- a/appGUI/preferences/general/GeneralPreferencesUI.py +++ b/appGUI/preferences/general/GeneralPreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.general.GeneralAppPrefGroupUI import GeneralAppPrefGroupUI from appGUI.preferences.general.GeneralAPPSetGroupUI import GeneralAPPSetGroupUI diff --git a/appGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py b/appGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py index 3bc739f3..ddcf1430 100644 --- a/appGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCLabel, NumericalEvalTupleEntry, \ NumericalEvalEntry, FCComboBox2 diff --git a/appGUI/preferences/geometry/GeometryEditorPrefGroupUI.py b/appGUI/preferences/geometry/GeometryEditorPrefGroupUI.py index 0824d054..366a988f 100644 --- a/appGUI/preferences/geometry/GeometryEditorPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryEditorPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCSpinner, RadioSet, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/geometry/GeometryExpPrefGroupUI.py b/appGUI/preferences/geometry/GeometryExpPrefGroupUI.py index c8ccb413..007259bf 100644 --- a/appGUI/preferences/geometry/GeometryExpPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryExpPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appGUI.GUIElements import FCLabel, FCComboBox from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py b/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py index 983afab4..0b19db0e 100644 --- a/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCCheckBox, FCSpinner, FCEntry, FCColorEntry, RadioSet, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -61,8 +61,8 @@ class GeometryGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.circle_steps_entry, 1, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 9, 0, 1, 2) self.opt_label = FCLabel("%s:" % _("Path Optimization")) @@ -107,8 +107,8 @@ class GeometryGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.optimization_time_entry, 14, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 16, 0, 1, 2) # Fuse Tools @@ -123,8 +123,8 @@ class GeometryGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.fuse_tools_cb, 20, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 22, 0, 1, 2) # Geometry Object Color diff --git a/appGUI/preferences/geometry/GeometryOptPrefGroupUI.py b/appGUI/preferences/geometry/GeometryOptPrefGroupUI.py index 59c8aec8..20921549 100644 --- a/appGUI/preferences/geometry/GeometryOptPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryOptPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets -from PyQt5.QtCore import Qt +from PyQt6 import QtWidgets +from PyQt6.QtCore import Qt from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCSpinner, FCComboBox, \ NumericalEvalTupleEntry, FCLabel diff --git a/appGUI/preferences/geometry/GeometryPreferencesUI.py b/appGUI/preferences/geometry/GeometryPreferencesUI.py index 3250c37c..b3d54f27 100644 --- a/appGUI/preferences/geometry/GeometryPreferencesUI.py +++ b/appGUI/preferences/geometry/GeometryPreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.geometry.GeometryEditorPrefGroupUI import GeometryEditorPrefGroupUI from appGUI.preferences.geometry.GeometryAdvOptPrefGroupUI import GeometryAdvOptPrefGroupUI diff --git a/appGUI/preferences/gerber/GerberAdvOptPrefGroupUI.py b/appGUI/preferences/gerber/GerberAdvOptPrefGroupUI.py index 89a7289e..cf236246 100644 --- a/appGUI/preferences/gerber/GerberAdvOptPrefGroupUI.py +++ b/appGUI/preferences/gerber/GerberAdvOptPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCCheckBox, RadioSet, FCDoubleSpinner, FCLabel, OptionalInputSection from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -49,8 +49,8 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 2, 0, 1, 2) # Buffering Type diff --git a/appGUI/preferences/gerber/GerberEditorPrefGroupUI.py b/appGUI/preferences/gerber/GerberEditorPrefGroupUI.py index 8b7a6526..c599bcc4 100644 --- a/appGUI/preferences/gerber/GerberEditorPrefGroupUI.py +++ b/appGUI/preferences/gerber/GerberEditorPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, FCComboBox, FCLabel, RadioSet, NumericalEvalTupleEntry from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/gerber/GerberExpPrefGroupUI.py b/appGUI/preferences/gerber/GerberExpPrefGroupUI.py index 900ac766..9ee4cae0 100644 --- a/appGUI/preferences/gerber/GerberExpPrefGroupUI.py +++ b/appGUI/preferences/gerber/GerberExpPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appGUI.GUIElements import RadioSet, FCSpinner, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -67,11 +67,11 @@ class GerberExpPrefGroupUI(OptionsGroupUI): _("This numbers signify the number of digits in\n" "the whole part of Gerber coordinates.") ) - hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft) + hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignmentFlag.AlignLeft) gerber_separator_label = FCLabel(':') gerber_separator_label.setFixedWidth(5) - hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft) + hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignmentFlag.AlignLeft) self.format_dec_entry = FCSpinner() self.format_dec_entry.set_range(0, 9) @@ -83,7 +83,7 @@ class GerberExpPrefGroupUI(OptionsGroupUI): _("This numbers signify the number of digits in\n" "the decimal part of Gerber coordinates.") ) - hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft) + hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignmentFlag.AlignLeft) hlay1.addStretch() grid0.addWidget(self.digits_label, 2, 0) @@ -91,7 +91,7 @@ class GerberExpPrefGroupUI(OptionsGroupUI): # Gerber Zeros self.zeros_label = FCLabel('%s:' % _('Zeros')) - self.zeros_label.setAlignment(QtCore.Qt.AlignLeft) + self.zeros_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) self.zeros_label.setToolTip( _("This sets the type of Gerber zeros.\n" "If LZ then Leading Zeros are removed and\n" diff --git a/appGUI/preferences/gerber/GerberGenPrefGroupUI.py b/appGUI/preferences/gerber/GerberGenPrefGroupUI.py index 864e7ba5..d057963a 100644 --- a/appGUI/preferences/gerber/GerberGenPrefGroupUI.py +++ b/appGUI/preferences/gerber/GerberGenPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCButton, FCSliderWithSpinner, FCColorEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -88,7 +88,7 @@ class GerberGenPrefGroupUI(OptionsGroupUI): # Gerber Zeros self.gerber_zeros_label = FCLabel('%s:' % _('Zeros')) - self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignLeft) + self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) self.gerber_zeros_label.setToolTip( _("This sets the type of Gerber zeros.\n" "If LZ then Leading Zeros are removed and\n" @@ -111,8 +111,8 @@ class GerberGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 6, 0, 1, 3) # Apertures Cleaning @@ -150,8 +150,8 @@ class GerberGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.clear_colors_button, 11, 1, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 13, 0, 1, 3) # Gerber Object Color diff --git a/appGUI/preferences/gerber/GerberOptPrefGroupUI.py b/appGUI/preferences/gerber/GerberOptPrefGroupUI.py index 913f5e1f..8d858eaf 100644 --- a/appGUI/preferences/gerber/GerberOptPrefGroupUI.py +++ b/appGUI/preferences/gerber/GerberOptPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -58,8 +58,8 @@ class GerberOptPrefGroupUI(OptionsGroupUI): grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid1.addWidget(separator_line, 2, 0, 1, 2) # ## Bounding box diff --git a/appGUI/preferences/gerber/GerberPreferencesUI.py b/appGUI/preferences/gerber/GerberPreferencesUI.py index cb5a5f6e..8300b0b2 100644 --- a/appGUI/preferences/gerber/GerberPreferencesUI.py +++ b/appGUI/preferences/gerber/GerberPreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.gerber.GerberEditorPrefGroupUI import GerberEditorPrefGroupUI from appGUI.preferences.gerber.GerberExpPrefGroupUI import GerberExpPrefGroupUI diff --git a/appGUI/preferences/tools/Plugins2PreferencesUI.py b/appGUI/preferences/tools/Plugins2PreferencesUI.py index e28f98b8..b6f7986e 100644 --- a/appGUI/preferences/tools/Plugins2PreferencesUI.py +++ b/appGUI/preferences/tools/Plugins2PreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.tools.Tools2InvertPrefGroupUI import Tools2InvertPrefGroupUI from appGUI.preferences.tools.Tools2PunchGerberPrefGroupUI import Tools2PunchGerberPrefGroupUI diff --git a/appGUI/preferences/tools/PluginsEngravingPreferencesUI.py b/appGUI/preferences/tools/PluginsEngravingPreferencesUI.py index a90608a4..23c3beb7 100644 --- a/appGUI/preferences/tools/PluginsEngravingPreferencesUI.py +++ b/appGUI/preferences/tools/PluginsEngravingPreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.tools.Tools2sidedPrefGroupUI import Tools2sidedPrefGroupUI from appGUI.preferences.tools.ToolsLevelPrefGroupUI import ToolsLevelPrefGroupUI diff --git a/appGUI/preferences/tools/PluginsPreferencesUI.py b/appGUI/preferences/tools/PluginsPreferencesUI.py index ff9a20b8..dc2c306f 100644 --- a/appGUI/preferences/tools/PluginsPreferencesUI.py +++ b/appGUI/preferences/tools/PluginsPreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.tools.ToolsSubPrefGroupUI import ToolsSubPrefGroupUI from appGUI.preferences.tools.ToolsSolderpastePrefGroupUI import ToolsSolderpastePrefGroupUI diff --git a/appGUI/preferences/tools/Tools2CThievingPrefGroupUI.py b/appGUI/preferences/tools/Tools2CThievingPrefGroupUI.py index 14a96087..f5099856 100644 --- a/appGUI/preferences/tools/Tools2CThievingPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2CThievingPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCLabel, FCCheckBox from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -116,8 +116,8 @@ class Tools2CThievingPrefGroupUI(OptionsGroupUI): grid_lay.addWidget(self.bbox_type_radio, 12, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 14, 0, 1, 2) # Fill Type diff --git a/appGUI/preferences/tools/Tools2CalPrefGroupUI.py b/appGUI/preferences/tools/Tools2CalPrefGroupUI.py index 25e0469d..f6c9b9f8 100644 --- a/appGUI/preferences/tools/Tools2CalPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2CalPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, NumericalEvalTupleEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -46,8 +46,8 @@ class Tools2CalPrefGroupUI(OptionsGroupUI): grid_lay.addWidget(self.cal_source_radio, 1, 1, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 2, 0, 1, 2) # Travel Z entry diff --git a/appGUI/preferences/tools/Tools2ExtractPrefGroupUI.py b/appGUI/preferences/tools/Tools2ExtractPrefGroupUI.py index cf621886..565bee5c 100644 --- a/appGUI/preferences/tools/Tools2ExtractPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2ExtractPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCCheckBox, RadioSet, FCDoubleSpinner, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -82,8 +82,8 @@ class Tools2EDrillsPrefGroupUI(OptionsGroupUI): grid_lay.addWidget(self.other_cb, 7, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 8, 0, 1, 2) # Method of extraction @@ -108,8 +108,8 @@ class Tools2EDrillsPrefGroupUI(OptionsGroupUI): # grid_lay1.addWidget(FCLabel('')) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 10, 0, 1, 2) # Annular Ring diff --git a/appGUI/preferences/tools/Tools2FiducialsPrefGroupUI.py b/appGUI/preferences/tools/Tools2FiducialsPrefGroupUI.py index 72b20789..37c2f5ee 100644 --- a/appGUI/preferences/tools/Tools2FiducialsPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2FiducialsPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -91,8 +91,8 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI): grid_lay.addWidget(self.pos_radio, 4, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 5, 0, 1, 2) # Fiducial type # diff --git a/appGUI/preferences/tools/Tools2InvertPrefGroupUI.py b/appGUI/preferences/tools/Tools2InvertPrefGroupUI.py index 685387f1..406bb9d4 100644 --- a/appGUI/preferences/tools/Tools2InvertPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2InvertPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/tools/Tools2OptimalPrefGroupUI.py b/appGUI/preferences/tools/Tools2OptimalPrefGroupUI.py index b93d5cbc..cefe76b8 100644 --- a/appGUI/preferences/tools/Tools2OptimalPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2OptimalPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCSpinner, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/tools/Tools2PunchGerberPrefGroupUI.py b/appGUI/preferences/tools/Tools2PunchGerberPrefGroupUI.py index 863a2b20..ec502f86 100644 --- a/appGUI/preferences/tools/Tools2PunchGerberPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2PunchGerberPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCCheckBox, RadioSet, FCDoubleSpinner, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -82,8 +82,8 @@ class Tools2PunchGerberPrefGroupUI(OptionsGroupUI): grid_lay.addWidget(self.other_cb, 7, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 8, 0, 1, 2) # ## Axis @@ -110,8 +110,8 @@ class Tools2PunchGerberPrefGroupUI(OptionsGroupUI): # grid_lay1.addWidget(FCLabel('')) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 10, 0, 1, 2) # Annular Ring diff --git a/appGUI/preferences/tools/Tools2QRCodePrefGroupUI.py b/appGUI/preferences/tools/Tools2QRCodePrefGroupUI.py index 5911c116..01710bdd 100644 --- a/appGUI/preferences/tools/Tools2QRCodePrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2QRCodePrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCSpinner, RadioSet, FCTextArea, FCLabel, FCColorEntry from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/tools/Tools2RulesCheckPrefGroupUI.py b/appGUI/preferences/tools/Tools2RulesCheckPrefGroupUI.py index 86a862e7..dac3acca 100644 --- a/appGUI/preferences/tools/Tools2RulesCheckPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2RulesCheckPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/tools/Tools2sidedPrefGroupUI.py b/appGUI/preferences/tools/Tools2sidedPrefGroupUI.py index 5d8dde59..6480c26a 100644 --- a/appGUI/preferences/tools/Tools2sidedPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2sidedPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -65,8 +65,8 @@ class Tools2sidedPrefGroupUI(OptionsGroupUI): ) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 2, 0, 1, 2) grid0.addWidget(self.mirax_label, 3, 0) diff --git a/appGUI/preferences/tools/ToolsCalculatorsPrefGroupUI.py b/appGUI/preferences/tools/ToolsCalculatorsPrefGroupUI.py index 9b7643dd..9776a0d1 100644 --- a/appGUI/preferences/tools/ToolsCalculatorsPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsCalculatorsPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -112,7 +112,7 @@ class ToolsCalculatorsPrefGroupUI(OptionsGroupUI): self.area_label = FCLabel('%s:' % _("Area")) self.area_label.setToolTip(_('This is the board area.')) self.area_entry = FCDoubleSpinner() - self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.area_entry.set_precision(self.decimals) self.area_entry.set_range(0.0, 10000.0000) diff --git a/appGUI/preferences/tools/ToolsCornersPrefGroupUI.py b/appGUI/preferences/tools/ToolsCornersPrefGroupUI.py index e31c796a..eb8bce04 100644 --- a/appGUI/preferences/tools/ToolsCornersPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsCornersPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCLabel, RadioSet from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/tools/ToolsCutoutPrefGroupUI.py b/appGUI/preferences/tools/ToolsCutoutPrefGroupUI.py index ec548fc0..4a6ae46f 100644 --- a/appGUI/preferences/tools/ToolsCutoutPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsCutoutPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox, FCLabel, OptionalInputSection from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py b/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py index d66addab..d54c5ab3 100644 --- a/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets -from PyQt5.QtCore import Qt +from PyQt6 import QtWidgets +from PyQt6.QtCore import Qt from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCComboBox, FCCheckBox, FCSpinner, NumericalEvalTupleEntry, \ OptionalInputSection, NumericalEvalEntry, FCLabel @@ -203,15 +203,15 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI): ) self.pp_excellon_name_cb = FCComboBox() - self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus) - self.pp_excellon_name_cb.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.pp_excellon_name_cb.setFocusPolicy(Qt.FocusPolicy.StrongFocus) + self.pp_excellon_name_cb.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) grid0.addWidget(pp_excellon_label, 27, 0) grid0.addWidget(self.pp_excellon_name_cb, 27, 1, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 29, 0, 1, 3) # DRILL SLOTS LABEL @@ -248,8 +248,8 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.last_drill_cb, 37, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 39, 0, 1, 3) self.exc_label = FCLabel('%s:' % _('Advanced Options')) @@ -369,8 +369,8 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.fretract_cb, 59, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 61, 0, 1, 3) # ----------------------------- diff --git a/appGUI/preferences/tools/ToolsFilmPrefGroupUI.py b/appGUI/preferences/tools/ToolsFilmPrefGroupUI.py index 0a013cd4..91ca16c9 100644 --- a/appGUI/preferences/tools/ToolsFilmPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsFilmPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox, FCColorEntry, FCLabel, FCSpinner from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -198,8 +198,8 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.film_mirror_axis, 13, 1) separator_line3 = QtWidgets.QFrame() - separator_line3.setFrameShape(QtWidgets.QFrame.HLine) - separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line3.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line3, 14, 0, 1, 2) self.file_type_radio = RadioSet([{'label': _('SVG'), 'value': 'svg'}, diff --git a/appGUI/preferences/tools/ToolsISOPrefGroupUI.py b/appGUI/preferences/tools/ToolsISOPrefGroupUI.py index df9a11ae..64fd6ccc 100644 --- a/appGUI/preferences/tools/ToolsISOPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsISOPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCComboBox2, FCCheckBox, FCSpinner, NumericalEvalTupleEntry, \ FCLabel @@ -140,8 +140,8 @@ class ToolsISOPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.newdia_entry, 6, 1, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 7, 0, 1, 3) # Passes @@ -212,8 +212,8 @@ class ToolsISOPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.iso_type_radio, 12, 1, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 13, 0, 1, 3) # Rest machining CheckBox @@ -306,8 +306,8 @@ class ToolsISOPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.force_iso_cb, 22, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 24, 0, 1, 3) # ## Plotting type diff --git a/appGUI/preferences/tools/ToolsLevelPrefGroupUI.py b/appGUI/preferences/tools/ToolsLevelPrefGroupUI.py index 1cafd245..a18ebd11 100644 --- a/appGUI/preferences/tools/ToolsLevelPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsLevelPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCSpinner, RadioSet, FCLabel, FCComboBox from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -119,8 +119,8 @@ class ToolsLevelPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.feedrate_probe_entry, 18, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 20, 0, 1, 2) self.al_controller_label = FCLabel('%s:' % _("Controller")) diff --git a/appGUI/preferences/tools/ToolsMillPrefGroupUI.py b/appGUI/preferences/tools/ToolsMillPrefGroupUI.py index c188cfb4..0664dc0b 100644 --- a/appGUI/preferences/tools/ToolsMillPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsMillPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets -from PyQt5.QtCore import Qt +from PyQt6 import QtWidgets +from PyQt6.QtCore import Qt from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCComboBox, FCCheckBox, FCSpinner, NumericalEvalTupleEntry, \ OptionalInputSection, NumericalEvalEntry, FCLabel, FCComboBox2, FCEntry @@ -263,15 +263,15 @@ class ToolsMillPrefGroupUI(OptionsGroupUI): "the Machine Code (like GCode, RML, HPGL) output.") ) self.pp_geometry_name_cb = FCComboBox() - self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus) - self.pp_geometry_name_cb.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.pp_geometry_name_cb.setFocusPolicy(Qt.FocusPolicy.StrongFocus) + self.pp_geometry_name_cb.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) grid0.addWidget(pp_label, 28, 0) grid0.addWidget(self.pp_geometry_name_cb, 28, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 30, 0, 1, 2) # Toolchange X,Y @@ -390,8 +390,8 @@ class ToolsMillPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.fplunge_cb, 46, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 48, 0, 1, 2) # ----------------------------- @@ -450,8 +450,8 @@ class ToolsMillPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.over_z_entry, 60, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 62, 0, 1, 2) # ----------------------------- diff --git a/appGUI/preferences/tools/ToolsNCCPrefGroupUI.py b/appGUI/preferences/tools/ToolsNCCPrefGroupUI.py index bfa1c2a0..427af55d 100644 --- a/appGUI/preferences/tools/ToolsNCCPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsNCCPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, NumericalEvalTupleEntry, FCComboBox2, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -122,8 +122,8 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.newdia_entry, 5, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 6, 0, 1, 2) # Milling Type Radio Button @@ -167,8 +167,8 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.ncc_order_radio, 8, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 9, 0, 1, 2) # Overlap Entry @@ -271,8 +271,8 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.ncc_offset_spinner, 15, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 16, 0, 1, 2) # Rest machining CheckBox @@ -322,8 +322,8 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.area_shape_radio, 19, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 20, 0, 1, 2) # ## Plotting type diff --git a/appGUI/preferences/tools/ToolsPaintPrefGroupUI.py b/appGUI/preferences/tools/ToolsPaintPrefGroupUI.py index 2d361769..7ba03e19 100644 --- a/appGUI/preferences/tools/ToolsPaintPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsPaintPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCComboBox2, FCCheckBox, NumericalEvalTupleEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -126,8 +126,8 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.newdia_entry, 5, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 6, 0, 1, 2) self.paint_order_label = FCLabel('%s:' % _('Tool order')) @@ -146,8 +146,8 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.paint_order_radio, 7, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 8, 0, 1, 2) # Overlap @@ -228,8 +228,8 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.contour_cb, 12, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 13, 0, 1, 2) self.rest_cb = FCCheckBox('%s' % _("Rest")) @@ -286,8 +286,8 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.area_shape_radio, 18, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 19, 0, 1, 2) # ## Plotting type diff --git a/appGUI/preferences/tools/ToolsPanelizePrefGroupUI.py b/appGUI/preferences/tools/ToolsPanelizePrefGroupUI.py index d09b066a..d53ae0b5 100644 --- a/appGUI/preferences/tools/ToolsPanelizePrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsPanelizePrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCSpinner, RadioSet, FCCheckBox, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/tools/ToolsSolderpastePrefGroupUI.py b/appGUI/preferences/tools/ToolsSolderpastePrefGroupUI.py index 2ee47e7d..077bac79 100644 --- a/appGUI/preferences/tools/ToolsSolderpastePrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsSolderpastePrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.GUIElements import FCDoubleSpinner, FCSpinner, FCComboBox, NumericalEvalTupleEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/tools/ToolsTransformPrefGroupUI.py b/appGUI/preferences/tools/ToolsTransformPrefGroupUI.py index f951af93..ba3200b7 100644 --- a/appGUI/preferences/tools/ToolsTransformPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsTransformPrefGroupUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtGui +from PyQt6 import QtWidgets, QtGui from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, NumericalEvalTupleEntry, FCComboBox, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/utilities/AutoCompletePrefGroupUI.py b/appGUI/preferences/utilities/AutoCompletePrefGroupUI.py index d8e1c7ec..2ffb8568 100644 --- a/appGUI/preferences/utilities/AutoCompletePrefGroupUI.py +++ b/appGUI/preferences/utilities/AutoCompletePrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets, QtGui -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets, QtGui +from PyQt6.QtCore import QSettings from appGUI.GUIElements import FCButton, FCTextArea, FCEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/utilities/FAExcPrefGroupUI.py b/appGUI/preferences/utilities/FAExcPrefGroupUI.py index 928877f9..0fc242db 100644 --- a/appGUI/preferences/utilities/FAExcPrefGroupUI.py +++ b/appGUI/preferences/utilities/FAExcPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets, QtGui -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets, QtGui +from PyQt6.QtCore import QSettings from appGUI.GUIElements import VerticalScrollArea, FCButton, FCTextArea, FCEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI @@ -29,7 +29,7 @@ class FAExcPrefGroupUI(OptionsGroupUI): scroll = VerticalScrollArea() scroll.setWidget(scroll_widget) scroll.setWidgetResizable(True) - scroll.setFrameShape(QtWidgets.QFrame.NoFrame) + scroll.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) self.restore_btn = FCButton(_("Restore")) self.restore_btn.setToolTip(_("Restore the extension list to the default state.")) diff --git a/appGUI/preferences/utilities/FAGcoPrefGroupUI.py b/appGUI/preferences/utilities/FAGcoPrefGroupUI.py index 42a3e00e..9da61e3d 100644 --- a/appGUI/preferences/utilities/FAGcoPrefGroupUI.py +++ b/appGUI/preferences/utilities/FAGcoPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets, QtGui -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets, QtGui +from PyQt6.QtCore import QSettings from appGUI.GUIElements import FCButton, FCTextArea, FCEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/utilities/FAGrbPrefGroupUI.py b/appGUI/preferences/utilities/FAGrbPrefGroupUI.py index f6f1faf7..85449e85 100644 --- a/appGUI/preferences/utilities/FAGrbPrefGroupUI.py +++ b/appGUI/preferences/utilities/FAGrbPrefGroupUI.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets, QtGui -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets, QtGui +from PyQt6.QtCore import QSettings from appGUI.GUIElements import FCButton, FCTextArea, FCEntry, FCLabel from appGUI.preferences.OptionsGroupUI import OptionsGroupUI diff --git a/appGUI/preferences/utilities/UtilPreferencesUI.py b/appGUI/preferences/utilities/UtilPreferencesUI.py index f405348d..e6bfa7e0 100644 --- a/appGUI/preferences/utilities/UtilPreferencesUI.py +++ b/appGUI/preferences/utilities/UtilPreferencesUI.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from appGUI.preferences.utilities.AutoCompletePrefGroupUI import AutoCompletePrefGroupUI from appGUI.preferences.utilities.FAGrbPrefGroupUI import FAGrbPrefGroupUI diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py index e2cba114..e9ef017b 100644 --- a/appObjects/FlatCAMCNCJob.py +++ b/appObjects/FlatCAMCNCJob.py @@ -217,7 +217,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): row_no = tool_idx - 1 t_id = QtWidgets.QTableWidgetItem('%d' % int(tool_idx)) - # id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # id.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.cnc_tools_table.setItem(row_no, 0, t_id) # Tool name/id # Make sure that the tool diameter when in MM is with no more than 2 decimals. @@ -245,11 +245,11 @@ class CNCJobObject(FlatCAMObj, CNCjob): tool_shape_item_txt = dia_value['data']['tools_mill_tool_shape'] tool_shape_item = QtWidgets.QTableWidgetItem(tool_shape_item_txt) - t_id.setFlags(QtCore.Qt.ItemIsEnabled) - dia_item.setFlags(QtCore.Qt.ItemIsEnabled) - offset_item.setFlags(QtCore.Qt.ItemIsEnabled) - job_item.setFlags(QtCore.Qt.ItemIsEnabled) - tool_shape_item.setFlags(QtCore.Qt.ItemIsEnabled) + t_id.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + offset_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + job_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + tool_shape_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # hack so the checkbox stay centered in the table cell # used this: @@ -262,7 +262,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): # qhboxlayout.setAlignment(QtCore.Qt.AlignCenter) # qhboxlayout.setContentsMargins(0, 0, 0, 0) plot_item = FCCheckBox() - plot_item.setLayoutDirection(QtCore.Qt.RightToLeft) + plot_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) tool_uid_item = QtWidgets.QTableWidgetItem(str(dia_key)) if self.ui.plot_cb.isChecked(): plot_item.setChecked(True) @@ -278,12 +278,12 @@ class CNCJobObject(FlatCAMObj, CNCjob): # make the diameter column editable # for row in range(tool_idx): - # self.ui.cnc_tools_table.item(row, 1).setFlags(QtCore.Qt.ItemIsSelectable | - # QtCore.Qt.ItemIsEnabled) + # self.ui.cnc_tools_table.item(row, 1).setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | + # QtCore.Qt.ItemFlag.ItemIsEnabled) for row in range(tool_idx): self.ui.cnc_tools_table.item(row, 0).setFlags( - self.ui.cnc_tools_table.item(row, 0).flags() ^ QtCore.Qt.ItemIsSelectable) + self.ui.cnc_tools_table.item(row, 0).flags() ^ QtCore.Qt.ItemFlag.ItemIsSelectable) self.ui.cnc_tools_table.resizeColumnsToContents() self.ui.cnc_tools_table.resizeRowsToContents() @@ -341,11 +341,11 @@ class CNCJobObject(FlatCAMObj, CNCjob): cutz_item = QtWidgets.QTableWidgetItem('%f' % offset_val) - t_id_item.setFlags(QtCore.Qt.ItemIsEnabled) - dia_item.setFlags(QtCore.Qt.ItemIsEnabled) - nr_drills_item.setFlags(QtCore.Qt.ItemIsEnabled) - nr_slots_item.setFlags(QtCore.Qt.ItemIsEnabled) - cutz_item.setFlags(QtCore.Qt.ItemIsEnabled) + t_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + nr_drills_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + nr_slots_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + cutz_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # hack so the checkbox stay centered in the table cell # used this: @@ -359,7 +359,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): # qhboxlayout.setContentsMargins(0, 0, 0, 0) plot_item = FCCheckBox() - plot_item.setLayoutDirection(QtCore.Qt.RightToLeft) + plot_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) if self.ui.plot_cb.isChecked(): plot_item.setChecked(True) @@ -376,7 +376,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): for row in range(row_no): self.ui.exc_cnc_tools_table.item(row, 0).setFlags( - self.ui.exc_cnc_tools_table.item(row, 0).flags() ^ QtCore.Qt.ItemIsSelectable) + self.ui.exc_cnc_tools_table.item(row, 0).flags() ^ QtCore.Qt.ItemFlag.ItemIsSelectable) self.ui.exc_cnc_tools_table.resizeColumnsToContents() self.ui.exc_cnc_tools_table.resizeRowsToContents() @@ -617,7 +617,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): self.ui.treeWidget.clear() self.add_properties_items(obj=self, treeWidget=self.ui.treeWidget) - self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.MinimumExpanding) + self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.MinimumExpanding) # make sure that the FCTree widget columns are resized to content self.ui.treeWidget.resize_sig.emit() diff --git a/appObjects/FlatCAMDocument.py b/appObjects/FlatCAMDocument.py index 89cca49d..630195e4 100644 --- a/appObjects/FlatCAMDocument.py +++ b/appObjects/FlatCAMDocument.py @@ -109,11 +109,14 @@ class DocumentObject(FlatCAMObj): self.ui.sel_color_entry.editingFinished.connect(self.on_selection_color_entry) self.ui.sel_color_button.clicked.connect(self.on_selection_color_button) - self.ui.al_left_tb.clicked.connect(lambda: self.document_editor_tab.code_editor.setAlignment(Qt.AlignLeft)) - self.ui.al_center_tb.clicked.connect(lambda: self.document_editor_tab.code_editor.setAlignment(Qt.AlignCenter)) - self.ui.al_right_tb.clicked.connect(lambda: self.document_editor_tab.code_editor.setAlignment(Qt.AlignRight)) + self.ui.al_left_tb.clicked.connect( + lambda: self.document_editor_tab.code_editor.setAlignment(Qt.AlignmentFlag.AlignLeft)) + self.ui.al_center_tb.clicked.connect( + lambda: self.document_editor_tab.code_editor.setAlignment(Qt.AlignmentFlag.AlignCenter)) + self.ui.al_right_tb.clicked.connect( + lambda: self.document_editor_tab.code_editor.setAlignment(Qt.AlignmentFlag.AlignRight)) self.ui.al_justify_tb.clicked.connect( - lambda: self.document_editor_tab.code_editor.setAlignment(Qt.AlignJustify) + lambda: self.document_editor_tab.code_editor.setAlignment(Qt.AlignmentFlag.AlignJustify) ) self.ui.autocomplete_cb.stateChanged.connect(self.on_autocomplete_changed) @@ -300,8 +303,8 @@ class DocumentObject(FlatCAMObj): return p = QtGui.QPalette() - p.setColor(QtGui.QPalette.Highlight, sel_color) - p.setColor(QtGui.QPalette.HighlightedText, QtGui.QColor('white')) + p.setColor(QtGui.QPalette.ColorRole.Highlight, sel_color) + p.setColor(QtGui.QPalette.ColorRole.HighlightedText, QtGui.QColor('white')) self.document_editor_tab.code_editor.setPalette(p) diff --git a/appObjects/FlatCAMExcellon.py b/appObjects/FlatCAMExcellon.py index a72e7806..6cd38feb 100644 --- a/appObjects/FlatCAMExcellon.py +++ b/appObjects/FlatCAMExcellon.py @@ -314,29 +314,29 @@ class ExcellonObject(FlatCAMObj, Excellon): # Tool ID exc_id_item = QtWidgets.QTableWidgetItem('%d' % int(tool_no)) - exc_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + exc_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 0, exc_id_item) # Tool name/id # Diameter dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, dia_val)) - dia_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 1, dia_item) # Diameter # Drill count drill_count_item = QtWidgets.QTableWidgetItem('%d' % drill_cnt) - drill_count_item.setFlags(QtCore.Qt.ItemIsEnabled) + drill_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 2, drill_count_item) # Number of drills per tool # Slot Count # if the slot number is zero is better to not clutter the GUI with zero's so we print a space slot_count_str = '%d' % slot_cnt if slot_cnt > 0 else '' slot_count_item = QtWidgets.QTableWidgetItem(slot_count_str) - slot_count_item.setFlags(QtCore.Qt.ItemIsEnabled) + slot_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 3, slot_count_item) # Number of drills per tool # Empty Plot Item empty_plot_item = QtWidgets.QTableWidgetItem('') - empty_plot_item.setFlags(QtCore.Qt.NoItemFlags) + empty_plot_item.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) self.ui.tools_table.setItem(self.tool_row, 4, empty_plot_item) if 'multicolor' in self.tools[tool_no] and self.tools[tool_no]['multicolor'] is not None: @@ -354,7 +354,7 @@ class ExcellonObject(FlatCAMObj, Excellon): # Plot Item plot_item = FCCheckBox() - plot_item.setLayoutDirection(QtCore.Qt.RightToLeft) + plot_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) if self.ui.plot_cb.isChecked(): plot_item.setChecked(True) self.ui.tools_table.setCellWidget(self.tool_row, 5, plot_item) @@ -363,20 +363,20 @@ class ExcellonObject(FlatCAMObj, Excellon): # add a last row with the Total number of drills empty_1 = QtWidgets.QTableWidgetItem('') - empty_1.setFlags(QtCore.Qt.NoItemFlags) + empty_1.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) empty_1_1 = QtWidgets.QTableWidgetItem('') - empty_1_1.setFlags(QtCore.Qt.NoItemFlags) + empty_1_1.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) empty_1_2 = QtWidgets.QTableWidgetItem('') - empty_1_2.setFlags(QtCore.Qt.NoItemFlags) + empty_1_2.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) empty_1_3 = QtWidgets.QTableWidgetItem('') - empty_1_3.setFlags(QtCore.Qt.NoItemFlags) + empty_1_3.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) empty_1_4 = QtWidgets.QTableWidgetItem('') - empty_1_4.setFlags(QtCore.Qt.NoItemFlags) + empty_1_4.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) label_tot_drill_count = QtWidgets.QTableWidgetItem(_('Total Drills')) tot_drill_count = QtWidgets.QTableWidgetItem('%d' % self.tot_drill_cnt) - label_tot_drill_count.setFlags(QtCore.Qt.ItemIsEnabled) - tot_drill_count.setFlags(QtCore.Qt.ItemIsEnabled) + label_tot_drill_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + tot_drill_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 0, empty_1) self.ui.tools_table.setItem(self.tool_row, 1, label_tot_drill_count) @@ -397,20 +397,20 @@ class ExcellonObject(FlatCAMObj, Excellon): # add a last row with the Total number of slots empty_2 = QtWidgets.QTableWidgetItem('') - empty_2.setFlags(QtCore.Qt.NoItemFlags) + empty_2.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) empty_2_1 = QtWidgets.QTableWidgetItem('') - empty_2_1.setFlags(QtCore.Qt.NoItemFlags) + empty_2_1.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) empty_2_2 = QtWidgets.QTableWidgetItem('') - empty_2_2.setFlags(QtCore.Qt.NoItemFlags) + empty_2_2.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) empty_2_3 = QtWidgets.QTableWidgetItem('') - empty_2_3.setFlags(QtCore.Qt.NoItemFlags) + empty_2_3.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) empty_2_4 = QtWidgets.QTableWidgetItem('') - empty_2_4.setFlags(QtCore.Qt.NoItemFlags) + empty_2_4.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) label_tot_slot_count = QtWidgets.QTableWidgetItem(_('Total Slots')) tot_slot_count = QtWidgets.QTableWidgetItem('%d' % self.tot_slot_cnt) - label_tot_slot_count.setFlags(QtCore.Qt.ItemIsEnabled) - tot_slot_count.setFlags(QtCore.Qt.ItemIsEnabled) + label_tot_slot_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + tot_slot_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 0, empty_2) self.ui.tools_table.setItem(self.tool_row, 1, label_tot_slot_count) @@ -674,7 +674,7 @@ class ExcellonObject(FlatCAMObj, Excellon): self.ui.treeWidget.clear() self.add_properties_items(obj=self, treeWidget=self.ui.treeWidget) - self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.MinimumExpanding) + self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.MinimumExpanding) # make sure that the FCTree widget columns are resized to content self.ui.treeWidget.resize_sig.emit() diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py index f7469ebf..03574a7e 100644 --- a/appObjects/FlatCAMGeometry.py +++ b/appObjects/FlatCAMGeometry.py @@ -194,7 +194,7 @@ class GeometryObject(FlatCAMObj, Geometry): # -------------------- ID ------------------------------------------ # tool_id = QtWidgets.QTableWidgetItem('%d' % int(row_idx + 1)) - tool_id.setFlags(QtCore.Qt.ItemIsEnabled) + tool_id.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 0, tool_id) # Tool name/id # Make sure that the tool diameter when in MM is with no more than 2 decimals. @@ -203,7 +203,7 @@ class GeometryObject(FlatCAMObj, Geometry): # -------------------- DIAMETER ------------------------------------- # dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(tooluid_value['tooldia']))) - dia_item.setFlags(QtCore.Qt.ItemIsEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 1, dia_item) # Diameter # -------------------- OFFSET ------------------------------------- # @@ -212,7 +212,7 @@ class GeometryObject(FlatCAMObj, Geometry): except TypeError: offset_item_txt = tooluid_value['data']['tools_mill_offset_type'] offset_item = QtWidgets.QTableWidgetItem(offset_item_txt) - offset_item.setFlags(QtCore.Qt.ItemIsEnabled) + offset_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 2, offset_item) # Offset Type # -------------------- JOB ------------------------------------- # @@ -221,7 +221,7 @@ class GeometryObject(FlatCAMObj, Geometry): except TypeError: job_item_txt = tooluid_value['data']['tools_mill_job_type'] job_item = QtWidgets.QTableWidgetItem(job_item_txt) - job_item.setFlags(QtCore.Qt.ItemIsEnabled) + job_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 3, job_item) # Job Type # -------------------- TOOL SHAPE ------------------------------------- # @@ -230,7 +230,7 @@ class GeometryObject(FlatCAMObj, Geometry): except TypeError: tool_shape_item_txt = tooluid_value['data']['tools_mill_tool_shape'] tool_shape_item = QtWidgets.QTableWidgetItem(tool_shape_item_txt) - tool_shape_item.setFlags(QtCore.Qt.ItemIsEnabled) + tool_shape_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 4, tool_shape_item) # Tool Shape # -------------------- TOOL UID ------------------------------------- # @@ -240,10 +240,10 @@ class GeometryObject(FlatCAMObj, Geometry): # -------------------- PLOT ------------------------------------- # empty_plot_item = QtWidgets.QTableWidgetItem('') - empty_plot_item.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_plot_item.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 6, empty_plot_item) plot_item = FCCheckBox() - plot_item.setLayoutDirection(QtCore.Qt.RightToLeft) + plot_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) if self.ui.plot_cb.isChecked(): plot_item.setChecked(True) self.ui.geo_tools_table.setCellWidget(row_idx, 6, plot_item) @@ -252,7 +252,7 @@ class GeometryObject(FlatCAMObj, Geometry): for row in range(row_idx): self.ui.geo_tools_table.item(row, 0).setFlags( - self.ui.geo_tools_table.item(row, 0).flags() ^ QtCore.Qt.ItemIsSelectable) + self.ui.geo_tools_table.item(row, 0).flags() ^ QtCore.Qt.ItemFlag.ItemIsSelectable) self.ui.geo_tools_table.resizeColumnsToContents() self.ui.geo_tools_table.resizeRowsToContents() @@ -319,15 +319,15 @@ class GeometryObject(FlatCAMObj, Geometry): # area_dict = self.app.exc_areas.exclusion_areas_storage[area] # # area_id_item = QtWidgets.QTableWidgetItem('%d' % int(area_dict["idx"])) - # area_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # area_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # self.ui.exclusion_table.setItem(area, 0, area_id_item) # Area id # # object_item = QtWidgets.QTableWidgetItem('%s' % area_dict["obj_type"]) - # object_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # object_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # self.ui.exclusion_table.setItem(area, 1, object_item) # Origin Object # # # strategy_item = QtWidgets.QTableWidgetItem('%s' % area_dict["strategy"]) - # # strategy_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # # strategy_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # strategy_item = FCComboBox2(policy=False) # strategy_item.addItems([_("Around"), _("Over")]) # idx = 0 if area_dict["strategy"] == 'around' else 1 @@ -339,14 +339,14 @@ class GeometryObject(FlatCAMObj, Geometry): # self.ui.exclusion_table.setCellWidget(area, 2, strategy_item) # Strategy # # overz_item = QtWidgets.QTableWidgetItem('%s' % area_dict["overz"]) - # overz_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # overz_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # self.ui.exclusion_table.setItem(area, 3, overz_item) # Over Z # # # make the Overz column editable # for row in range(e_len): - # self.ui.exclusion_table.item(row, 3).setFlags(QtCore.Qt.ItemIsSelectable | - # QtCore.Qt.ItemIsEditable | - # QtCore.Qt.ItemIsEnabled) + # self.ui.exclusion_table.item(row, 3).setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | + # QtCore.Qt.ItemFlag.ItemIsEditable | + # QtCore.Qt.ItemFlag.ItemIsEnabled) # # self.ui.exclusion_table.resizeColumnsToContents() # self.ui.exclusion_table.resizeRowsToContents() @@ -680,7 +680,7 @@ class GeometryObject(FlatCAMObj, Geometry): self.ui.treeWidget.clear() self.add_properties_items(obj=self, treeWidget=self.ui.treeWidget) - self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.MinimumExpanding) + self.ui.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.MinimumExpanding) # make sure that the FCTree widget columns are resized to content self.ui.treeWidget.resize_sig.emit() diff --git a/appObjects/FlatCAMGerber.py b/appObjects/FlatCAMGerber.py index d02c33c5..b92c5b52 100644 --- a/appObjects/FlatCAMGerber.py +++ b/appObjects/FlatCAMGerber.py @@ -275,16 +275,16 @@ class GerberObject(FlatCAMObj, Gerber): # ------------------------ Aperture ID ---------------------------------------------------------------- ap_id_item = QtWidgets.QTableWidgetItem('%d' % int(self.apertures_row + 1)) - ap_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + ap_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.apertures_table.setItem(self.apertures_row, 0, ap_id_item) # Tool name/id # ------------------------ Aperture CODE -------------------------------------------------------------- ap_code_item = QtWidgets.QTableWidgetItem(str(ap_code)) - ap_code_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_code_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # ------------------------ Aperture TYPE -------------------------------------------------------------- ap_type_item = QtWidgets.QTableWidgetItem(str(self.tools[ap_code]['type'])) - ap_type_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_type_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) if str(self.tools[ap_code]['type']) == 'R' or str(self.tools[ap_code]['type']) == 'O': ap_dim_item = QtWidgets.QTableWidgetItem( @@ -292,16 +292,16 @@ class GerberObject(FlatCAMObj, Gerber): self.decimals, self.tools[ap_code]['height'] ) ) - ap_dim_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_dim_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) elif str(self.tools[ap_code]['type']) == 'P': ap_dim_item = QtWidgets.QTableWidgetItem( '%.*f, %.*f' % (self.decimals, self.tools[ap_code]['diam'], self.decimals, self.tools[ap_code]['nVertices']) ) - ap_dim_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_dim_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) else: ap_dim_item = QtWidgets.QTableWidgetItem('') - ap_dim_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_dim_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # ------------------------ Aperture SIZE -------------------------------------------------------------- try: @@ -312,11 +312,11 @@ class GerberObject(FlatCAMObj, Gerber): ap_size_item = QtWidgets.QTableWidgetItem('') except KeyError: ap_size_item = QtWidgets.QTableWidgetItem('') - ap_size_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_size_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # ------------------------ Aperture MARK -------------------------------------------------------------- mark_item = FCCheckBox() - mark_item.setLayoutDirection(QtCore.Qt.RightToLeft) + mark_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) # if self.ui.aperture_table_visibility_cb.isChecked(): # mark_item.setChecked(True) @@ -326,7 +326,7 @@ class GerberObject(FlatCAMObj, Gerber): self.ui.apertures_table.setItem(self.apertures_row, 4, ap_dim_item) # Aperture Dimensions empty_plot_item = QtWidgets.QTableWidgetItem('') - empty_plot_item.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_plot_item.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.apertures_table.setItem(self.apertures_row, 5, empty_plot_item) self.ui.apertures_table.setCellWidget(self.apertures_row, 5, mark_item) diff --git a/appObjects/ObjectCollection.py b/appObjects/ObjectCollection.py index e14c3f9a..fac867bb 100644 --- a/appObjects/ObjectCollection.py +++ b/appObjects/ObjectCollection.py @@ -11,10 +11,10 @@ # File modified by: Marius Stanciu # # ########################################################## -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.QtCore import Qt, QSettings -from PyQt5.QtGui import QColor -# from PyQt5.QtCore import QModelIndex +from PyQt6 import QtGui, QtCore, QtWidgets +from PyQt6.QtCore import Qt, QSettings +from PyQt6.QtGui import QColor +# from PyQt6.QtCore import QModelIndex from appObjects.FlatCAMObj import FlatCAMObj from appObjects.FlatCAMCNCJob import CNCJobObject @@ -53,7 +53,7 @@ class KeySensitiveListView(QtWidgets.QTreeView): # self.setRootIsDecorated(False) # self.setExpandsOnDoubleClick(False) - self.setEditTriggers(QtWidgets.QTreeView.NoEditTriggers) # No edit in the Project Tab Tree + self.setEditTriggers(QtWidgets.QTreeView.EditTrigger.NoEditTriggers) # No edit in the Project Tab Tree # Enable dragging and dropping onto the appGUI self.setAcceptDrops(True) @@ -61,7 +61,7 @@ class KeySensitiveListView(QtWidgets.QTreeView): self.app = app # Enabling Drag and Drop for the items in the Project Tab - # Example: https://github.com/d1vanov/PyQt5-reorderable-list-model/blob/master/reorderable_list_model.py + # Example: https://github.com/d1vanov/PyQt6-reorderable-list-model/blob/master/reorderable_list_model.py # https://github.com/jimmykuu/PyQt-PySide-Cookbook/blob/master/tree/drop_indicator.md # self.setDragEnabled(True) # self.viewport().setAcceptDrops(True) @@ -221,8 +221,10 @@ class TreeItem(KeySensitiveListView): self.parent_item = parent_item def __del__(self): - del self.icon - + try: + del self.icon + except AttributeError: + pass class ObjectCollection(QtCore.QAbstractItemModel): """ @@ -307,13 +309,13 @@ class ObjectCollection(QtCore.QAbstractItemModel): self.view = KeySensitiveListView(self.app) self.view.setModel(self) - self.view.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) - self.view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.view.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu) + self.view.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) if self.app.defaults["global_allow_edit_in_project_tab"] is True: - self.view.setEditTriggers(QtWidgets.QTreeView.SelectedClicked) # allow Edit on Tree + self.view.setEditTriggers(QtWidgets.QTreeView.EditTrigger.SelectedClicked) # allow Edit on Tree else: - self.view.setEditTriggers(QtWidgets.QTreeView.NoEditTriggers) + self.view.setEditTriggers(QtWidgets.QTreeView.EditTrigger.NoEditTriggers) # self.view.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove) # self.view.setDragEnabled(True) @@ -465,14 +467,14 @@ class ObjectCollection(QtCore.QAbstractItemModel): if not index.isValid(): return None - if role in [Qt.DisplayRole, Qt.EditRole]: + if role in [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole]: obj = index.internalPointer().obj if obj: return obj.options["name"] else: return index.internalPointer().data(index.column()) - if role == Qt.ForegroundRole: + if role == Qt.ItemDataRole.ForegroundRole: color = QColor(self.app.defaults['global_proj_item_color']) color_disabled = QColor(self.app.defaults['global_proj_item_dis_color']) obj = index.internalPointer().obj @@ -481,13 +483,13 @@ class ObjectCollection(QtCore.QAbstractItemModel): else: return index.internalPointer().data(index.column()) - elif role == Qt.DecorationRole: + elif role == Qt.ItemDataRole.DecorationRole: icon = index.internalPointer().icon if icon: return icon else: return QtGui.QPixmap() - elif role == Qt.ToolTipRole: + elif role == Qt.ItemDataRole.ToolTipRole: try: obj = index.internalPointer().obj except AttributeError: @@ -540,17 +542,17 @@ class ObjectCollection(QtCore.QAbstractItemModel): default_flags = QtCore.QAbstractItemModel.flags(self, index) if not index.isValid(): - return Qt.ItemIsEnabled | default_flags + return Qt.ItemFlag.ItemIsEnabled | default_flags # Prevent groups from selection try: if not index.internalPointer().obj: - return Qt.ItemIsEnabled + return Qt.ItemFlag.ItemIsEnabled else: - return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable | \ - Qt.ItemIsDragEnabled | Qt.ItemIsDropEnabled + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEditable | \ + Qt.ItemFlag.ItemIsDragEnabled | Qt.ItemFlag.ItemIsDropEnabled except AttributeError: - return Qt.ItemIsEnabled + return Qt.ItemFlag.ItemIsEnabled # return QtWidgets.QAbstractItemModel.flags(self, index) def append(self, obj, active=False, to_index=None): @@ -1113,7 +1115,7 @@ class ObjectCollection(QtCore.QAbstractItemModel): def add_act(o_name): obj_for_icon = self.get_by_name(o_name) - menu_action = QtWidgets.QAction(parent=self.app.ui.menuobjects) + menu_action = QtGui.QAction(parent=self.app.ui.menuobjects) menu_action.setCheckable(True) menu_action.setText(o_name) menu_action.setIcon(QtGui.QIcon(icon_files[obj_for_icon.kind])) @@ -1169,7 +1171,7 @@ class ObjectCollection(QtCore.QAbstractItemModel): elif state == 'rename': for act in self.app.ui.menuobjects.actions(): if act.text() == old_name: - add_action = QtWidgets.QAction(parent=self.app.ui.menuobjects) + add_action = QtGui.QAction(parent=self.app.ui.menuobjects) add_action.setText(obj.options['name']) add_action.setIcon(QtGui.QIcon(icon_files[obj.kind])) add_action.triggered.connect( diff --git a/appParsers/ParseGerber.py b/appParsers/ParseGerber.py index 3344ff5e..cc796b19 100644 --- a/appParsers/ParseGerber.py +++ b/appParsers/ParseGerber.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from camlib import Geometry, arc, arc_angle, ApertureMacro, grace import numpy as np diff --git a/appParsers/ParsePDF.py b/appParsers/ParsePDF.py index ad96b190..3450e388 100644 --- a/appParsers/ParsePDF.py +++ b/appParsers/ParsePDF.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtCore +from PyQt6 import QtCore from appCommon.Common import GracefulException as grace diff --git a/appPlugins/ToolAlignObjects.py b/appPlugins/ToolAlignObjects.py index 7f4a41b7..f703a3c0 100644 --- a/appPlugins/ToolAlignObjects.py +++ b/appPlugins/ToolAlignObjects.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCComboBox, RadioSet, FCLabel, FCButton, VerticalScrollArea @@ -450,8 +450,8 @@ class AlignUI: grid0.addWidget(self.object_combo, 4, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 5, 0, 1, 2) grid0.addWidget(FCLabel(''), 6, 0, 1, 2) @@ -486,8 +486,8 @@ class AlignUI: grid0.addWidget(self.aligner_object_combo, 9, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 10, 0, 1, 2) grid0.addWidget(QtWidgets.QLabel(''), 11, 0, 1, 2) @@ -509,8 +509,8 @@ class AlignUI: grid0.addWidget(self.a_type_radio, 13, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 14, 0, 1, 2) # Buttons diff --git a/appPlugins/ToolCalculators.py b/appPlugins/ToolCalculators.py index b8370f77..d8fe0d3e 100644 --- a/appPlugins/ToolCalculators.py +++ b/appPlugins/ToolCalculators.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtGui +from PyQt6 import QtWidgets, QtGui from appTool import AppTool from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, NumericalEvalEntry, FCLabel, RadioSet, FCButton, \ VerticalScrollArea @@ -456,12 +456,12 @@ class CalcUI: self.inch_entry = NumericalEvalEntry(border_color='#0069A9') # self.inch_entry.setFixedWidth(70) - # self.inch_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.inch_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.inch_entry.setToolTip(_("Here you enter the value to be converted from INCH to MM")) self.mm_entry = NumericalEvalEntry(border_color='#0069A9') # self.mm_entry.setFixedWidth(130) - # self.mm_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.mm_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.mm_entry.setToolTip(_("Here you enter the value to be converted from MM to INCH")) grid_units_layout.addWidget(self.mm_entry, 1, 0) @@ -578,7 +578,7 @@ class CalcUI: self.pcblengthlabel = FCLabel('%s:' % _("Board Length")) self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.')) self.pcblength_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.pcblength_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.pcblength_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.pcblength_entry.set_precision(self.decimals) self.pcblength_entry.set_range(0.0, 10000.0000) @@ -596,7 +596,7 @@ class CalcUI: self.pcbwidthlabel = FCLabel('%s:' % _("Board Width")) self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.')) self.pcbwidth_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.pcbwidth_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.pcbwidth_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.pcbwidth_entry.set_precision(self.decimals) self.pcbwidth_entry.set_range(0.0, 10000.0000) @@ -614,7 +614,7 @@ class CalcUI: self.area_label = FCLabel('%s:' % _("Area")) self.area_label.setToolTip(_('This is the board area.')) self.area_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.area_entry.set_precision(self.decimals) self.area_entry.set_range(0.0, 10000.0000) @@ -629,8 +629,8 @@ class CalcUI: grid_electro.addLayout(a_hlay, 12, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_electro.addWidget(separator_line, 14, 0, 1, 2) # DENSITY @@ -638,7 +638,7 @@ class CalcUI: self.cdensity_label.setToolTip(_("Current density to pass through the board. \n" "In Amps per Square Feet ASF.")) self.cdensity_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.cdensity_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.cdensity_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.cdensity_entry.set_precision(self.decimals) self.cdensity_entry.set_range(0.0, 10000.0000) self.cdensity_entry.setSingleStep(0.1) @@ -658,7 +658,7 @@ class CalcUI: self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n" "In microns.")) self.growth_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.growth_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.growth_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.growth_entry.set_precision(self.decimals) self.growth_entry.set_range(0.0, 10000.0000) self.growth_entry.setSingleStep(0.01) @@ -678,7 +678,7 @@ class CalcUI: self.cvaluelabel.setToolTip(_('This is the current intensity value\n' 'to be set on the Power Supply. In Amps.')) self.cvalue_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.cvalue_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.cvalue_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.cvalue_entry.set_precision(self.decimals) self.cvalue_entry.set_range(0.0, 10000.0000) self.cvalue_entry.setSingleStep(0.1) @@ -699,7 +699,7 @@ class CalcUI: self.timelabel.setToolTip(_('This is the calculated time required for the procedure.\n' 'In minutes.')) self.time_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.time_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.time_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.time_entry.set_precision(self.decimals) self.time_entry.set_range(0.0, 10000.0000) self.time_entry.setSingleStep(0.1) diff --git a/appPlugins/ToolCalibration.py b/appPlugins/ToolCalibration.py index eea144eb..4213f1bc 100644 --- a/appPlugins/ToolCalibration.py +++ b/appPlugins/ToolCalibration.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCDoubleSpinner, EvalEntry, FCCheckBox, OptionalInputSection, FCEntry, VerticalScrollArea @@ -870,8 +870,8 @@ class CalibrationUI: ) separator_line1 = QtWidgets.QFrame() - separator_line1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line1, 6, 0, 1, 3) # Second point choice @@ -889,8 +889,8 @@ class CalibrationUI: grid_lay.addWidget(self.second_point_radio, 7, 1, 1, 2) separator_line1 = QtWidgets.QFrame() - separator_line1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line1, 8, 0, 1, 3) grid_lay.addWidget(QtWidgets.QLabel(''), 9, 0, 1, 3) @@ -966,7 +966,7 @@ class CalibrationUI: # BOTTOM LEFT id_item_1 = QtWidgets.QTableWidgetItem('%d' % 1) - flags = QtCore.Qt.ItemIsEnabled + flags = QtCore.Qt.ItemFlag.ItemIsEnabled id_item_1.setFlags(flags) self.points_table.setItem(row, 0, id_item_1) # Tool name/id @@ -993,7 +993,7 @@ class CalibrationUI: # BOTTOM RIGHT id_item_2 = QtWidgets.QTableWidgetItem('%d' % 2) - flags = QtCore.Qt.ItemIsEnabled + flags = QtCore.Qt.ItemFlag.ItemIsEnabled id_item_2.setFlags(flags) self.points_table.setItem(row, 0, id_item_2) # Tool name/id @@ -1018,7 +1018,7 @@ class CalibrationUI: # TOP LEFT id_item_3 = QtWidgets.QTableWidgetItem('%d' % 3) - flags = QtCore.Qt.ItemIsEnabled + flags = QtCore.Qt.ItemFlag.ItemIsEnabled id_item_3.setFlags(flags) self.points_table.setItem(row, 0, id_item_3) # Tool name/id @@ -1042,7 +1042,7 @@ class CalibrationUI: # TOP RIGHT id_item_4 = QtWidgets.QTableWidgetItem('%d' % 4) - flags = QtCore.Qt.ItemIsEnabled + flags = QtCore.Qt.ItemFlag.ItemIsEnabled id_item_4.setFlags(flags) self.points_table.setItem(row, 0, id_item_4) # Tool name/id @@ -1105,8 +1105,8 @@ class CalibrationUI: grid_lay.addWidget(self.start_button, 17, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 18, 0, 1, 3) grid_lay.addWidget(QtWidgets.QLabel(''), 19, 0) @@ -1144,8 +1144,8 @@ class CalibrationUI: grid_lay.addWidget(self.gcode_button, 21, 0, 1, 3) separator_line1 = QtWidgets.QFrame() - separator_line1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line1, 22, 0, 1, 3) grid_lay.addWidget(QtWidgets.QLabel(''), 23, 0, 1, 3) @@ -1175,8 +1175,8 @@ class CalibrationUI: grid_lay.addWidget(self.generate_factors_button, 25, 0, 1, 3) separator_line1 = QtWidgets.QFrame() - separator_line1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line1, 26, 0, 1, 3) grid_lay.addWidget(QtWidgets.QLabel(''), 27, 0, 1, 3) @@ -1338,8 +1338,8 @@ class CalibrationUI: grid_lay.addWidget(self.adj_gcode_button, 42, 0, 1, 3) separator_line1 = QtWidgets.QFrame() - separator_line1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line1, 43, 0, 1, 3) grid_lay.addWidget(QtWidgets.QLabel(''), 44, 0, 1, 3) @@ -1396,8 +1396,8 @@ class CalibrationUI: grid_lay.addWidget(self.cal_button, 50, 0, 1, 3) separator_line2 = QtWidgets.QFrame() - separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line2, 51, 0, 1, 3) grid_lay.addWidget(QtWidgets.QLabel(''), 52, 0, 1, 3) diff --git a/appPlugins/ToolCopperThieving.py b/appPlugins/ToolCopperThieving.py index ab96155f..cadaf553 100644 --- a/appPlugins/ToolCopperThieving.py +++ b/appPlugins/ToolCopperThieving.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from camlib import grace from appTool import AppTool @@ -1307,8 +1307,8 @@ class ThievingUI: i_grid_lay.addWidget(self.grb_object_combo, 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) i_grid_lay.addWidget(separator_line, 2, 0, 1, 2) # ## Grid Layout @@ -1362,7 +1362,7 @@ class ThievingUI: self.area_entry.set_range(0.0, 10000.0000) self.area_entry.set_precision(self.decimals) self.area_entry.setSingleStep(0.1) - self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) if self.units.upper() == 'MM': units_area_label = FCLabel('%s2' % _("mm")) @@ -1438,8 +1438,8 @@ class ThievingUI: self.bbox_type_radio.hide() separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 16, 0, 1, 2) # Fill Type @@ -1602,8 +1602,8 @@ class ThievingUI: grid_lay_1.setColumnStretch(2, 0) separator_line_1 = QtWidgets.QFrame() - separator_line_1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line_1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line_1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line_1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay_1.addWidget(separator_line_1, 0, 0, 1, 3) # grid_lay_1.addWidget(FCLabel('')) @@ -1660,8 +1660,8 @@ class ThievingUI: grid_lay_1.addWidget(self.rb_button, 8, 0, 1, 3) separator_line_2 = QtWidgets.QFrame() - separator_line_2.setFrameShape(QtWidgets.QFrame.HLine) - separator_line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay_1.addWidget(separator_line_2, 10, 0, 1, 3) self.patern_mask_label = FCLabel('%s' % diff --git a/appPlugins/ToolCorners.py b/appPlugins/ToolCorners.py index 8a33b5b3..d869d286 100644 --- a/appPlugins/ToolCorners.py +++ b/appPlugins/ToolCorners.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appCommon.Common import LoudDict @@ -713,8 +713,8 @@ class CornersUI: self.layout.addWidget(self.object_combo) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.layout.addWidget(separator_line) self.points_label = FCLabel('%s' % _('Locations').upper()) @@ -744,8 +744,8 @@ class CornersUI: grid_loc.addWidget(self.br_cb, 1, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.layout.addWidget(separator_line) # Toggle ALL @@ -753,8 +753,8 @@ class CornersUI: self.layout.addWidget(self.toggle_all_cb) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.layout.addWidget(separator_line) # ## Grid Layout @@ -824,8 +824,8 @@ class CornersUI: grid_lay.addWidget(self.margin_entry, 8, 1) # separator_line_2 = QtWidgets.QFrame() - # separator_line_2.setFrameShape(QtWidgets.QFrame.HLine) - # separator_line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + # separator_line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + # separator_line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) # grid_lay.addWidget(separator_line_2, 10, 0, 1, 2) # ## Insert Corner Marker @@ -843,8 +843,8 @@ class CornersUI: grid_lay.addWidget(self.add_marker_button, 12, 0, 1, 2) separator_line_2 = QtWidgets.QFrame() - separator_line_2.setFrameShape(QtWidgets.QFrame.HLine) - separator_line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line_2, 14, 0, 1, 2) # Drill is corners @@ -879,8 +879,8 @@ class CornersUI: grid_lay.addWidget(self.drill_button, 20, 0, 1, 2) self.separator_line_2 = QtWidgets.QFrame() - self.separator_line_2.setFrameShape(QtWidgets.QFrame.HLine) - self.separator_line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.separator_line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.separator_line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(self.separator_line_2, 22, 0, 1, 2) # Check is corners diff --git a/appPlugins/ToolCutOut.py b/appPlugins/ToolCutOut.py index e146b981..40ec27c3 100644 --- a/appPlugins/ToolCutOut.py +++ b/appPlugins/ToolCutOut.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtGui, QtCore +from PyQt6 import QtWidgets, QtGui, QtCore from appTool import AppTool from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox, OptionalInputSection, FCButton, \ FCLabel, VerticalScrollArea @@ -2071,16 +2071,16 @@ class CutOut(AppTool): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier.ShiftModifier pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) # events from Vispy are of type KeyEvent @@ -2088,7 +2088,7 @@ class CutOut(AppTool): key = event.key # Escape = Deselect All - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': if self.mouse_events_connected is True: self.mouse_events_connected = False if self.app.is_legacy is False: @@ -2117,11 +2117,11 @@ class CutOut(AppTool): self.app.geo_editor.tool_shape.enabled = False # Grid toggle - if key == QtCore.Qt.Key_G or key == 'G': + if key == QtCore.Qt.Key.Key_G or key == 'G': self.app.ui.grid_snap_btn.trigger() # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': l_x, l_y = self.app.on_jump_to() self.app.geo_editor.tool_shape.clear(update=True) geo = self.cutting_geo(pos=(l_x, l_y)) @@ -2325,7 +2325,7 @@ class CutoutUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -2398,8 +2398,8 @@ class CutoutUI: grid0.addWidget(self.convex_box_cb, 8, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 10, 0, 1, 2) self.tool_sel_label = FCLabel('%s' % _('Cutout Tool')) @@ -2446,8 +2446,8 @@ class CutoutUI: grid0.addLayout(hlay, 16, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 18, 0, 1, 2) self.param_label = FCLabel('%s:' % _("Tool Parameters")) @@ -2580,8 +2580,8 @@ class CutoutUI: grid0.addWidget(self.mb_spacing_entry, 36, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 38, 0, 1, 2) # ############################################################################################################## @@ -2671,8 +2671,8 @@ class CutoutUI: grid0.addWidget(self.rect_cutout_object_btn, 46, 0, 1, 2) # separator_line = QtWidgets.QFrame() - # separator_line.setFrameShape(QtWidgets.QFrame.HLine) - # separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + # separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) # grid0.addWidget(separator_line, 48, 0, 1, 2) # # MANUAL BRIDGE GAPS @@ -2744,8 +2744,8 @@ class CutoutUI: grid0.addWidget(self.man_gaps_creation_btn, 58, 0, 1, 2) self.tool_param_separator_line = QtWidgets.QFrame() - self.tool_param_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.tool_param_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.tool_param_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.tool_param_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.tool_param_separator_line, 60, 0, 1, 2) # grid0.addWidget(FCLabel(""), 62, 0, 1, 2) diff --git a/appPlugins/ToolDblSided.py b/appPlugins/ToolDblSided.py index c8710cb5..6d8243d9 100644 --- a/appPlugins/ToolDblSided.py +++ b/appPlugins/ToolDblSided.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCButton, FCComboBox, NumericalEvalTupleEntry, FCLabel, \ @@ -677,7 +677,7 @@ class DsidedUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -717,8 +717,8 @@ class DsidedUI: grid_lay.addWidget(self.object_combo, 4, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 7, 0, 1, 2) # ############################################################################################################# @@ -823,8 +823,8 @@ class DsidedUI: grid0.addWidget(self.calculate_bb_button, 13, 0, 1, 2) self.bounds_separator_line = QtWidgets.QFrame() - self.bounds_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.bounds_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.bounds_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.bounds_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.bounds_separator_line, 14, 0, 1, 2) # ############################################################################################################# @@ -977,8 +977,8 @@ class DsidedUI: grid1.addWidget(self.mirror_button, 16, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid1.addWidget(separator_line, 18, 0, 1, 3) # ############################################################################################################# diff --git a/appPlugins/ToolDistance.py b/appPlugins/ToolDistance.py index 890df924..45f22993 100644 --- a/appPlugins/ToolDistance.py +++ b/appPlugins/ToolDistance.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appTool import AppTool from appGUI.VisPyVisuals import * @@ -598,8 +598,8 @@ class DistUI: grid0.addWidget(self.snap_center_cb, 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 2, 0, 1, 2) self.start_label = FCLabel("%s:" % _('Start Coords')) @@ -607,7 +607,7 @@ class DistUI: self.start_entry = FCEntry() self.start_entry.setReadOnly(True) - self.start_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.start_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.start_entry.setToolTip(_("This is measuring Start point coordinates.")) grid0.addWidget(self.start_label, 3, 0) @@ -618,7 +618,7 @@ class DistUI: self.stop_entry = FCEntry() self.stop_entry.setReadOnly(True) - self.stop_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.stop_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.stop_entry.setToolTip(_("This is the measuring Stop point coordinates.")) grid0.addWidget(self.stop_label, 4, 0) @@ -629,7 +629,7 @@ class DistUI: self.distance_x_entry = FCEntry() self.distance_x_entry.setReadOnly(True) - self.distance_x_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.distance_x_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.distance_x_entry.setToolTip(_("This is the distance measured over the X axis.")) grid0.addWidget(self.distance_x_label, 5, 0) @@ -640,7 +640,7 @@ class DistUI: self.distance_y_entry = FCEntry() self.distance_y_entry.setReadOnly(True) - self.distance_y_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.distance_y_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.distance_y_entry.setToolTip(_("This is the distance measured over the Y axis.")) grid0.addWidget(self.distance_y_label, 6, 0) @@ -651,7 +651,7 @@ class DistUI: self.angle_entry = FCEntry() self.angle_entry.setReadOnly(True) - self.angle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.angle_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.angle_entry.setToolTip(_("This is orientation angle of the measuring line.")) grid0.addWidget(self.angle_label, 7, 0) @@ -662,7 +662,7 @@ class DistUI: self.total_distance_entry = FCEntry() self.total_distance_entry.setReadOnly(True) - self.total_distance_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.total_distance_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.total_distance_entry.setToolTip(_("This is the point to point Euclidian distance.")) grid0.addWidget(self.total_distance_label, 8, 0) diff --git a/appPlugins/ToolDistanceMin.py b/appPlugins/ToolDistanceMin.py index 7cbc4a26..b1d7408c 100644 --- a/appPlugins/ToolDistanceMin.py +++ b/appPlugins/ToolDistanceMin.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appTool import AppTool from appGUI.GUIElements import FCEntry, FCLabel, FCButton, VerticalScrollArea @@ -274,7 +274,7 @@ class DistMinUI: self.start_entry = FCEntry() self.start_entry.setReadOnly(True) - self.start_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.start_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.start_entry.setToolTip(_("This is first object point coordinates.\n" "This is the start point for measuring distance.")) @@ -288,7 +288,7 @@ class DistMinUI: self.stop_entry = FCEntry() self.stop_entry.setReadOnly(True) - self.stop_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.stop_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.stop_entry.setToolTip(_("This is second object point coordinates.\n" "This is the end point for measuring distance.")) @@ -301,7 +301,7 @@ class DistMinUI: self.distance_x_entry = FCEntry() self.distance_x_entry.setReadOnly(True) - self.distance_x_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.distance_x_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.distance_x_entry.setToolTip(_("This is the distance measured over the X axis.")) grid0.addWidget(self.distance_x_label, 6, 0) @@ -313,7 +313,7 @@ class DistMinUI: self.distance_y_entry = FCEntry() self.distance_y_entry.setReadOnly(True) - self.distance_y_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.distance_y_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.distance_y_entry.setToolTip(_("This is the distance measured over the Y axis.")) grid0.addWidget(self.distance_y_label, 8, 0) @@ -325,7 +325,7 @@ class DistMinUI: self.angle_entry = FCEntry() self.angle_entry.setReadOnly(True) - self.angle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.angle_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.angle_entry.setToolTip(_("This is orientation angle of the measuring line.")) grid0.addWidget(self.angle_label, 10, 0) @@ -337,7 +337,7 @@ class DistMinUI: self.total_distance_entry = FCEntry() self.total_distance_entry.setReadOnly(True) - self.total_distance_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.total_distance_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.total_distance_entry.setToolTip(_("This is the point to point Euclidean distance.")) grid0.addWidget(self.total_distance_label, 12, 0) @@ -349,7 +349,7 @@ class DistMinUI: self.half_point_entry = FCEntry() self.half_point_entry.setReadOnly(True) - self.half_point_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.half_point_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.half_point_entry.setToolTip(_("This is the middle point of the point to point Euclidean distance.")) grid0.addWidget(self.half_point_label, 14, 0) diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py index 1a4c0386..cbbbd893 100644 --- a/appPlugins/ToolDrilling.py +++ b/appPlugins/ToolDrilling.py @@ -5,7 +5,7 @@ # License: MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, \ @@ -440,7 +440,7 @@ class ToolDrilling(AppTool, Excellon): # add tooltips for it in range(self.ui.pp_excellon_name_cb.count()): - self.ui.pp_excellon_name_cb.setItemData(it, self.ui.pp_excellon_name_cb.itemText(it), QtCore.Qt.ToolTipRole) + self.ui.pp_excellon_name_cb.setItemData(it, self.ui.pp_excellon_name_cb.itemText(it), QtCore.Qt.ItemDataRole.ToolTipRole) self.ui.order_radio.set_value(self.app.defaults["tools_drill_tool_order"]) @@ -726,17 +726,17 @@ class ToolDrilling(AppTool, Excellon): # Tool name/id exc_id_item = QtWidgets.QTableWidgetItem('%d' % int(tool_no)) - exc_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsDragEnabled) + exc_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsDragEnabled) self.ui.tools_table.setItem(self.tool_row, 0, exc_id_item) # Tool Diameter dia_item = QtWidgets.QTableWidgetItem(str(self.dec_format(self.excellon_tools[tool_no]['tooldia']))) - dia_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsDragEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsDragEnabled) self.ui.tools_table.setItem(self.tool_row, 1, dia_item) # Number of drills per tool drill_count_item = QtWidgets.QTableWidgetItem('%d' % drill_cnt) - drill_count_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsDragEnabled) + drill_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsDragEnabled) self.ui.tools_table.setItem(self.tool_row, 2, drill_count_item) # Tool unique ID @@ -748,22 +748,22 @@ class ToolDrilling(AppTool, Excellon): # if the slot number is zero is better to not clutter the GUI with zero's so we print a space slot_count_str = '%d' % slot_cnt if slot_cnt > 0 else '' slot_count_item = QtWidgets.QTableWidgetItem(slot_count_str) - slot_count_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsDragEnabled) + slot_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsDragEnabled) self.ui.tools_table.setItem(self.tool_row, 4, slot_count_item) self.tool_row += 1 # add a last row with the Total number of drills empty_1 = QtWidgets.QTableWidgetItem('') - empty_1.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_1.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) empty_1_1 = QtWidgets.QTableWidgetItem('') - empty_1_1.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_1_1.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) label_tot_drill_count = QtWidgets.QTableWidgetItem(_('Total Drills')) - label_tot_drill_count.setFlags(QtCore.Qt.ItemIsEnabled) + label_tot_drill_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) tot_drill_count = QtWidgets.QTableWidgetItem('%d' % tot_drill_cnt) - tot_drill_count.setFlags(QtCore.Qt.ItemIsEnabled) + tot_drill_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 0, empty_1) self.ui.tools_table.setItem(self.tool_row, 1, label_tot_drill_count) @@ -782,14 +782,14 @@ class ToolDrilling(AppTool, Excellon): # add a last row with the Total number of slots empty_2 = QtWidgets.QTableWidgetItem('') - empty_2.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_2.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) empty_2_1 = QtWidgets.QTableWidgetItem('') - empty_2_1.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_2_1.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) label_tot_slot_count = QtWidgets.QTableWidgetItem(_('Total Slots')) tot_slot_count = QtWidgets.QTableWidgetItem('%d' % tot_slot_cnt) - label_tot_slot_count.setFlags(QtCore.Qt.ItemIsEnabled) - tot_slot_count.setFlags(QtCore.Qt.ItemIsEnabled) + label_tot_slot_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + tot_slot_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 0, empty_2) self.ui.tools_table.setItem(self.tool_row, 1, label_tot_slot_count) @@ -803,7 +803,7 @@ class ToolDrilling(AppTool, Excellon): # make the diameter column editable # for row in range(self.ui.tools_table.rowCount() - 2): # self.ui.tools_table.item(row, 1).setFlags( - # QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.resizeColumnsToContents() self.ui.tools_table.resizeRowsToContents() @@ -848,15 +848,15 @@ class ToolDrilling(AppTool, Excellon): area_dict = self.app.exc_areas.exclusion_areas_storage[area] area_id_item = QtWidgets.QTableWidgetItem('%d' % int(area_id)) - area_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + area_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exclusion_table.setItem(area, 0, area_id_item) # Area id object_item = QtWidgets.QTableWidgetItem('%s' % area_dict["obj_type"]) - object_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + object_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exclusion_table.setItem(area, 1, object_item) # Origin Object # strategy_item = QtWidgets.QTableWidgetItem('%s' % area_dict["strategy"]) - # strategy_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + # strategy_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) strategy_item = FCComboBox2(policy=False) strategy_item.addItems([_("Around"), _("Over")]) idx = 0 if area_dict["strategy"] == 'around' else 1 @@ -868,14 +868,14 @@ class ToolDrilling(AppTool, Excellon): self.ui.exclusion_table.setCellWidget(area, 2, strategy_item) # Strategy overz_item = QtWidgets.QTableWidgetItem('%s' % area_dict["overz"]) - overz_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + overz_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exclusion_table.setItem(area, 3, overz_item) # Over Z # make the Overz column editable for row in range(e_len): - self.ui.exclusion_table.item(row, 3).setFlags(QtCore.Qt.ItemIsSelectable | - QtCore.Qt.ItemIsEditable | - QtCore.Qt.ItemIsEnabled) + self.ui.exclusion_table.item(row, 3).setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | + QtCore.Qt.ItemFlag.ItemIsEditable | + QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exclusion_table.resizeColumnsToContents() self.ui.exclusion_table.resizeRowsToContents() @@ -1604,16 +1604,16 @@ class ToolDrilling(AppTool, Excellon): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier. pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) @@ -1621,7 +1621,7 @@ class ToolDrilling(AppTool, Excellon): else: key = event.key - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': self.points = [] self.poly_drawn = False self.delete_moving_selection_shape() @@ -2287,7 +2287,7 @@ class DrillingUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -2316,8 +2316,8 @@ class DrillingUI: grid0.addWidget(self.object_combo, 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 2, 0, 1, 2) # ################################################ @@ -2373,8 +2373,8 @@ class DrillingUI: grid0.addWidget(self.search_load_db_btn, 5, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 6, 0, 1, 2) # ########################################################### @@ -2617,8 +2617,8 @@ class DrillingUI: self.exc_tools_box.addLayout(self.grid3) self.all_param_separator_line2 = QtWidgets.QFrame() - self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(self.all_param_separator_line2, 0, 0, 1, 2) self.apply_param_to_all = FCButton(_("Apply parameters to all tools")) @@ -2630,8 +2630,8 @@ class DrillingUI: self.grid3.addWidget(self.apply_param_to_all, 1, 0, 1, 2) separator_line2 = QtWidgets.QFrame() - separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(separator_line2, 2, 0, 1, 2) # General Parameters @@ -2768,7 +2768,7 @@ class DrillingUI: "Gcode output for Excellon Objects.") ) self.pp_excellon_name_cb = FCComboBox() - self.pp_excellon_name_cb.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pp_excellon_name_cb.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.pp_excellon_name_cb.setObjectName("e_pp") self.grid3.addWidget(pp_excellon_label, 15, 0) @@ -2881,8 +2881,8 @@ class DrillingUI: # ------------------------------------------------------------------------------------------------------------ separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(separator_line, 25, 0, 1, 2) # ################################################################# diff --git a/appPlugins/ToolEtchCompensation.py b/appPlugins/ToolEtchCompensation.py index 28e2cdcc..a21ccc5b 100644 --- a/appPlugins/ToolEtchCompensation.py +++ b/appPlugins/ToolEtchCompensation.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox, NumericalEvalEntry, FCEntry, \ @@ -351,8 +351,8 @@ class EtchUI: grid0.addWidget(self.gerber_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 3, 0, 1, 2) self.util_label = QtWidgets.QLabel("%s:" % _("Utilities")) @@ -403,8 +403,8 @@ class EtchUI: grid0.addLayout(hlay_2, 8, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 9, 0, 1, 2) self.param_label = QtWidgets.QLabel("%s:" % _("Parameters")) @@ -486,8 +486,8 @@ class EtchUI: self.offset_entry.hide() separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 22, 0, 1, 2) self.compensate_btn = FCButton(_('Compensate')) diff --git a/appPlugins/ToolExtract.py b/appPlugins/ToolExtract.py index 9a465123..c10b5848 100644 --- a/appPlugins/ToolExtract.py +++ b/appPlugins/ToolExtract.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox, FCLabel, FCTable, VerticalScrollArea @@ -277,11 +277,11 @@ class ToolExtract(AppTool): # Aperture CODE ap_code_item = QtWidgets.QTableWidgetItem(str(ap_code)) - ap_code_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + ap_code_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # Aperture TYPE ap_type_item = QtWidgets.QTableWidgetItem(str(ap_type)) - ap_type_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_type_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # Aperture SIZE try: @@ -292,15 +292,15 @@ class ToolExtract(AppTool): ap_size_item = QtWidgets.QTableWidgetItem('') except KeyError: ap_size_item = QtWidgets.QTableWidgetItem('') - ap_size_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_size_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # Aperture MARK Item mark_item = FCCheckBox() - mark_item.setLayoutDirection(QtCore.Qt.RightToLeft) + mark_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) # Empty PLOT ITEM empty_plot_item = QtWidgets.QTableWidgetItem('') - empty_plot_item.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - empty_plot_item.setFlags(QtCore.Qt.ItemIsEnabled) + empty_plot_item.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + empty_plot_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.apertures_table.setItem(row, 0, ap_code_item) # Aperture Code self.ui.apertures_table.setItem(row, 1, ap_type_item) # Aperture Type @@ -1020,13 +1020,13 @@ class ExtractUI: self.apertures_table.horizontalHeaderItem(3).setToolTip( _("Mark the aperture instances on canvas.")) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.apertures_table.setSizePolicy(sizePolicy) self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 20, 0, 1, 2) # ## Grid Layout @@ -1065,8 +1065,8 @@ class ExtractUI: # grid_lay1.addWidget(FCLabel('')) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid1.addWidget(separator_line, 5, 0, 1, 2) self.ring_frame = QtWidgets.QFrame() @@ -1199,8 +1199,8 @@ class ExtractUI: grid3.addWidget(self.factor_entry, 8, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid3.addWidget(separator_line, 10, 0, 1, 2) # Extract drills from Gerber apertures flashes (pads) @@ -1218,8 +1218,8 @@ class ExtractUI: grid3.addWidget(self.e_drills_button, 12, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid3.addWidget(separator_line, 14, 0, 1, 2) # grid3.addWidget(FCLabel(""), 16, 0, 1, 2) @@ -1245,8 +1245,8 @@ class ExtractUI: grid3.addWidget(self.clearance_entry, 20, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid3.addWidget(separator_line, 22, 0, 1, 2) # Extract solderemask from Gerber apertures flashes (pads) @@ -1264,8 +1264,8 @@ class ExtractUI: grid3.addWidget(self.e_sm_button, 24, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid3.addWidget(separator_line, 25, 0, 1, 2) # EXTRACT CUTOUT @@ -1303,8 +1303,8 @@ class ExtractUI: grid3.addWidget(self.thick_cut_entry, 30, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid3.addWidget(separator_line, 32, 0, 1, 2) # Extract cutout from Gerber apertures flashes (pads) diff --git a/appPlugins/ToolFiducials.py b/appPlugins/ToolFiducials.py index 4668c074..2b112f8c 100644 --- a/appPlugins/ToolFiducials.py +++ b/appPlugins/ToolFiducials.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox, FCButton, FCLabel, \ @@ -234,12 +234,12 @@ class ToolFiducials(AppTool): def on_second_point(self, val): if val == 'no': - self.ui.id_item_3.setFlags(QtCore.Qt.NoItemFlags) - self.ui.sec_point_coords_lbl.setFlags(QtCore.Qt.NoItemFlags) + self.ui.id_item_3.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) + self.ui.sec_point_coords_lbl.setFlags(QtCore.Qt.ItemFlag.NoItemFlags) self.ui.sec_points_coords_entry.setDisabled(True) else: - self.ui.id_item_3.setFlags(QtCore.Qt.ItemIsEnabled) - self.ui.sec_point_coords_lbl.setFlags(QtCore.Qt.ItemIsEnabled) + self.ui.id_item_3.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + self.ui.sec_point_coords_lbl.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.sec_points_coords_entry.setDisabled(False) def on_method_change(self, val): @@ -824,7 +824,7 @@ class FidoUI: ) self.points_table.setRowCount(3) row = 0 - flags = QtCore.Qt.ItemIsEnabled + flags = QtCore.Qt.ItemFlag.ItemIsEnabled # BOTTOM LEFT id_item_1 = QtWidgets.QTableWidgetItem('%d' % 1) @@ -890,8 +890,8 @@ class FidoUI: self.layout.addWidget(self.points_table) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.layout.addWidget(separator_line) # ## Grid Layout @@ -965,8 +965,8 @@ class FidoUI: grid_lay.addWidget(self.pos_radio, 4, 1) self.separator_line = QtWidgets.QFrame() - self.separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(self.separator_line, 5, 0, 1, 2) # Fiducial type # @@ -999,8 +999,8 @@ class FidoUI: grid_lay.addWidget(self.line_thickness_entry, 7, 1) separator_line_1 = QtWidgets.QFrame() - separator_line_1.setFrameShape(QtWidgets.QFrame.HLine) - separator_line_1.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line_1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line_1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line_1, 8, 0, 1, 2) # Copper Gerber object @@ -1033,8 +1033,8 @@ class FidoUI: grid_lay.addWidget(self.add_cfid_button, 11, 0, 1, 2) separator_line_2 = QtWidgets.QFrame() - separator_line_2.setFrameShape(QtWidgets.QFrame.HLine) - separator_line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line_2, 12, 0, 1, 2) # Soldermask Gerber object # diff --git a/appPlugins/ToolFilm.py b/appPlugins/ToolFilm.py index cd78285f..943d42c6 100644 --- a/appPlugins/ToolFilm.py +++ b/appPlugins/ToolFilm.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtCore, QtWidgets, QtGui +from PyQt6 import QtCore, QtWidgets, QtGui from appTool import AppTool from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, \ @@ -1169,7 +1169,7 @@ class FilmUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -1226,8 +1226,8 @@ class FilmUI: grid0.addWidget(self.tf_box_combo, 6, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 8, 0, 1, 2) self.film_adj_label = FCLabel('%s' % _("Film Adjustments")) @@ -1298,8 +1298,8 @@ class FilmUI: ]) self.scale_separator_line = QtWidgets.QFrame() - self.scale_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.scale_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.scale_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.scale_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.scale_separator_line, 20, 0, 1, 2) # Skew Geometry @@ -1342,8 +1342,8 @@ class FilmUI: ]) self.skew_separator_line1 = QtWidgets.QFrame() - self.skew_separator_line1.setFrameShape(QtWidgets.QFrame.HLine) - self.skew_separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken) + self.skew_separator_line1.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.skew_separator_line1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.skew_separator_line1, 28, 0, 1, 2) # Mirror Geometry @@ -1375,8 +1375,8 @@ class FilmUI: ]) self.mirror_separator_line2 = QtWidgets.QFrame() - self.mirror_separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - self.mirror_separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.mirror_separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.mirror_separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.mirror_separator_line2, 34, 0, 1, 2) self.film_param_label = FCLabel('%s' % _("Film Parameters")) @@ -1504,8 +1504,8 @@ class FilmUI: self.grid1.setColumnStretch(1, 1) separator_line3 = QtWidgets.QFrame() - separator_line3.setFrameShape(QtWidgets.QFrame.HLine) - separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line3.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid1.addWidget(separator_line3, 0, 0, 1, 2) # File type diff --git a/appPlugins/ToolFollow.py b/appPlugins/ToolFollow.py index ebda7036..8fac5a68 100644 --- a/appPlugins/ToolFollow.py +++ b/appPlugins/ToolFollow.py @@ -5,7 +5,7 @@ # License: MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import RadioSet, FCButton, FCComboBox, FCLabel, VerticalScrollArea @@ -619,16 +619,16 @@ class ToolFollow(AppTool, Gerber): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier. pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) @@ -636,7 +636,7 @@ class ToolFollow(AppTool, Gerber): else: key = event.key - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': if self.area_sel_disconnect_flag is True: try: if self.app.is_legacy is False: @@ -730,8 +730,8 @@ class FollowUI: self.tools_box.addWidget(self.object_combo) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.tools_box.addWidget(separator_line) grid0 = QtWidgets.QGridLayout() @@ -773,8 +773,8 @@ class FollowUI: self.area_shape_radio.hide() self.separator_line = QtWidgets.QFrame() - self.separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.separator_line, 6, 0, 1, 2) self.generate_geometry_button = FCButton("%s" % _("Generate Geometry")) diff --git a/appPlugins/ToolImage.py b/appPlugins/ToolImage.py index ae3c642d..b25b6dcc 100644 --- a/appPlugins/ToolImage.py +++ b/appPlugins/ToolImage.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtGui, QtWidgets +from PyQt6 import QtGui, QtWidgets from appTool import AppTool from appGUI.GUIElements import RadioSet, FCComboBox, FCSpinner, FCLabel, VerticalScrollArea diff --git a/appPlugins/ToolInvertGerber.py b/appPlugins/ToolInvertGerber.py index 4b677b73..2575be8a 100644 --- a/appPlugins/ToolInvertGerber.py +++ b/appPlugins/ToolInvertGerber.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox, FCLabel, VerticalScrollArea @@ -260,8 +260,8 @@ class InvertUI: grid0.addWidget(self.gerber_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 3, 0, 1, 2) self.param_label = FCLabel("%s:" % _("Parameters")) @@ -301,8 +301,8 @@ class InvertUI: grid0.addWidget(self.join_radio, 8, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 9, 0, 1, 2) self.invert_btn = FCButton(_('Invert Gerber')) diff --git a/appPlugins/ToolIsolation.py b/appPlugins/ToolIsolation.py index a4c8172d..20c35ce2 100644 --- a/appPlugins/ToolIsolation.py +++ b/appPlugins/ToolIsolation.py @@ -5,7 +5,7 @@ # License: MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, \ @@ -579,14 +579,14 @@ class ToolIsolation(AppTool, Gerber): # Tool name/id id_ = QtWidgets.QTableWidgetItem('%d' % int(tool_id)) - id_.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + id_.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) row_no = tool_id - 1 self.ui.tools_table.setItem(row_no, 0, id_) # Diameter truncated_dia = self.app.dec_format(tooluid_value['tooldia'], self.decimals) dia = QtWidgets.QTableWidgetItem(str(truncated_dia)) - dia.setFlags(QtCore.Qt.ItemIsEnabled) + dia.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(row_no, 1, dia) # Tool Type @@ -604,7 +604,7 @@ class ToolIsolation(AppTool, Gerber): # make the diameter column editable for row in range(tool_id): self.ui.tools_table.item(row, 1).setFlags( - QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + QtCore.Qt.ItemFlag.ItemIsEditable | QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # all the tools are selected by default self.ui.tools_table.selectColumn(0) @@ -2731,16 +2731,16 @@ class ToolIsolation(AppTool, Gerber): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier. pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) @@ -2748,7 +2748,7 @@ class ToolIsolation(AppTool, Gerber): else: key = event.key - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': if self.area_sel_disconnect_flag is True: if self.app.is_legacy is False: @@ -3217,8 +3217,8 @@ class IsoUI: self.tools_box.addWidget(self.object_combo) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.tools_box.addWidget(separator_line) # ### Tools ## ## @@ -3280,8 +3280,8 @@ class IsoUI: grid1.addWidget(self.order_radio, 1, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid1.addWidget(separator_line, 2, 0, 1, 2) # ############################################################# @@ -3363,14 +3363,14 @@ class IsoUI: _("Delete a selection of tools in the Tool Table\n" "by first selecting a row in the Tool Table.") ) - self.deltool_btn.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.deltool_btn.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) button_grid.addWidget(self.deltool_btn, 0, 1, 2, 1) # ############################################################################################################# self.add_tool_separator_line = QtWidgets.QFrame() - self.add_tool_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.add_tool_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.add_tool_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.add_tool_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(self.add_tool_separator_line, 11, 0, 1, 2) self.tool_data_label = FCLabel( @@ -3452,8 +3452,8 @@ class IsoUI: self.grid3.addWidget(self.iso_type_radio, 17, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(separator_line, 18, 0, 1, 2) self.apply_param_to_all = FCButton(_("Apply parameters to all tools")) @@ -3465,8 +3465,8 @@ class IsoUI: self.grid3.addWidget(self.apply_param_to_all, 22, 0, 1, 2) self.all_param_separator_line2 = QtWidgets.QFrame() - self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(self.all_param_separator_line2, 23, 0, 1, 2) # General Parameters @@ -3645,8 +3645,8 @@ class IsoUI: self.area_shape_radio.hide() separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(separator_line, 44, 0, 1, 2) self.generate_iso_button = FCButton("%s" % _("Generate Geometry")) diff --git a/appPlugins/ToolLevelling.py b/appPlugins/ToolLevelling.py index c6ad9fbc..04d98e6f 100644 --- a/appPlugins/ToolLevelling.py +++ b/appPlugins/ToolLevelling.py @@ -5,8 +5,8 @@ # License: MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui -from PyQt5.QtCore import Qt +from PyQt6 import QtWidgets, QtCore, QtGui +from PyQt6.QtCore import Qt from appObjects.FlatCAMObj import ObjectDeleted from appTool import AppTool @@ -447,9 +447,9 @@ class ToolLevelling(AppTool, CNCjob): height = self.app.dec_format(value['height'], dec=self.app.decimals) height_item = QtWidgets.QTableWidgetItem(str(height)) - t_id.setFlags(QtCore.Qt.ItemIsEnabled) - coords_item.setFlags(QtCore.Qt.ItemIsEnabled) - height_item.setFlags(QtCore.Qt.ItemIsEnabled) + t_id.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + coords_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + height_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.al_probe_points_table.setItem(row_no, 0, t_id) # Tool name/id self.ui.al_probe_points_table.setItem(row_no, 1, coords_item) # X-Y coords @@ -919,16 +919,16 @@ class ToolLevelling(AppTool, CNCjob): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier. pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) # events from Vispy are of type KeyEvent @@ -936,7 +936,7 @@ class ToolLevelling(AppTool, CNCjob): key = event.key # Escape = Deselect All - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': if self.mouse_events_connected is True: self.mouse_events_connected = False if self.app.is_legacy is False: @@ -954,11 +954,11 @@ class ToolLevelling(AppTool, CNCjob): self.app.defaults['global_selection_shape'] = self.old_selection_state # Grid toggle - if key == QtCore.Qt.Key_G or key == 'G': + if key == QtCore.Qt.Key.Key_G or key == 'G': self.app.ui.grid_snap_btn.trigger() # Jump to coords - if key == QtCore.Qt.Key_J or key == 'J': + if key == QtCore.Qt.Key.Key_J or key == 'J': self.app.on_jump_to() def autolevell_gcode(self): @@ -1760,7 +1760,7 @@ class LevelUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -1783,8 +1783,8 @@ class LevelUI: self.tools_box.addWidget(self.object_combo) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.tools_box.addWidget(separator_line) # Autolevelling @@ -1811,7 +1811,7 @@ class LevelUI: hor_lay = QtWidgets.QHBoxLayout() hor_lay.addWidget(self.al_title) hor_lay.addStretch() - hor_lay.addWidget(self.show_al_table, alignment=QtCore.Qt.AlignRight) + hor_lay.addWidget(self.show_al_table, alignment=QtCore.Qt.AlignmentFlag.AlignRight) grid0.addLayout(hor_lay, 0, 0, 1, 2) @@ -1831,8 +1831,8 @@ class LevelUI: grid0.addWidget(self.plot_probing_pts_cb, 3, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 5, 0, 1, 2) # ############################################################################################################# @@ -1885,8 +1885,8 @@ class LevelUI: grid0.addWidget(self.feedrate_probe_entry, 13, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 15, 0, 1, 2) # AUTOLEVELL MODE @@ -1947,8 +1947,8 @@ class LevelUI: grid0.addWidget(self.al_add_button, 23, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 25, 0, 1, 2) self.al_controller_label = FCLabel('%s:' % _("Controller")) @@ -2157,7 +2157,7 @@ class LevelUI: grbl_ctrl_grid.addWidget(self.zero_axs_wdg, 2, 2) self.pause_resume_button = RotatedToolButton() - self.pause_resume_button.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.pause_resume_button.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) self.pause_resume_button.setText(_("Pause/Resume")) self.pause_resume_button.setCheckable(True) self.pause_resume_button.setStyleSheet(""" @@ -2171,7 +2171,7 @@ class LevelUI: pause_frame = QtWidgets.QFrame() pause_frame.setContentsMargins(0, 0, 0, 0) - pause_frame.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Expanding) + pause_frame.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Expanding) pause_hlay = QtWidgets.QHBoxLayout() pause_hlay.setContentsMargins(0, 0, 0, 0) @@ -2275,7 +2275,7 @@ class LevelUI: self.grbl_save_height_map_button.setToolTip( _("Will save the GRBL height map.") ) - hm_lay.addWidget(self.grbl_save_height_map_button, stretch=0, alignment=Qt.AlignRight) + hm_lay.addWidget(self.grbl_save_height_map_button, stretch=0, alignment=Qt.AlignmentFlag.AlignRight) grbl_send_grid.addLayout(hm_lay, 12, 0, 1, 2) @@ -2287,12 +2287,12 @@ class LevelUI: self.h_gcode_button.setToolTip( _("Will save the probing GCode.") ) - self.h_gcode_button.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding) + self.h_gcode_button.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding) height_lay.addWidget(self.h_gcode_button) self.view_h_gcode_button = QtWidgets.QToolButton() self.view_h_gcode_button.setIcon(QtGui.QIcon(self.app.resource_location + '/edit_file32.png')) - # self.view_h_gcode_button.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored) + # self.view_h_gcode_button.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Ignored) self.view_h_gcode_button.setToolTip( _("View/Edit the probing GCode.") ) @@ -2314,8 +2314,8 @@ class LevelUI: self.import_heights_button.hide() separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 35, 0, 1, 2) self.tools_box.addStretch(1) diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index 30e513a8..e5651f06 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -5,7 +5,7 @@ # License: MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, FCComboBox2, \ @@ -549,7 +549,7 @@ class ToolMilling(AppTool, Excellon): self.ui.pp_geo_name_cb.addItem(name) # and add ToolTips (useful when names are too long) for it in range(self.ui.pp_geo_name_cb.count()): - self.ui.pp_geo_name_cb.setItemData(it, self.ui.pp_geo_name_cb.itemText(it), QtCore.Qt.ToolTipRole) + self.ui.pp_geo_name_cb.setItemData(it, self.ui.pp_geo_name_cb.itemText(it), QtCore.Qt.ItemDataRole.ToolTipRole) # Fill form fields self.to_form() @@ -931,12 +931,12 @@ class ToolMilling(AppTool, Excellon): # -------------------- ID ------------------------------- area_id_item = QtWidgets.QTableWidgetItem('%d' % int(area_id)) - area_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + area_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exclusion_table.setItem(area, 0, area_id_item) # Area id # -------------------- Object Type ---------------------- object_item = QtWidgets.QTableWidgetItem('%s' % area_dict["obj_type"]) - object_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + object_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exclusion_table.setItem(area, 1, object_item) # Origin Object # -------------------- Strategy ------------------------- @@ -952,14 +952,14 @@ class ToolMilling(AppTool, Excellon): # -------------------- Over Z --------------------------- overz_item = QtWidgets.QTableWidgetItem('%s' % area_dict["overz"]) - overz_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + overz_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exclusion_table.setItem(area, 3, overz_item) # Over Z # make the Overz column editable for row in range(e_len): - self.ui.exclusion_table.item(row, 3).setFlags(QtCore.Qt.ItemIsSelectable | - QtCore.Qt.ItemIsEditable | - QtCore.Qt.ItemIsEnabled) + self.ui.exclusion_table.item(row, 3).setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | + QtCore.Qt.ItemFlag.ItemIsEditable | + QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.exclusion_table.resizeColumnsToContents() self.ui.exclusion_table.resizeRowsToContents() @@ -1018,12 +1018,12 @@ class ToolMilling(AppTool, Excellon): # -------------------- ID ------------------------------------------ # tool_id = QtWidgets.QTableWidgetItem('%d' % int(row_idx + 1)) - tool_id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + tool_id.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 0, tool_id) # Tool name/id # -------------------- DIAMETER ------------------------------------- # dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(tooluid_value['tooldia']))) - dia_item.setFlags(QtCore.Qt.ItemIsEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 1, dia_item) # Diameter # -------------------- TOOL TYPE ------------------------------------- # @@ -1045,10 +1045,10 @@ class ToolMilling(AppTool, Excellon): # -------------------- PLOT ------------------------------------- # empty_plot_item = QtWidgets.QTableWidgetItem('') - empty_plot_item.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_plot_item.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.geo_tools_table.setItem(row_idx, 4, empty_plot_item) plot_item = FCCheckBox() - plot_item.setLayoutDirection(QtCore.Qt.RightToLeft) + plot_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) if self.ui.plot_cb.isChecked(): plot_item.setChecked(True) self.ui.geo_tools_table.setCellWidget(row_idx, 4, plot_item) @@ -1057,9 +1057,9 @@ class ToolMilling(AppTool, Excellon): # make the diameter column editable for row in range(row_idx): - self.ui.geo_tools_table.item(row, 1).setFlags(QtCore.Qt.ItemIsSelectable | - QtCore.Qt.ItemIsEditable | - QtCore.Qt.ItemIsEnabled) + self.ui.geo_tools_table.item(row, 1).setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | + QtCore.Qt.ItemFlag.ItemIsEditable | + QtCore.Qt.ItemFlag.ItemIsEnabled) # sort the tool diameter column # self.ui.geo_tools_table.sortItems(1) @@ -1155,17 +1155,17 @@ class ToolMilling(AppTool, Excellon): # Tool name/id exc_id_item = QtWidgets.QTableWidgetItem('%d' % int(tool_no)) - exc_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + exc_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 0, exc_id_item) # Tool Diameter dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, self.obj_tools[tool_no]['tooldia'])) - dia_item.setFlags(QtCore.Qt.ItemIsEnabled) + dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 1, dia_item) # Number of drills per tool drill_count_item = QtWidgets.QTableWidgetItem('%d' % drill_cnt) - drill_count_item.setFlags(QtCore.Qt.ItemIsEnabled) + drill_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 2, drill_count_item) # Tool unique ID @@ -1177,22 +1177,22 @@ class ToolMilling(AppTool, Excellon): # if the slot number is zero is better to not clutter the GUI with zero's so we print a space slot_count_str = '%d' % slot_cnt if slot_cnt > 0 else '' slot_count_item = QtWidgets.QTableWidgetItem(slot_count_str) - slot_count_item.setFlags(QtCore.Qt.ItemIsEnabled) + slot_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 4, slot_count_item) self.tool_row += 1 # add a last row with the Total number of drills empty_1 = QtWidgets.QTableWidgetItem('') - empty_1.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_1.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) empty_1_1 = QtWidgets.QTableWidgetItem('') - empty_1_1.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_1_1.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) label_tot_drill_count = QtWidgets.QTableWidgetItem(_('Total Drills')) - label_tot_drill_count.setFlags(QtCore.Qt.ItemIsEnabled) + label_tot_drill_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) tot_drill_count = QtWidgets.QTableWidgetItem('%d' % self.tot_drill_cnt) - tot_drill_count.setFlags(QtCore.Qt.ItemIsEnabled) + tot_drill_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 0, empty_1) self.ui.tools_table.setItem(self.tool_row, 1, label_tot_drill_count) @@ -1211,14 +1211,14 @@ class ToolMilling(AppTool, Excellon): # add a last row with the Total number of slots empty_2 = QtWidgets.QTableWidgetItem('') - empty_2.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_2.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) empty_2_1 = QtWidgets.QTableWidgetItem('') - empty_2_1.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + empty_2_1.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) label_tot_slot_count = QtWidgets.QTableWidgetItem(_('Total Slots')) tot_slot_count = QtWidgets.QTableWidgetItem('%d' % self.tot_slot_cnt) - label_tot_slot_count.setFlags(QtCore.Qt.ItemIsEnabled) - tot_slot_count.setFlags(QtCore.Qt.ItemIsEnabled) + label_tot_slot_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) + tot_slot_count.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(self.tool_row, 0, empty_2) self.ui.tools_table.setItem(self.tool_row, 1, label_tot_slot_count) @@ -1232,7 +1232,7 @@ class ToolMilling(AppTool, Excellon): # make the diameter column editable for row in range(self.ui.tools_table.rowCount() - 2): self.ui.tools_table.item(row, 1).setFlags( - QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.resizeColumnsToContents() self.ui.tools_table.resizeRowsToContents() @@ -3351,16 +3351,16 @@ class ToolMilling(AppTool, Excellon): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier. pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) @@ -3368,7 +3368,7 @@ class ToolMilling(AppTool, Excellon): else: key = event.key - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': self.points = [] self.poly_drawn = False self.delete_moving_selection_shape() @@ -3566,7 +3566,7 @@ class MillingUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -3602,8 +3602,8 @@ class MillingUI: grid0.addWidget(self.object_combo, 2, 0, 1, 2) # separator_line = QtWidgets.QFrame() - # separator_line.setFrameShape(QtWidgets.QFrame.HLine) - # separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + # separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) # grid0.addWidget(separator_line, 4, 0, 1, 2) # ### Tools #### @@ -3616,7 +3616,7 @@ class MillingUI: # Plot CB self.plot_cb = FCCheckBox(_('Plot Object')) self.plot_cb.setToolTip(_("Plot (show) this object.")) - self.plot_cb.setLayoutDirection(QtCore.Qt.RightToLeft) + self.plot_cb.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) grid0.addWidget(self.plot_cb, 6, 1) # ################################################ @@ -3765,14 +3765,14 @@ class MillingUI: _("Delete a selection of tools in the Tool Table\n" "by first selecting a row in the Tool Table.") ) - self.deltool_btn.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.deltool_btn.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) button_grid.addWidget(self.deltool_btn, 0, 1, 2, 1) # ############################################################################################################# separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 15, 0, 1, 2) self.add_tool_frame.hide() @@ -3808,8 +3808,8 @@ class MillingUI: self.exc_tools_box.addLayout(self.grid1) # separator_line = QtWidgets.QFrame() - # separator_line.setFrameShape(QtWidgets.QFrame.HLine) - # separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + # separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) # self.grid3.addWidget(separator_line, 1, 0, 1, 2) # Milling Type @@ -3894,8 +3894,8 @@ class MillingUI: self.grid1.addWidget(self.offset_entry, 6, 1) self.offset_separator_line = QtWidgets.QFrame() - self.offset_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.offset_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.offset_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.offset_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid1.addWidget(self.offset_separator_line, 7, 0, 1, 2) # Tool Type @@ -3996,8 +3996,8 @@ class MillingUI: self.polish_method_combo.hide() self.job_separator_line = QtWidgets.QFrame() - self.job_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.job_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.job_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.job_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid1.addWidget(self.job_separator_line, 18, 0, 1, 2) # Tip Dia @@ -4236,8 +4236,8 @@ class MillingUI: self.exc_tools_box.addLayout(self.grid3) separator_line2 = QtWidgets.QFrame() - separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(separator_line2, 0, 0, 1, 2) self.apply_param_to_all = FCButton(_("Apply parameters to all tools")) @@ -4249,8 +4249,8 @@ class MillingUI: self.grid3.addWidget(self.apply_param_to_all, 1, 0, 1, 2) self.all_param_separator_line2 = QtWidgets.QFrame() - self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(self.all_param_separator_line2, 2, 0, 1, 2) # ############################################################################################################# @@ -4376,7 +4376,7 @@ class MillingUI: "Gcode output for Geometry (Milling) Objects.") ) self.pp_geo_name_cb = FCComboBox() - self.pp_geo_name_cb.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pp_geo_name_cb.setFocusPolicy(QtCore.Qt.FocusPolicy.StrongFocus) self.pp_geo_name_cb.setObjectName("mill_ppname_g") self.grid3.addWidget(pp_geo_label, 16, 0) @@ -4490,8 +4490,8 @@ class MillingUI: # ------------------------------------------------------------------------------------------------------------ separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(separator_line, 25, 0, 1, 2) # ################################################################# diff --git a/appPlugins/ToolMove.py b/appPlugins/ToolMove.py index d3c87eab..055a40e4 100644 --- a/appPlugins/ToolMove.py +++ b/appPlugins/ToolMove.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appTool import AppTool from appGUI.VisPyVisuals import * @@ -33,7 +33,7 @@ class ToolMove(AppTool): self.decimals = self.app.decimals self.layout.setContentsMargins(0, 0, 3, 0) - self.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Maximum) + self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Maximum) self.clicked_move = 0 diff --git a/appPlugins/ToolNCC.py b/appPlugins/ToolNCC.py index 4c26e793..b66e7290 100644 --- a/appPlugins/ToolNCC.py +++ b/appPlugins/ToolNCC.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton,\ @@ -837,7 +837,7 @@ class NonCopperClear(AppTool, Gerber): # ------------------------ Tool ID ---------------------------------------------------------------- id_ = QtWidgets.QTableWidgetItem('%d' % int(tool_id)) - flags = QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled + flags = QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled id_.setFlags(flags) row_no = tool_id - 1 self.ui.tools_table.setItem(row_no, 0, id_) # Tool name/id @@ -845,7 +845,7 @@ class NonCopperClear(AppTool, Gerber): # ------------------------ Tool Diameter ---------------------------------------------------------- # Make sure that the drill diameter when in MM is with no more than self.decimals decimals dia = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, tooluid_value['tooldia'])) - dia.setFlags(QtCore.Qt.ItemIsEnabled) + dia.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(row_no, 1, dia) # Diameter # ------------------------ Tool Shape ------------------------------------------------------------- @@ -862,7 +862,7 @@ class NonCopperClear(AppTool, Gerber): # make the diameter column editable for row in range(tool_id): - flags = QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled + flags = QtCore.Qt.ItemFlag.ItemIsEditable | QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled self.ui.tools_table.item(row, 1).setFlags(flags) self.ui.tools_table.resizeColumnsToContents() @@ -1873,16 +1873,16 @@ class NonCopperClear(AppTool, Gerber): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier. pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) @@ -1890,7 +1890,7 @@ class NonCopperClear(AppTool, Gerber): else: key = event.key - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': if self.area_sel_disconnect_flag is True: if self.app.is_legacy is False: @@ -4136,7 +4136,7 @@ class NccUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -4176,8 +4176,8 @@ class NccUI: grid0.addWidget(self.object_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 4, 0, 1, 2) # ### Tools ## ## @@ -4251,8 +4251,8 @@ class NccUI: grid1.addWidget(self.ncc_order_radio, 1, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid1.addWidget(separator_line, 2, 0, 1, 2) # ############################################################# @@ -4333,14 +4333,14 @@ class NccUI: _("Delete a selection of tools in the Tool Table\n" "by first selecting a row in the Tool Table.") ) - self.deltool_btn.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.deltool_btn.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) button_grid.addWidget(self.deltool_btn, 0, 1, 2, 1) # ############################################################################################################# self.add_tool_separator_line = QtWidgets.QFrame() - self.add_tool_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.add_tool_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.add_tool_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.add_tool_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(self.add_tool_separator_line, 11, 0, 1, 2) self.tool_data_label = FCLabel( @@ -4500,8 +4500,8 @@ class NccUI: self.ois_ncc_offset = OptionalInputSection(self.ncc_choice_offset_cb, [self.ncc_offset_spinner]) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(separator_line, 21, 0, 1, 2) self.apply_param_to_all = FCButton(_("Apply parameters to all tools")) @@ -4513,8 +4513,8 @@ class NccUI: self.grid3.addWidget(self.apply_param_to_all, 22, 0, 1, 2) self.all_param_separator_line2 = QtWidgets.QFrame() - self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(self.all_param_separator_line2, 23, 0, 1, 2) # General Parameters @@ -4659,8 +4659,8 @@ class NccUI: self.grid3.addWidget(self.valid_cb, 37, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(separator_line, 39, 0, 1, 2) self.generate_ncc_button = FCButton(_('Generate Geometry')) diff --git a/appPlugins/ToolOptimal.py b/appPlugins/ToolOptimal.py index 677106f4..7e0b35bc 100644 --- a/appPlugins/ToolOptimal.py +++ b/appPlugins/ToolOptimal.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import OptionalHideInputSection, FCTextArea, FCEntry, FCSpinner, FCCheckBox, FCComboBox, \ @@ -466,8 +466,8 @@ class OptimalUI: grid0.addWidget(self.gerber_object_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 4, 0, 1, 2) # Precision = nr of decimals diff --git a/appPlugins/ToolPDF.py b/appPlugins/ToolPDF.py index 19333b99..a0187768 100644 --- a/appPlugins/ToolPDF.py +++ b/appPlugins/ToolPDF.py @@ -4,7 +4,7 @@ # Date: 4/23/2019 # # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appTool import AppTool @@ -396,7 +396,7 @@ class ToolPDF(AppTool): pass self.check_thread.timeout.connect(self.periodic_check_handler) - self.check_thread.start(QtCore.QThread.HighPriority) + self.check_thread.start(QtCore.QThread.Priority.HighPriority) def periodic_check_handler(self): """ diff --git a/appPlugins/ToolPaint.py b/appPlugins/ToolPaint.py index 5dd0a30a..fcaef728 100644 --- a/appPlugins/ToolPaint.py +++ b/appPlugins/ToolPaint.py @@ -5,8 +5,8 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtGui, QtCore -from PyQt5.QtCore import Qt +from PyQt6 import QtWidgets, QtGui, QtCore +from PyQt6.QtCore import Qt from appTool import AppTool from copy import deepcopy @@ -397,7 +397,7 @@ class ToolPaint(AppTool, Gerber): # if the Paint Method is "Single" disable the tool table context menu if self.default_data["tools_paint_selectmethod"] == "single": - self.ui.tools_table.setContextMenuPolicy(Qt.NoContextMenu) + self.ui.tools_table.setContextMenuPolicy(Qt.ContextMenuPolicy.NoContextMenu) return for dia in diameters: @@ -407,7 +407,7 @@ class ToolPaint(AppTool, Gerber): # if the Paint Method is "Polygon Selection" disable the tool table context menu if self.default_data["tools_paint_selectmethod"] == 1: - self.ui.tools_table.setContextMenuPolicy(Qt.NoContextMenu) + self.ui.tools_table.setContextMenuPolicy(Qt.ContextMenuPolicy.NoContextMenu) # make sure that we can't get selection of Laser Lines for Geometry even if it's set in the Preferences # because we don't select the default object type in Preferences but here @@ -764,12 +764,12 @@ class ToolPaint(AppTool, Gerber): tool_id += 1 id_item = QtWidgets.QTableWidgetItem('%d' % int(tool_id)) - id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) row_no = tool_id - 1 self.ui.tools_table.setItem(row_no, 0, id_item) # Tool name/id dia = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, tooluid_value['tooldia'])) - dia.setFlags(QtCore.Qt.ItemIsEnabled) + dia.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(row_no, 1, dia) # Diameter tool_type_item = FCComboBox() @@ -787,7 +787,7 @@ class ToolPaint(AppTool, Gerber): # make the diameter column editable for row in range(tool_id): self.ui.tools_table.item(row, 1).setFlags( - QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + QtCore.Qt.ItemFlag.ItemIsEditable | QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # all the tools are selected by default self.ui.tools_table.selectColumn(0) @@ -1548,16 +1548,16 @@ class ToolPaint(AppTool, Gerber): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier. pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) @@ -1565,7 +1565,7 @@ class ToolPaint(AppTool, Gerber): else: key = event.key - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': if self.area_sel_disconnect_flag is True: try: if self.app.is_legacy is False: @@ -2943,7 +2943,7 @@ class PaintUI: "Permanent change is done in 'Preferences' menu." ) ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.level.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.level.setCheckable(True) self.title_box.addWidget(self.level) @@ -2986,8 +2986,8 @@ class PaintUI: grid0.addWidget(self.obj_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 5, 0, 1, 2) # ### Tools ## ## @@ -3050,8 +3050,8 @@ class PaintUI: grid0.addWidget(self.order_radio, 9, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 10, 0, 1, 2) # ############################################################################## @@ -3118,14 +3118,14 @@ class PaintUI: _("Delete a selection of tools in the Tool Table\n" "by first selecting a row in the Tool Table.") ) - self.deltool_btn.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.deltool_btn.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) button_grid.addWidget(self.deltool_btn, 0, 1, 2, 1) # ############################################################################################################# self.add_tool_separator_line = QtWidgets.QFrame() - self.add_tool_separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.add_tool_separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.add_tool_separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.add_tool_separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.grid3.addWidget(self.add_tool_separator_line, 11, 0, 1, 2) self.tool_data_label = FCLabel( @@ -3223,8 +3223,8 @@ class PaintUI: grid4.addWidget(self.paintcontour_cb, 10, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid4.addWidget(separator_line, 11, 0, 1, 2) self.apply_param_to_all = FCButton(_("Apply parameters to all tools")) @@ -3236,8 +3236,8 @@ class PaintUI: grid4.addWidget(self.apply_param_to_all, 12, 0, 1, 2) self.all_param_separator_line2 = QtWidgets.QFrame() - self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.HLine) - self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid4.addWidget(self.all_param_separator_line2, 13, 0, 1, 2) # General Parameters @@ -3414,7 +3414,7 @@ class PaintUI: self.new_tooldia_entry.setDisabled(False) self.search_and_add_btn.setDisabled(False) self.deltool_btn.setDisabled(False) - self.tools_table.setContextMenuPolicy(Qt.ActionsContextMenu) + self.tools_table.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu) self.area_shape_label.hide() self.area_shape_radio.hide() diff --git a/appPlugins/ToolPanelize.py b/appPlugins/ToolPanelize.py index fa99b259..d14e8e65 100644 --- a/appPlugins/ToolPanelize.py +++ b/appPlugins/ToolPanelize.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtGui, QtCore +from PyQt6 import QtWidgets, QtGui, QtCore from appTool import AppTool from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCCheckBox, OptionalInputSection, FCComboBox, \ @@ -1218,8 +1218,8 @@ class PanelizeUI: grid0.addWidget(self.box_combo, 12, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 14, 0, 1, 2) panel_data_label = FCLabel("%s:" % _("Panel Data")) @@ -1282,8 +1282,8 @@ class PanelizeUI: grid0.addWidget(self.rows, 24, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 26, 0, 1, 2) # Type of resulting Panel object @@ -1347,8 +1347,8 @@ class PanelizeUI: self.constrain_cb, [self.x_width_lbl, self.x_width_entry, self.y_height_lbl, self.y_height_entry]) self.separator_line = QtWidgets.QFrame() - self.separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.separator_line, 38, 0, 1, 2) # Buttons diff --git a/appPlugins/ToolPcbWizard.py b/appPlugins/ToolPcbWizard.py index 8a6f1f0c..0f729424 100644 --- a/appPlugins/ToolPcbWizard.py +++ b/appPlugins/ToolPcbWizard.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from appTool import AppTool from appGUI.GUIElements import RadioSet, FCSpinner, FCButton, FCTable, FCLabel, VerticalScrollArea @@ -170,11 +170,11 @@ class PcbWizard(AppTool): tool_row = 0 for tool in sorted_tools: tool_id_item = QtWidgets.QTableWidgetItem('%d' % int(tool)) - tool_id_item.setFlags(QtCore.Qt.ItemIsEnabled) + tool_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(tool_row, 0, tool_id_item) # Tool name/id tool_dia_item = QtWidgets.QTableWidgetItem(str(self.tools_from_inf[tool])) - tool_dia_item.setFlags(QtCore.Qt.ItemIsEnabled) + tool_dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(tool_row, 1, tool_dia_item) tool_row += 1 diff --git a/appPlugins/ToolPunchGerber.py b/appPlugins/ToolPunchGerber.py index d5775117..38ba8ef8 100644 --- a/appPlugins/ToolPunchGerber.py +++ b/appPlugins/ToolPunchGerber.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtCore, QtWidgets, QtGui +from PyQt6 import QtCore, QtWidgets, QtGui from appTool import AppTool from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox, FCTable, FCButton, FCLabel, \ @@ -314,11 +314,11 @@ class ToolPunchGerber(AppTool, Gerber): # Aperture CODE ap_code_item = QtWidgets.QTableWidgetItem(str(ap_code)) - ap_code_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + ap_code_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # Aperture TYPE ap_type_item = QtWidgets.QTableWidgetItem(str(ap_type)) - ap_type_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_type_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # Aperture SIZE try: @@ -329,15 +329,15 @@ class ToolPunchGerber(AppTool, Gerber): ap_size_item = QtWidgets.QTableWidgetItem('') except KeyError: ap_size_item = QtWidgets.QTableWidgetItem('') - ap_size_item.setFlags(QtCore.Qt.ItemIsEnabled) + ap_size_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) # Aperture MARK Item mark_item = FCCheckBox() - mark_item.setLayoutDirection(QtCore.Qt.RightToLeft) + mark_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) # Empty PLOT ITEM empty_plot_item = QtWidgets.QTableWidgetItem('') - empty_plot_item.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - empty_plot_item.setFlags(QtCore.Qt.ItemIsEnabled) + empty_plot_item.setFlags(~QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) + empty_plot_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.apertures_table.setItem(row, 0, ap_code_item) # Aperture Code self.ui.apertures_table.setItem(row, 1, ap_type_item) # Aperture Type @@ -1785,16 +1785,16 @@ class ToolPunchGerber(AppTool, Gerber): if '+' in key_string: mod, __, key_text = key_string.rpartition('+') if mod.lower() == 'ctrl': - # modifiers = QtCore.Qt.ControlModifier + # modifiers = QtCore.Qt.KeyboardModifier.ControlModifier pass elif mod.lower() == 'alt': - # modifiers = QtCore.Qt.AltModifier + # modifiers = QtCore.Qt.KeyboardModifier.AltModifier pass elif mod.lower() == 'shift': - # modifiers = QtCore.Qt.ShiftModifier + # modifiers = QtCore.Qt.KeyboardModifier. pass else: - # modifiers = QtCore.Qt.NoModifier + # modifiers = QtCore.Qt.KeyboardModifier.NoModifier pass key = QtGui.QKeySequence(key_text) @@ -1802,7 +1802,7 @@ class ToolPunchGerber(AppTool, Gerber): else: key = event.key - if key == QtCore.Qt.Key_Escape or key == 'Escape': + if key == QtCore.Qt.Key.Key_Escape or key == 'Escape': if self.area_sel_disconnect_flag is True: try: if self.app.is_legacy is False: @@ -2010,8 +2010,8 @@ class PunchUI: grid_lay.addWidget(self.gerber_object_combo, 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 2, 0, 1, 2) self.padt_label = FCLabel("%s" % _("Processed Pads Type")) @@ -2099,13 +2099,13 @@ class PunchUI: self.apertures_table.horizontalHeaderItem(3).setToolTip( _("Mark the aperture instances on canvas.")) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Preferred) self.apertures_table.setSizePolicy(sizePolicy) self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(separator_line, 10, 0, 1, 2) # Grid Layout @@ -2135,8 +2135,8 @@ class PunchUI: grid0.addWidget(self.method_punch, 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 2, 0, 1, 2) self.exc_label = FCLabel('%s' % _("Excellon")) @@ -2282,8 +2282,8 @@ class PunchUI: grid0.addWidget(self.factor_entry, 14, 1) separator_line3 = QtWidgets.QFrame() - separator_line3.setFrameShape(QtWidgets.QFrame.HLine) - separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line3.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line3, 16, 0, 1, 2) # Proportional value @@ -2324,8 +2324,8 @@ class PunchUI: grid0.addLayout(sel_hlay, 22, 0, 1, 2) self.separator_line3 = QtWidgets.QFrame() - self.separator_line3.setFrameShape(QtWidgets.QFrame.HLine) - self.separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken) + self.separator_line3.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.separator_line3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.separator_line3, 24, 0, 1, 2) # Buttons diff --git a/appPlugins/ToolQRCode.py b/appPlugins/ToolQRCode.py index 21790184..ff34def7 100644 --- a/appPlugins/ToolQRCode.py +++ b/appPlugins/ToolQRCode.py @@ -5,8 +5,8 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui -from PyQt5.QtCore import Qt +from PyQt6 import QtWidgets, QtCore, QtGui +from PyQt6.QtCore import Qt from appTool import AppTool from appGUI.GUIElements import RadioSet, FCTextArea, FCSpinner, FCEntry, FCCheckBox, FCComboBox, FCFileSaveDialog, \ @@ -781,8 +781,8 @@ class QRcodeUI: i_grid_lay.addWidget(self.grb_object_combo, 1, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) i_grid_lay.addWidget(separator_line, 2, 0, 1, 2) # Text box @@ -798,8 +798,8 @@ class QRcodeUI: i_grid_lay.addWidget(self.text_data, 6, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) i_grid_lay.addWidget(separator_line, 7, 0, 1, 2) # ## Grid Layout @@ -910,8 +910,8 @@ class QRcodeUI: grid_lay.addWidget(self.bb_radio, 12, 1) self.separator_line_2 = QtWidgets.QFrame() - self.separator_line_2.setFrameShape(QtWidgets.QFrame.HLine) - self.separator_line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.separator_line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.separator_line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid_lay.addWidget(self.separator_line_2, 14, 0, 1, 2) # Export QRCode @@ -947,8 +947,8 @@ class QRcodeUI: fill_lay_child = QtWidgets.QHBoxLayout() fill_lay_child.setContentsMargins(0, 0, 0, 0) fill_lay_child.addWidget(self.fill_color_entry) - fill_lay_child.addWidget(self.fill_color_button, alignment=Qt.AlignRight) - fill_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + fill_lay_child.addWidget(self.fill_color_button, alignment=Qt.AlignmentFlag.AlignRight) + fill_lay_child.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) fill_color_widget = QtWidgets.QWidget() fill_color_widget.setLayout(fill_lay_child) @@ -971,8 +971,8 @@ class QRcodeUI: back_lay_child = QtWidgets.QHBoxLayout() back_lay_child.setContentsMargins(0, 0, 0, 0) back_lay_child.addWidget(self.back_color_entry) - back_lay_child.addWidget(self.back_color_button, alignment=Qt.AlignRight) - back_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + back_lay_child.addWidget(self.back_color_button, alignment=Qt.AlignmentFlag.AlignRight) + back_lay_child.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) back_color_widget = QtWidgets.QWidget() back_color_widget.setLayout(back_lay_child) diff --git a/appPlugins/ToolReport.py b/appPlugins/ToolReport.py index cd51702d..b4cc273d 100644 --- a/appPlugins/ToolReport.py +++ b/appPlugins/ToolReport.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtGui, QtCore, QtWidgets +from PyQt6 import QtGui, QtCore, QtWidgets from appTool import AppTool from appGUI.GUIElements import FCTree, VerticalScrollArea @@ -35,7 +35,7 @@ class ObjectReport(AppTool): def __init__(self, app): AppTool.__init__(self, app) - # self.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored) + # self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Ignored) self.decimals = self.app.decimals self.layout.setContentsMargins(0, 0, 0, 0) @@ -60,7 +60,7 @@ class ObjectReport(AppTool): # self.info_box.addWidget(title_label) self.treeWidget = FCTree(columns=2) - self.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + self.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) self.treeWidget.setStyleSheet("QTreeWidget {border: 0px;}") self.info_box.addWidget(self.treeWidget) diff --git a/appPlugins/ToolRulesCheck.py b/appPlugins/ToolRulesCheck.py index 67956b4d..223b3ecb 100644 --- a/appPlugins/ToolRulesCheck.py +++ b/appPlugins/ToolRulesCheck.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtGui +from PyQt6 import QtWidgets, QtGui from appTool import AppTool from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCComboBox, FCLabel, FCButton, \ diff --git a/appPlugins/ToolShell.py b/appPlugins/ToolShell.py index 091715d6..89631393 100644 --- a/appPlugins/ToolShell.py +++ b/appPlugins/ToolShell.py @@ -7,10 +7,10 @@ # ########################################################## -from PyQt5 import QtCore, QtGui, QtWidgets -from PyQt5.QtCore import QSettings -from PyQt5.QtGui import QTextCursor, QPixmap -from PyQt5.QtWidgets import QVBoxLayout, QWidget, QHBoxLayout, QLabel +from PyQt6 import QtCore, QtGui, QtWidgets +from PyQt6.QtCore import QSettings +from PyQt6.QtGui import QTextCursor, QPixmap +from PyQt6.QtWidgets import QVBoxLayout, QWidget, QHBoxLayout, QLabel from appGUI.GUIElements import _BrowserTextEdit, _ExpandableTextEdit, FCLabel import html import sys @@ -168,7 +168,7 @@ class TermWidget(QWidget): old_value = scrollbar.value() # scrollattheend = old_value == scrollbar.maximum() - self._browser.moveCursor(QTextCursor.End) + self._browser.moveCursor(QTextCursor.MoveOperation.End) self._browser.insertHtml(text) """TODO When user enters second line to the input, and input is resized, scrollbar changes its position @@ -279,7 +279,7 @@ class TermWidget(QWidget): if (self._historyIndex + 1) < len(self._history): self._historyIndex += 1 self._edit.setPlainText(self._history[self._historyIndex]) - self._edit.moveCursor(QTextCursor.End) + self._edit.moveCursor(QTextCursor.MoveOperation.End) def _on_history_prev(self): """ @@ -290,7 +290,7 @@ class TermWidget(QWidget): self._history[-1] = self._edit.toPlainText() self._historyIndex -= 1 self._edit.setPlainText(self._history[self._historyIndex]) - self._edit.moveCursor(QTextCursor.End) + self._edit.moveCursor(QTextCursor.MoveOperation.End) class FCShell(TermWidget): @@ -360,7 +360,7 @@ class FCShell(TermWidget): r = self._browser.find(str(searched_txt)) if r is False: - self._browser.moveCursor(QtGui.QTextCursor.Start) + self._browser.moveCursor(QtGui.QTextCursor.MoveOperation.Start) self._browser.find(str(searched_txt)) def init_tcl(self): diff --git a/appPlugins/ToolSolderPaste.py b/appPlugins/ToolSolderPaste.py index b72cd1e9..bd297935 100644 --- a/appPlugins/ToolSolderPaste.py +++ b/appPlugins/ToolSolderPaste.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtGui, QtCore, QtWidgets +from PyQt6 import QtGui, QtCore, QtWidgets from appTool import AppTool from appCommon.Common import LoudDict @@ -260,13 +260,13 @@ class SolderPaste(AppTool): # Tool name/id id_item = QtWidgets.QTableWidgetItem('%d' % int(tool_id)) - id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) row_no = tool_id - 1 self.ui.tools_table.setItem(row_no, 0, id_item) # Diameter dia = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, tooluid_value['tooldia'])) - dia.setFlags(QtCore.Qt.ItemIsEnabled) + dia.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled) self.ui.tools_table.setItem(row_no, 1, dia) # Tool unique ID @@ -276,7 +276,7 @@ class SolderPaste(AppTool): # make the diameter column editable for row in range(tool_id): self.ui.tools_table.item(row, 1).setFlags( - QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + QtCore.Qt.ItemFlag.ItemIsEditable | QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) # all the tools are selected by default self.ui.tools_table.selectColumn(0) @@ -1211,8 +1211,8 @@ class SolderUI: obj_form_layout.addWidget(self.obj_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) obj_form_layout.addWidget(separator_line, 4, 0, 1, 2) # ### Tools ## ## @@ -1278,8 +1278,8 @@ class SolderUI: grid0.addWidget(self.deltool_btn, 0, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 2, 0, 1, 4) self.gcode_frame = QtWidgets.QFrame() @@ -1337,8 +1337,8 @@ class SolderUI: self.param_grid.addWidget(self.z_stop_entry, 6, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.param_grid.addWidget(separator_line, 7, 0, 1, 2) # Z travel @@ -1379,8 +1379,8 @@ class SolderUI: self.param_grid.addWidget(self.xy_toolchange_entry, 12, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.param_grid.addWidget(separator_line, 13, 0, 1, 2) # Feedrate X-Y @@ -1425,8 +1425,8 @@ class SolderUI: self.param_grid.addWidget(self.frz_dispense_entry, 18, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.param_grid.addWidget(separator_line, 19, 0, 1, 2) # Spindle Speed Forward @@ -1483,8 +1483,8 @@ class SolderUI: self.param_grid.addWidget(self.dwellrev_entry, 26, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.param_grid.addWidget(separator_line, 27, 0, 1, 2) # Preprocessors @@ -1498,8 +1498,8 @@ class SolderUI: self.param_grid.addWidget(self.pp_combo, 28, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.param_grid.addWidget(separator_line, 30, 0, 1, 2) # Buttons Grid @@ -1540,8 +1540,8 @@ class SolderUI: self.button_grid.addWidget(self.geo_obj_combo, 2, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.button_grid.addWidget(separator_line, 4, 0, 1, 2) # ## Buttons @@ -1577,8 +1577,8 @@ class SolderUI: self.button_grid.addWidget(self.cnc_obj_combo, 8, 1) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.button_grid.addWidget(separator_line, 10, 0, 1, 2) # Save and Review GCode @@ -1621,7 +1621,7 @@ class SolderUI: self.layout.addWidget(self.reset_button) # action to be added in the combobox context menu - self.combo_context_del_action = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/trash16.png'), + self.combo_context_del_action = QtGui.QAction(QtGui.QIcon(self.app.resource_location + '/trash16.png'), _("Delete Object")) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolSub.py b/appPlugins/ToolSub.py index 322b2b30..05f7d3e8 100644 --- a/appPlugins/ToolSub.py +++ b/appPlugins/ToolSub.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtCore, QtGui +from PyQt6 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCButton, FCComboBox, FCLabel, VerticalScrollArea @@ -710,7 +710,7 @@ class ToolSub(AppTool): pass self.check_thread.timeout.connect(self.periodic_check_handler) - self.check_thread.start(QtCore.QThread.HighPriority) + self.check_thread.start(QtCore.QThread.Priority.HighPriority) def periodic_check_handler(self): """ @@ -826,8 +826,8 @@ class SubUI: grid0.addWidget(self.delete_sources_cb, 0, 0, 1, 2) self.separator_line = QtWidgets.QFrame() - self.separator_line.setFrameShape(QtWidgets.QFrame.HLine) - self.separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + self.separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(self.separator_line, 2, 0, 1, 3) self.extra_empty_label = FCLabel('') diff --git a/appPlugins/ToolTransform.py b/appPlugins/ToolTransform.py index 0a84b51d..d63976c0 100644 --- a/appPlugins/ToolTransform.py +++ b/appPlugins/ToolTransform.py @@ -5,7 +5,7 @@ # MIT Licence # # ########################################################## -from PyQt5 import QtWidgets, QtGui, QtCore +from PyQt6 import QtWidgets, QtGui, QtCore from appTool import AppTool from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCButton, OptionalInputSection, FCComboBox, \ NumericalEvalTupleEntry, FCLabel, VerticalScrollArea @@ -669,8 +669,8 @@ class TransformUI: grid0.addWidget(self.object_combo, 4, 0, 1, 3) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 5, 0, 1, 3) # ## Rotate Title @@ -691,7 +691,7 @@ class TransformUI: self.rotate_entry.setWrapping(True) self.rotate_entry.set_range(-360, 360) - # self.rotate_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.rotate_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.rotate_button = FCButton(_("Rotate")) self.rotate_button.setToolTip( @@ -706,8 +706,8 @@ class TransformUI: grid0.addWidget(self.rotate_button, 7, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 8, 0, 1, 3) # ## Skew Title @@ -728,7 +728,7 @@ class TransformUI: "Float number between -360 and 360.") ) self.skewx_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.skewx_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.skewx_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.skewx_entry.set_precision(self.decimals) self.skewx_entry.set_range(-360, 360) @@ -749,7 +749,7 @@ class TransformUI: "Float number between -360 and 360.") ) self.skewy_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.skewy_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.skewy_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.skewy_entry.set_precision(self.decimals) self.skewy_entry.set_range(-360, 360) @@ -768,8 +768,8 @@ class TransformUI: logic=False) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 14, 0, 1, 3) # ## Scale Title @@ -789,7 +789,7 @@ class TransformUI: _("Factor for scaling on X axis.") ) self.scalex_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.scalex_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.scalex_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.scalex_entry.set_precision(self.decimals) self.scalex_entry.setMinimum(-1e6) @@ -809,7 +809,7 @@ class TransformUI: _("Factor for scaling on Y axis.") ) self.scaley_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.scaley_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.scaley_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.scaley_entry.set_precision(self.decimals) self.scaley_entry.setMinimum(-1e6) @@ -832,8 +832,8 @@ class TransformUI: ], logic=False) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 21, 0, 1, 3) # ## Flip Title @@ -857,8 +857,8 @@ class TransformUI: hlay0.addWidget(self.flipy_button) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 27, 0, 1, 3) # ## Offset Title @@ -870,7 +870,7 @@ class TransformUI: _("Distance to offset on X axis. In current units.") ) self.offx_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.offx_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.offx_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.offx_entry.set_precision(self.decimals) self.offx_entry.setMinimum(-1e6) @@ -890,7 +890,7 @@ class TransformUI: _("Distance to offset on Y axis. In current units.") ) self.offy_entry = FCDoubleSpinner(callback=self.confirmation_message) - # self.offy_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + # self.offy_entry.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.offy_entry.set_precision(self.decimals) self.offy_entry.setMinimum(-1e6) @@ -906,8 +906,8 @@ class TransformUI: grid0.addWidget(self.offy_button, 32, 2) separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid0.addWidget(separator_line, 34, 0, 1, 3) # ## Buffer Title diff --git a/appPool.py b/appPool.py index 53ef440e..464fcbac 100644 --- a/appPool.py +++ b/appPool.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore +from PyQt6 import QtCore from multiprocessing import Pool, cpu_count import dill diff --git a/appProcess.py b/appProcess.py index d74847d8..f0be2ef5 100644 --- a/appProcess.py +++ b/appProcess.py @@ -7,7 +7,7 @@ # ########################################################## from appGUI.GUIElements import FlatCAMActivityView -from PyQt5 import QtCore +from PyQt6 import QtCore import weakref import gettext diff --git a/appTool.py b/appTool.py index 24542ebb..df78e1d2 100644 --- a/appTool.py +++ b/appTool.py @@ -6,7 +6,7 @@ # MIT Licence # # ########################################################## ## -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from shapely.geometry import Polygon, LineString @@ -36,7 +36,7 @@ class AppTool(QtWidgets.QWidget): self.app = app self.decimals = self.app.decimals - # self.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) + # self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Maximum, QtWidgets.QSizePolicy.Policy.Maximum) self.layout = QtWidgets.QVBoxLayout() self.setLayout(self.layout) @@ -60,7 +60,7 @@ class AppTool(QtWidgets.QWidget): before = (kwargs['before']) # create the new Action - self.menuAction = QtWidgets.QAction(self) + self.menuAction = QtGui.QAction(self) # if provided, add an icon to this Action if icon is not None: self.menuAction.setIcon(icon) diff --git a/appTranslation.py b/appTranslation.py index e6840162..9b302101 100644 --- a/appTranslation.py +++ b/appTranslation.py @@ -10,8 +10,8 @@ import sys import logging from pathlib import Path -from PyQt5 import QtWidgets, QtGui -from PyQt5.QtCore import QSettings +from PyQt6 import QtWidgets, QtGui +from PyQt6.QtCore import QSettings import gettext diff --git a/appWorker.py b/appWorker.py index 043c97cc..b871216b 100644 --- a/appWorker.py +++ b/appWorker.py @@ -6,7 +6,7 @@ # MIT Licence # # ########################################################## ## -from PyQt5 import QtCore +from PyQt6 import QtCore import traceback diff --git a/appWorkerStack.py b/appWorkerStack.py index 558040d0..cc9d348f 100644 --- a/appWorkerStack.py +++ b/appWorkerStack.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore +from PyQt6 import QtCore from appWorker import Worker @@ -24,7 +24,7 @@ class WorkerStack(QtCore.QObject): thread.started.connect(worker.run) worker.task_completed.connect(self.on_task_completed) - thread.start(QtCore.QThread.NormalPriority) + thread.start(QtCore.QThread.Priority.NormalPriority) self.workers.append(worker) self.threads.append(thread) diff --git a/app_Main.py b/app_Main.py index 86fab09a..77727ab0 100644 --- a/app_Main.py +++ b/app_Main.py @@ -448,7 +448,7 @@ class App(QtCore.QObject): if sys.platform == 'win32' or sys.platform == 'linux': # make sure the thread is stored by using a self. otherwise it's garbage collected self.listen_th = QtCore.QThread() - self.listen_th.start(priority=QtCore.QThread.LowestPriority) + self.listen_th.start(priority=QtCore.QThread.Priority.LowestPriority) self.new_launch = ArgsThread() self.new_launch.open_signal[list].connect(self.on_startup_args) @@ -885,18 +885,19 @@ class App(QtCore.QObject): if show_splash and self.cmd_line_headless != 1: splash_pix = QtGui.QPixmap(self.resource_location + '/splash.png') - self.splash = QtWidgets.QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) + self.splash = QtWidgets.QSplashScreen(splash_pix, Qt.WindowType.WindowStaysOnTopHint) # self.splash.setMask(splash_pix.mask()) # move splashscreen to the current monitor - desktop = QtWidgets.QApplication.desktop() - screen = desktop.screenNumber(QtGui.QCursor.pos()) - current_screen_center = desktop.availableGeometry(screen).center() + # desktop = QtWidgets.QApplication.desktop() + # screen = desktop.screenNumber(QtGui.QCursor.pos()) + screen = QtWidgets.QWidget.screen(self.splash) + current_screen_center = screen.availableGeometry().center() self.splash.move(current_screen_center - self.splash.rect().center()) self.splash.show() self.splash.showMessage(_("The application is initializing ..."), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) else: self.splash = None @@ -1002,17 +1003,17 @@ class App(QtCore.QObject): # add ToolTips for the Preprocessor ComboBoxes in Preferences for it in range(self.ui.plugin_pref_form.tools_solderpaste_group.pp_combo.count()): self.ui.plugin_pref_form.tools_solderpaste_group.pp_combo.setItemData( - it, self.ui.plugin_pref_form.tools_solderpaste_group.pp_combo.itemText(it), QtCore.Qt.ToolTipRole) + it, self.ui.plugin_pref_form.tools_solderpaste_group.pp_combo.itemText(it), QtCore.Qt.ItemDataRole.ToolTipRole) for it in range(self.ui.plugin_pref_form.tools_mill_group.pp_geometry_name_cb.count()): self.ui.plugin_pref_form.tools_mill_group.pp_geometry_name_cb.setItemData( it, self.ui.plugin_pref_form.tools_mill_group.pp_geometry_name_cb.itemText(it), - QtCore.Qt.ToolTipRole) + QtCore.Qt.ItemDataRole.ToolTipRole) for it in range(self.ui.plugin_pref_form.tools_drill_group.pp_excellon_name_cb.count()): self.ui.plugin_pref_form.tools_drill_group.pp_excellon_name_cb.setItemData( it, self.ui.plugin_pref_form.tools_drill_group.pp_excellon_name_cb.itemText(it), - QtCore.Qt.ToolTipRole) + QtCore.Qt.ItemDataRole.ToolTipRole) # ########################################################################################################### # ##################################### UPDATE PREFERENCES GUI FORMS ######################################## @@ -1123,7 +1124,7 @@ class App(QtCore.QObject): if show_splash: self.splash.showMessage(_("The application is initializing ...\n" "Canvas initialization started."), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) start_plot_time = time.time() # debug @@ -1163,7 +1164,7 @@ class App(QtCore.QObject): self.splash.showMessage('%s: %ssec' % (_("The application is initializing ...\n" "Canvas initialization started.\n" "Canvas initialization finished in"), '%.2f' % self.used_time), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) self.ui.splitter.setStretchFactor(1, 2) @@ -1276,7 +1277,7 @@ class App(QtCore.QObject): # self.thr2 = QtCore.QThread() self.worker_task.emit({'fcn': self.version_check, 'params': []}) - # self.thr2.start(QtCore.QThread.LowPriority) + # self.thr2.start(QtCore.QThread.Priority.LowPriority) # ########################################################################################################### # ##################################### Register files with FlatCAM; ####################################### @@ -1400,7 +1401,7 @@ class App(QtCore.QObject): # signals for displaying messages in the Tcl Shell are now connected in the ToolShell class # signal to be called when the app is quiting - self.app_quit.connect(self.quit_application, type=Qt.QueuedConnection) + self.app_quit.connect(self.quit_application, type=Qt.ConnectionType.QueuedConnection) self.message.connect(lambda: message_dialog(parent=self.ui)) # self.progress.connect(self.set_progress_bar) @@ -1870,7 +1871,8 @@ class App(QtCore.QObject): self.dblsidedtool.install(icon=QtGui.QIcon(self.resource_location + '/doubleside16.png'), separator=False) self.cal_exc_tool = ToolCalibration(self) - self.cal_exc_tool.install(icon=QtGui.QIcon(self.resource_location + '/calibrate_16.png'), pos=self.ui.menu_plugins, + self.cal_exc_tool.install(icon=QtGui.QIcon(self.resource_location + '/calibrate_16.png'), + pos=self.ui.menu_plugins, before=self.dblsidedtool.menuAction, separator=False) @@ -3254,7 +3256,7 @@ class App(QtCore.QObject): self.splash_tab_layout.addWidget(title, stretch=1) pal = QtGui.QPalette() - pal.setColor(QtGui.QPalette.Background, Qt.white) + pal.setColor(QtGui.QPalette.ColorRole.Base, Qt.GlobalColor.white) programmers = [ { @@ -3424,7 +3426,7 @@ class App(QtCore.QObject): prog_scroll = QtWidgets.QScrollArea() prog_scroll.setWidget(prog_widget) prog_scroll.setWidgetResizable(True) - prog_scroll.setFrameShape(QtWidgets.QFrame.NoFrame) + prog_scroll.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) prog_scroll.setPalette(pal) self.programmmers_tab_layout.addWidget(prog_scroll) @@ -3524,7 +3526,7 @@ class App(QtCore.QObject): trans_scroll = QtWidgets.QScrollArea() trans_scroll.setWidget(trans_widget) trans_scroll.setWidgetResizable(True) - trans_scroll.setFrameShape(QtWidgets.QFrame.NoFrame) + trans_scroll.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) trans_scroll.setPalette(pal) self.translators_tab_layout.addWidget(trans_scroll) @@ -3652,7 +3654,7 @@ class App(QtCore.QObject): # palette pal = QtGui.QPalette() - pal.setColor(QtGui.QPalette.Background, Qt.white) + pal.setColor(QtGui.QPalette.ColorRole.Base, Qt.GlobalColor.white) # layouts main_layout = QtWidgets.QVBoxLayout() @@ -3687,7 +3689,7 @@ class App(QtCore.QObject): intro_scroll_area = QtWidgets.QScrollArea() intro_scroll_area.setWidget(intro_wdg) intro_scroll_area.setWidgetResizable(True) - intro_scroll_area.setFrameShape(QtWidgets.QFrame.NoFrame) + intro_scroll_area.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) intro_scroll_area.setPalette(pal) self.grid_lay.addWidget(logo, 0, 0) @@ -3707,10 +3709,11 @@ class App(QtCore.QObject): links_scroll_area = QtWidgets.QScrollArea() links_scroll_area.setWidget(links_wdg) links_scroll_area.setWidgetResizable(True) - links_scroll_area.setFrameShape(QtWidgets.QFrame.NoFrame) + links_scroll_area.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) links_scroll_area.setPalette(pal) - self.links_lay.addWidget(QtWidgets.QLabel('%s' % _("Soon ...")), alignment=QtCore.Qt.AlignCenter) + self.links_lay.addWidget( + QtWidgets.QLabel('%s' % _("Soon ...")), alignment=QtCore.Qt.AlignmentFlag.AlignCenter) self.links_tab_layout.addWidget(links_scroll_area) # HOW TO section @@ -3726,10 +3729,11 @@ class App(QtCore.QObject): howto_scroll_area = QtWidgets.QScrollArea() howto_scroll_area.setWidget(howto_wdg) howto_scroll_area.setWidgetResizable(True) - howto_scroll_area.setFrameShape(QtWidgets.QFrame.NoFrame) + howto_scroll_area.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) howto_scroll_area.setPalette(pal) - self.howto_lay.addWidget(QtWidgets.QLabel('%s' % _("Soon ...")), alignment=QtCore.Qt.AlignCenter) + self.howto_lay.addWidget( + QtWidgets.QLabel('%s' % _("Soon ...")), alignment=QtCore.Qt.AlignmentFlag.AlignCenter) self.howto_tab_layout.addWidget(howto_scroll_area) # BUTTONS section @@ -3786,7 +3790,7 @@ class App(QtCore.QObject): title = bookmark[0] weblink = bookmark[1] - act = QtWidgets.QAction(parent=self.ui.menuhelp_bookmarks) + act = QtGui.QAction(parent=self.ui.menuhelp_bookmarks) act.setText(title) act.setIcon(QtGui.QIcon(self.resource_location + '/link16.png')) @@ -7017,7 +7021,7 @@ class App(QtCore.QObject): def set_grid(self): menu_action = self.sender() - assert isinstance(menu_action, QtWidgets.QAction), "Expected QAction got %s" % type(menu_action) + assert isinstance(menu_action, QtGui.QAction), "Expected QAction got %s" % type(menu_action) self.ui.grid_gap_x_entry.setText(menu_action.text()) self.ui.grid_gap_y_entry.setText(menu_action.text()) @@ -7308,7 +7312,7 @@ class App(QtCore.QObject): if event.button == 1: # left click modifiers = QtWidgets.QApplication.keyboardModifiers() # If the SHIFT key is pressed when LMB is clicked then the coordinates are copied to clipboard - if modifiers == QtCore.Qt.ShiftModifier: + if modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier: # do not auto open the Project Tab self.click_noproject = True @@ -7354,9 +7358,9 @@ class App(QtCore.QObject): return else: key_modifier = QtWidgets.QApplication.keyboardModifiers() - if key_modifier == QtCore.Qt.ShiftModifier: + if key_modifier == QtCore.Qt.KeyboardModifier.ShiftModifier: mod_key = 'Shift' - elif key_modifier == QtCore.Qt.ControlModifier: + elif key_modifier == QtCore.Qt.KeyboardModifier.ControlModifier: mod_key = 'Control' else: mod_key = None @@ -7983,7 +7987,7 @@ class App(QtCore.QObject): if dia_box.ok: # make sure to move first the cursor at the end so after finding the line the line will be positioned # at the top of the window - self.ui.plot_tab_area.currentWidget().code_editor.moveCursor(QTextCursor.End) + self.ui.plot_tab_area.currentWidget().code_editor.moveCursor(QTextCursor.MoveOperation.End) # get the document() of the AppTextEditor doc = self.ui.plot_tab_area.currentWidget().code_editor.document() # create a Text Cursor based on the searched line @@ -8164,7 +8168,7 @@ class App(QtCore.QObject): if recent['kind'] == 'project': try: - action = QtWidgets.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self) + action = QtGui.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self) # Attach callback o = make_callback(openers[recent["kind"]], recent['filename']) @@ -8176,7 +8180,7 @@ class App(QtCore.QObject): self.log.error("Unsupported file type: %s" % recent["kind"]) # Last action in Recent Files menu is one that Clear the content - clear_action_proj = QtWidgets.QAction(QtGui.QIcon(self.resource_location + '/trash32.png'), + clear_action_proj = QtGui.QAction(QtGui.QIcon(self.resource_location + '/trash32.png'), (_("Clear Recent projects")), self) clear_action_proj.triggered.connect(reset_recent_projects) self.ui.recent_projects.addSeparator() @@ -8188,7 +8192,7 @@ class App(QtCore.QObject): if recent['kind'] != 'project': try: - action = QtWidgets.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self) + action = QtGui.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self) # Attach callback o = make_callback(openers[recent["kind"]], recent['filename']) @@ -8200,7 +8204,7 @@ class App(QtCore.QObject): self.log.error("Unsupported file type: %s" % recent["kind"]) # Last action in Recent Files menu is one that Clear the content - clear_action = QtWidgets.QAction(QtGui.QIcon(self.resource_location + '/trash32.png'), + clear_action = QtGui.QAction(QtGui.QIcon(self.resource_location + '/trash32.png'), (_("Clear Recent files")), self) clear_action.triggered.connect(reset_recent_files) self.ui.recent.addSeparator() @@ -8228,7 +8232,7 @@ class App(QtCore.QObject): # sel_title = QtWidgets.QTextEdit() # sel_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) - # sel_title.setFrameStyle(QtWidgets.QFrame.NoFrame) + # sel_title.setFrameStyle(QtWidgets.QFrame.Shape.NoFrame) # # f_settings = QSettings("Open Source", "FlatCAM") # if f_settings.contains("notebook_font_size"): @@ -8241,12 +8245,12 @@ class App(QtCore.QObject): # selected_text = '' # # sel_title.setText(selected_text) - # sel_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + # sel_title.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) # Tree Widget d_properties_tw = FCTree(columns=2) d_properties_tw.setObjectName("default_properties") - d_properties_tw.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + d_properties_tw.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) d_properties_tw.setStyleSheet("QTreeWidget {border: 0px;}") root = d_properties_tw.invisibleRootItem() @@ -8396,7 +8400,7 @@ class App(QtCore.QObject): plot_container = self.ui.right_layout modifier = QtWidgets.QApplication.queryKeyboardModifiers() - if self.is_legacy is True or modifier == QtCore.Qt.ControlModifier: + 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) @@ -9057,7 +9061,7 @@ class MenuFileHandlers(QtCore.QObject): "Canvas initialization finished in"), '%.2f' % self.app.used_time, _("Opening Gerber file.")), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) if len(filenames) == 0: @@ -9096,7 +9100,7 @@ class MenuFileHandlers(QtCore.QObject): "Canvas initialization finished in"), '%.2f' % self.app.used_time, _("Opening Excellon file.")), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) if len(filenames) == 0: @@ -9140,7 +9144,7 @@ class MenuFileHandlers(QtCore.QObject): "Canvas initialization finished in"), '%.2f' % self.app.used_time, _("Opening G-Code file.")), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) if len(filenames) == 0: @@ -9206,7 +9210,7 @@ class MenuFileHandlers(QtCore.QObject): "Canvas initialization finished in"), '%.2f' % self.app.used_time, _("Opening HPGL2 file.")), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) if len(filenames) == 0: @@ -9960,7 +9964,7 @@ class MenuFileHandlers(QtCore.QObject): "Canvas initialization finished in"), '%.2f' % self.app.used_time, _("Executing ScriptObject file.") ), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) else: _filter_ = "TCL script .FlatScript (*.FlatScript);;TCL script .tcl (*.TCL);;TCL script .txt (*.TXT);;" \ @@ -11253,7 +11257,7 @@ class MenuFileHandlers(QtCore.QObject): "Canvas initialization finished in"), '%.2f' % self.app.used_time, _("Opening FlatCAM Config file.")), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) # # add the tab if it was closed # self.ui.plot_tab_area.addTab(self.ui.text_editor_tab, _("Code Editor")) @@ -11318,7 +11322,7 @@ class MenuFileHandlers(QtCore.QObject): "Canvas initialization finished in"), '%.2f' % self.app.used_time, _("Opening FlatCAM Project file.")), - alignment=Qt.AlignBottom | Qt.AlignLeft, + alignment=Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft, color=QtGui.QColor("gray")) # Open and parse an uncompressed Project file diff --git a/camlib.py b/camlib.py index 33655a3a..06b8683f 100644 --- a/camlib.py +++ b/camlib.py @@ -7,7 +7,7 @@ # ########################################################## ## -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from io import StringIO from numpy.linalg import solve, norm diff --git a/requirements.txt b/requirements.txt index f228e5ec..8451a941 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,7 +28,7 @@ gdal pyserial>=3.4 pikepdf>=2.0 pywin32>2.0 -pyqt5>=5.12.1 +pyqt6>=6.0.0 vispy rasterio foronoi>=1.0.3 diff --git a/setup_ubuntu.sh b/setup_ubuntu.sh index 3d446989..4d1710b3 100644 --- a/setup_ubuntu.sh +++ b/setup_ubuntu.sh @@ -12,8 +12,8 @@ sudo apt-get install -y \ python3-dev \ python3-gdal \ python3-pip \ - python3-pyqt5 \ - python3-pyqt5.qtopengl \ + python3-pyqt6 \ + python3-pyqt6.qtopengl \ python3-simplejson \ python3-tk @@ -42,7 +42,7 @@ sudo -H python3 -m pip install --upgrade \ ezdxf \ matplotlib \ qrcode \ - pyqt5 \ + pyqt6 \ reportlab \ svglib \ pyserial \ diff --git a/tclCommands/TclCommand.py b/tclCommands/TclCommand.py index 2ab164ec..c8fa8036 100644 --- a/tclCommands/TclCommand.py +++ b/tclCommands/TclCommand.py @@ -3,7 +3,7 @@ import re import app_Main import abc import collections -from PyQt5 import QtCore +from PyQt6 import QtCore from contextlib import contextmanager diff --git a/tclCommands/TclCommandOpenFolder.py b/tclCommands/TclCommandOpenFolder.py index 0080822d..e5586d6d 100644 --- a/tclCommands/TclCommandOpenFolder.py +++ b/tclCommands/TclCommandOpenFolder.py @@ -1,5 +1,5 @@ from tclCommands.TclCommand import * -from PyQt5.QtWidgets import QFileDialog +from PyQt6.QtWidgets import QFileDialog class TclCommandOpenFolder(TclCommand):