- porting to PyQt6
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user