diff --git a/configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py b/configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py
index a264f75177a..70b6b3ceee1 100644
--- a/configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py
+++ b/configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py
@@ -66,7 +66,7 @@ def __init__(self, halcomp, widgets, paths):
self.w = widgets
self.gcodes = GCodes(widgets)
# This validator precludes using comma as a decimal
- self.valid = QtGui.QRegExpValidator(QtCore.QRegExp('-?[0-9]{0,6}[.][0-9]{0,3}'))
+ self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('-?[0-9]{0,6}[.][0-9]{0,3}'))
self.KEYBIND = KEYBIND
KEYBIND.add_call('Key_F11','on_keycall_F11')
KEYBIND.add_call('Key_F12','on_keycall_F12')
diff --git a/configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py b/configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py
index b0c823d4c24..4efd28be1c6 100644
--- a/configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py
+++ b/configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py
@@ -63,7 +63,7 @@ def __init__(self, halcomp, widgets, paths):
self.PATHS = paths
self.gcodes = GCodes(widgets)
self._last_count = 0
- self.valid = QtGui.QRegExpValidator(QtCore.QRegExp('-?[0-9]{0,6}[.][0-9]{0,3}'))
+ self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('-?[0-9]{0,6}[.][0-9]{0,3}'))
self.styleeditor = SSE(widgets, paths)
KEYBIND.add_call('Key_F10','on_keycall_F10')
KEYBIND.add_call('Key_F11','on_keycall_F11')
diff --git a/lib/python/qtvcp/lib/auto_height/auto_height.py b/lib/python/qtvcp/lib/auto_height/auto_height.py
index 31d7e672c33..ea46da9a07b 100644
--- a/lib/python/qtvcp/lib/auto_height/auto_height.py
+++ b/lib/python/qtvcp/lib/auto_height/auto_height.py
@@ -231,4 +231,4 @@ def __setitem__(self, item, value):
app = QtWidgets.QApplication(sys.argv)
w = Auto_Measure()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/lib/gcode_utility/facing.py b/lib/python/qtvcp/lib/gcode_utility/facing.py
index 0b11be2d25d..94915e82839 100644
--- a/lib/python/qtvcp/lib/gcode_utility/facing.py
+++ b/lib/python/qtvcp/lib/gcode_utility/facing.py
@@ -7,7 +7,7 @@
import shutil
from qtpy import QtGui, QtWidgets, uic
-from qtpy.QtCore import QFile, QRegExp
+from qtpy.QtCore import QFile, QRegularExpression
from qtpy.QtWidgets import QFileDialog, QMessageBox
from linuxcnc import OPERATOR_ERROR, NML_ERROR
@@ -107,15 +107,15 @@ def units_changed(self):
def set_validator(self):
# set valid input formats for lineEdits
if self.rbtn_inch.isChecked():
- valid_size = QtGui.QRegExpValidator(QRegExp('[0-9]{0,6}[.][0-9]{0,4}'))
- valid_step = QtGui.QRegExpValidator(QRegExp('[0-9]{0,6}[.][0-9]{0,2}'))
- valid_feed = QtGui.QRegExpValidator(QRegExp('[0-9]{0,6}[.][0-9]{0,3}'))
+ valid_size = QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,6}[.][0-9]{0,4}'))
+ valid_step = QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,6}[.][0-9]{0,2}'))
+ valid_feed = QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,6}[.][0-9]{0,3}'))
else:
- valid_size = QtGui.QRegExpValidator(QRegExp('[0-9]{0,6}[.][0-9]{0,3}'))
- valid_step = QtGui.QRegExpValidator(QRegExp('[0-9]{0,5}[.][0-9]{0,1}'))
- valid_feed = QtGui.QRegExpValidator(QRegExp('[0-9]{0,5}[.][0-9]{0,1}'))
+ valid_size = QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,6}[.][0-9]{0,3}'))
+ valid_step = QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,5}[.][0-9]{0,1}'))
+ valid_feed = QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,5}[.][0-9]{0,1}'))
self.lineEdit_tool.setValidator(valid_size)
- self.lineEdit_spindle.setValidator(QtGui.QRegExpValidator(QRegExp('[0-9]{0,5}')))
+ self.lineEdit_spindle.setValidator(QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,5}')))
self.lineEdit_feedrate.setValidator(valid_feed)
self.lineEdit_stepover.setValidator(valid_step)
self.lineEdit_size_x.setValidator(valid_size)
@@ -462,5 +462,5 @@ def _mktemp(self):
app = QtWidgets.QApplication(sys.argv)
w = Facing()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/lib/gcode_utility/hole_circle.py b/lib/python/qtvcp/lib/gcode_utility/hole_circle.py
index f0f2a79db15..7a611073e24 100644
--- a/lib/python/qtvcp/lib/gcode_utility/hole_circle.py
+++ b/lib/python/qtvcp/lib/gcode_utility/hole_circle.py
@@ -8,7 +8,7 @@
import shutil
from qtpy import QtGui, QtWidgets, uic
-from qtpy.QtCore import QPoint, QPointF, QLine, QRect, QFile, Qt, QEvent, QRegExp
+from qtpy.QtCore import QPoint, QPointF, QLine, QRect, QFile, Qt, QEvent, QRegularExpression
from qtpy.QtWidgets import QFileDialog, QMessageBox
from qtpy.QtGui import QPainter, QBrush, QPen, QColor
@@ -168,18 +168,18 @@ def units_changed(self):
def set_validator(self):
# set valid input formats for lineEdits
if self.btn_inch.isChecked():
- valid_size = QtGui.QRegExpValidator(QRegExp(r'^((\d+(\.\d{,4})?)|(\.\d{,4}))$'))
- valid_radius = QtGui.QRegExpValidator(QRegExp(r'^((\d{1,3}(\.\d{1,4})?)|(\.\d{1,4}))$'))
- valid_feed = QtGui.QRegExpValidator(QRegExp('[0-9]{0,6}[.][0-9]{0,3}'))
+ valid_size = QtGui.QRegularExpressionValidator(QRegularExpression(r'^((\d+(\.\d{,4})?)|(\.\d{,4}))$'))
+ valid_radius = QtGui.QRegularExpressionValidator(QRegularExpression(r'^((\d{1,3}(\.\d{1,4})?)|(\.\d{1,4}))$'))
+ valid_feed = QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,6}[.][0-9]{0,3}'))
else:
- valid_size = QtGui.QRegExpValidator(QRegExp(r'^((\d+(\.\d{,3})?)|(\.\d{,3}))$'))
- valid_radius = QtGui.QRegExpValidator(QRegExp(r'^((\d{1,4}(\.\d{1,3})?)|(\.\d{1,3}))$'))
- valid_feed = QtGui.QRegExpValidator(QRegExp(r'\d{0,5}[.]\d{0,1}'))
+ valid_size = QtGui.QRegularExpressionValidator(QRegularExpression(r'^((\d+(\.\d{,3})?)|(\.\d{,3}))$'))
+ valid_radius = QtGui.QRegularExpressionValidator(QRegularExpression(r'^((\d{1,4}(\.\d{1,3})?)|(\.\d{1,3}))$'))
+ valid_feed = QtGui.QRegularExpressionValidator(QRegularExpression(r'\d{0,5}[.]\d{0,1}'))
- self.lineEdit_spindle.setValidator(QtGui.QRegExpValidator(QRegExp(r'\d{0,5}')))
+ self.lineEdit_spindle.setValidator(QtGui.QRegularExpressionValidator(QRegularExpression(r'\d{0,5}')))
self.lineEdit_num_holes.setValidator(QtGui.QDoubleValidator(0, 99, 0))
self.lineEdit_radius.setValidator(valid_radius)
- self.lineEdit_first.setValidator(QtGui.QRegExpValidator(QRegExp(r'\d{0,3}[.]\d{0,2}')))
+ self.lineEdit_first.setValidator(QtGui.QRegularExpressionValidator(QRegularExpression(r'\d{0,3}[.]\d{0,2}')))
self.lineEdit_safe_z.setValidator(valid_size)
self.lineEdit_start_height.setValidator(valid_size)
self.lineEdit_depth.setValidator(valid_size)
@@ -396,5 +396,5 @@ def next_line(self, text):
w = Hole_Circle()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/lib/gcode_utility/hole_enlarge.py b/lib/python/qtvcp/lib/gcode_utility/hole_enlarge.py
index 54365ac296b..bd799acaed0 100644
--- a/lib/python/qtvcp/lib/gcode_utility/hole_enlarge.py
+++ b/lib/python/qtvcp/lib/gcode_utility/hole_enlarge.py
@@ -57,15 +57,15 @@ def __init__(self, parent=None):
except AttributeError as e:
print("Error: ", e)
- self.lineEdit_tool.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,5}')))
- self.lineEdit_spindle.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,5}')))
- self.lineEdit_feed.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,4}')))
- self.lineEdit_tool_dia.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,3}[.][0-9]{0,4}')))
- self.lineEdit_start_dia.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,5}[.][0-9]{0,4}')))
- self.lineEdit_final_dia.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,5}[.][0-9]{0,4}')))
- self.lineEdit_loops.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,2}')))
- self.lineEdit_cut_depth.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,4}[.][0-9]{0,4}')))
- self.lineEdit_z_safe.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{0,4}')))
+ self.lineEdit_tool.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,5}')))
+ self.lineEdit_spindle.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,5}')))
+ self.lineEdit_feed.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,4}')))
+ self.lineEdit_tool_dia.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,3}[.][0-9]{0,4}')))
+ self.lineEdit_start_dia.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,5}[.][0-9]{0,4}')))
+ self.lineEdit_final_dia.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,5}[.][0-9]{0,4}')))
+ self.lineEdit_loops.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,2}')))
+ self.lineEdit_cut_depth.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,4}[.][0-9]{0,4}')))
+ self.lineEdit_z_safe.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('[0-9]{0,4}')))
self.red_border = "border: 2px solid red;"
self.black_border = "border: 2px solid black;"
@@ -381,5 +381,5 @@ def __setitem__(self, item, value):
app = QtWidgets.QApplication(sys.argv)
w = Hole_Enlarge()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/lib/mdi_subprogram/mdi_command_process.py b/lib/python/qtvcp/lib/mdi_subprogram/mdi_command_process.py
index 6b3559dc860..ee6043820b8 100644
--- a/lib/python/qtvcp/lib/mdi_subprogram/mdi_command_process.py
+++ b/lib/python/qtvcp/lib/mdi_subprogram/mdi_command_process.py
@@ -137,5 +137,5 @@ def __setitem__(self, item, value):
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/lib/message.py b/lib/python/qtvcp/lib/message.py
index 21378bfa144..3cc844b7034 100644
--- a/lib/python/qtvcp/lib/message.py
+++ b/lib/python/qtvcp/lib/message.py
@@ -295,4 +295,4 @@ def callreturn(dialog, btn, pinname):
w.setWindowTitle("PyQt Dialog demo")
w.setGeometry(300, 300, 300, 150)
w.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py b/lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py
index c391b1c8907..a871520103d 100644
--- a/lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py
+++ b/lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py
@@ -22,7 +22,7 @@
import datetime
import shutil
from qtpy import QtGui, QtWidgets, QtCore, uic
-from qtpy.QtCore import QRegExp
+from qtpy.QtCore import QRegularExpression
from qtpy.QtWidgets import QFileDialog, QHBoxLayout, QVBoxLayout, QLabel, QWidget, QLineEdit, QMessageBox
from qtvcp.core import Action, Info, Path
from qtvcp import logger
@@ -150,8 +150,8 @@ def new_label(self, width, text):
return lbl
def new_lineedit(self, key, data):
- # QRegExp('^[+-]?((\d+(\.\d{,4})?)|(\.\d{,4}))$' allows max 4 digits after the decimal
- valid = QtGui.QRegExpValidator(QRegExp(r'^[+-]?((\d+(\.\d{,4})?)|(\.\d{,4}))$'))
+ # QRegularExpression('^[+-]?((\d+(\.\d{,4})?)|(\.\d{,4}))$' allows max 4 digits after the decimal
+ valid = QtGui.QRegularExpressionValidator(QRegularExpression(r'^[+-]?((\d+(\.\d{,4})?)|(\.\d{,4}))$'))
lineedit = QLineEdit(str(data))
lineedit.parm_no = key
lineedit.setMaxLength(10)
@@ -1011,5 +1011,5 @@ def save_a_copy(fname, archive_dir='/tmp/old_ngc'):
app = QtWidgets.QApplication(sys.argv)
w = NgcGui()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/lib/qt_pdf/PDFViewer.py b/lib/python/qtvcp/lib/qt_pdf/PDFViewer.py
index 4d84f566fd3..e3b9672995f 100644
--- a/lib/python/qtvcp/lib/qt_pdf/PDFViewer.py
+++ b/lib/python/qtvcp/lib/qt_pdf/PDFViewer.py
@@ -150,7 +150,7 @@ def main():
filename = argv[-1]
view = pdf_view(filename)
view.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == '__main__':
main()
diff --git a/lib/python/qtvcp/lib/qt_vismach/qt_vismach.py b/lib/python/qtvcp/lib/qt_vismach/qt_vismach.py
index ec6bd1d4b08..8df1af49545 100644
--- a/lib/python/qtvcp/lib/qt_vismach/qt_vismach.py
+++ b/lib/python/qtvcp/lib/qt_vismach/qt_vismach.py
@@ -471,7 +471,7 @@ def main(model, tool, work, size=10, hud=None, rotation_vectors=None, lat=0, lon
window.setZoomRange(int(t.near),int(t.far))
window.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == '__main__':
diff --git a/lib/python/qtvcp/lib/qtplasmac/conversational.py b/lib/python/qtvcp/lib/qtplasmac/conversational.py
index 0e73682dec4..845db5a3916 100644
--- a/lib/python/qtvcp/lib/qtplasmac/conversational.py
+++ b/lib/python/qtvcp/lib/qtplasmac/conversational.py
@@ -250,7 +250,7 @@ def conv_save_pressed(P, W):
dlg.setDefaultSuffix('ngc')
dlg.setDirectory(P.programPrefix)
name = ''
- if dlg.exec_():
+ if dlg.exec():
name = dlg.selectedFiles()[0]
if name:
COPY(P.fNgc, name)
diff --git a/lib/python/qtvcp/lib/sys_notify.py b/lib/python/qtvcp/lib/sys_notify.py
index 7d0bbcdf697..ec46e20a61a 100644
--- a/lib/python/qtvcp/lib/sys_notify.py
+++ b/lib/python/qtvcp/lib/sys_notify.py
@@ -283,4 +283,4 @@ def onClose(n):
n.onClose(onClose)
n.show()
- app.exec_()
+ app.exec()
diff --git a/lib/python/qtvcp/lib/toolbar_actions.py b/lib/python/qtvcp/lib/toolbar_actions.py
index 3492c8d7c8b..377992827d3 100644
--- a/lib/python/qtvcp/lib/toolbar_actions.py
+++ b/lib/python/qtvcp/lib/toolbar_actions.py
@@ -454,7 +454,7 @@ def actOnProperties(self, widget, state=None):
msg.setWindowTitle("Gcode Properties")
msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
msg.show()
- retval = msg.exec_()
+ retval = msg.exec()
def actOnRun(self, widget, state=None):
ACTION.RUN()
@@ -580,7 +580,7 @@ def actOnAbout(self, widget, state=None):
msg.setIcon(QtWidgets.QMessageBox.Information)
msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
msg.show()
- retval = msg.exec_()
+ retval = msg.exec()
def actOnRunFromLine(self, widget, state=False):
STATUS.emit('dialog-request', {'NAME': 'RUNFROMLINE', 'LINE':self.selected_line})
diff --git a/lib/python/qtvcp/lib/writer/writer.py b/lib/python/qtvcp/lib/writer/writer.py
index b7ad21a887a..d9dba465455 100755
--- a/lib/python/qtvcp/lib/writer/writer.py
+++ b/lib/python/qtvcp/lib/writer/writer.py
@@ -374,7 +374,7 @@ def closeEvent(self, event):
popup.setDefaultButton(QtWidgets.QMessageBox.Save)
- answer = popup.exec_()
+ answer = popup.exec()
if answer == QtWidgets.QMessageBox.Save:
self.save()
@@ -611,14 +611,14 @@ def preview(self):
# If a print is requested, open print dialog
preview.paintRequested.connect(lambda p: self.text.print_(p))
- preview.exec_()
+ preview.exec()
def printHandler(self):
# Open printing dialog
dialog = QtPrintSupport.QPrintDialog()
- if dialog.exec_() == QtWidgets.QDialog.Accepted:
+ if dialog.exec() == QtWidgets.QDialog.Accepted:
self.text.document().print_(dialog.printer())
def cursorPosition(self):
@@ -874,7 +874,7 @@ def main():
main = Main()
main.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
diff --git a/lib/python/qtvcp/plugins/actionbutton_plugin.py b/lib/python/qtvcp/plugins/actionbutton_plugin.py
index 94979c04e27..08c4683ac4d 100644
--- a/lib/python/qtvcp/plugins/actionbutton_plugin.py
+++ b/lib/python/qtvcp/plugins/actionbutton_plugin.py
@@ -1051,63 +1051,63 @@ def updateWidget(self):
if formWindow:
# set widget option
formWindow.cursor().setProperty('indicator_option',
- QtCore.QVariant(self.indicatorCheckBox.isChecked()))
+ self.indicatorCheckBox.isChecked())
formWindow.cursor().setProperty('python_command_option',
- QtCore.QVariant(self.pythonCheckBox.isChecked()))
+ self.pythonCheckBox.isChecked())
formWindow.cursor().setProperty('checked_state_text_option',
- QtCore.QVariant(self.textCheckBox.isChecked()))
+ self.textCheckBox.isChecked())
formWindow.cursor().setProperty('indicator_HAL_pin_option',
- QtCore.QVariant(self.halCheckBox.isChecked()))
+ self.halCheckBox.isChecked())
formWindow.cursor().setProperty('indicator_status_option',
- QtCore.QVariant(self.statusCheckBox.isChecked()))
+ self.statusCheckBox.isChecked())
formWindow.cursor().setProperty('indicator_size',
- QtCore.QVariant(self.floatSpinBox.value()))
+ self.floatSpinBox.value())
formWindow.cursor().setProperty('right_edge_offset',
- QtCore.QVariant(self.rightedgeoffsetSpinBox.value()))
+ self.rightedgeoffsetSpinBox.value())
formWindow.cursor().setProperty('top_edge_offset',
- QtCore.QVariant(self.topedgeoffsetSpinBox.value()))
+ self.topedgeoffsetSpinBox.value())
formWindow.cursor().setProperty('corner_radius',
- QtCore.QVariant(self.radiusSpinBox.value()))
+ self.radiusSpinBox.value())
formWindow.cursor().setProperty('height_fraction',
- QtCore.QVariant(self.hfractionSpinBox.value()))
+ self.hfractionSpinBox.value())
formWindow.cursor().setProperty('width_fraction',
- QtCore.QVariant(self.wfractionSpinBox.value()))
+ self.wfractionSpinBox.value())
formWindow.cursor().setProperty('circle_diameter',
- QtCore.QVariant(self.diamSpinBox.value()))
+ self.diamSpinBox.value())
formWindow.cursor().setProperty('shape_option',
- QtCore.QVariant(self.shapeCombo.itemData(
- self.shapeCombo.currentIndex())))
+ self.shapeCombo.itemData(
+ self.shapeCombo.currentIndex()))
formWindow.cursor().setProperty('joint_number_status',
- QtCore.QVariant(self.jnumCombo.itemData(
- self.jnumCombo.currentIndex())))
+ self.jnumCombo.itemData(
+ self.jnumCombo.currentIndex()))
formWindow.cursor().setProperty('on_color',
- QtCore.QVariant(self._onColor))
+ self._onColor)
formWindow.cursor().setProperty('off_color',
- QtCore.QVariant(self._offColor))
+ self._offColor)
formWindow.cursor().setProperty('true_state_string',
- QtCore.QVariant(self.tTextEditBox.text()))
+ self.tTextEditBox.text())
formWindow.cursor().setProperty('false_state_string',
- QtCore.QVariant(self.fTextEditBox.text()))
+ self.fTextEditBox.text())
formWindow.cursor().setProperty('true_python_cmd_string',
- QtCore.QVariant(self.tCommandEditBox.text()))
+ self.tCommandEditBox.text())
formWindow.cursor().setProperty('false_python_cmd_string',
- QtCore.QVariant(self.fCommandEditBox.text()))
+ self.fCommandEditBox.text())
if formWindow and winProperty == 'unused':
formWindow.cursor().setProperty('estop_action',
- QtCore.QVariant(True))
+ True)
formWindow.cursor().setProperty('estop_action',
- QtCore.QVariant(False))
+ False)
elif formWindow:
# set widget option
formWindow.cursor().setProperty(winProperty + '_action',
- QtCore.QVariant(True))
+ True)
# set status data from combo box
# we read all data from combo and set each property to its
# current dialog state (ie. selected is true, all others false)
@@ -1119,43 +1119,43 @@ def updateWidget(self):
else:
state = False
formWindow.cursor().setProperty(propertyText,
- QtCore.QVariant(state))
+ state)
formWindow.cursor().setProperty('invert_the_status',
- QtCore.QVariant(self.invertCheckBox.isChecked()))
+ self.invertCheckBox.isChecked())
#####################
# set related data
#####################
formWindow.cursor().setProperty('joint_number',
- QtCore.QVariant(self.JNumSpinBox.value()))
+ self.JNumSpinBox.value())
formWindow.cursor().setProperty('incr_imperial_number',
- QtCore.QVariant(self.jogIncImpSpinBox.value()))
+ self.jogIncImpSpinBox.value())
formWindow.cursor().setProperty('incr_mm_number',
- QtCore.QVariant(self.jogIncMMSpinBox.value()))
+ self.jogIncMMSpinBox.value())
formWindow.cursor().setProperty('incr_angular_number',
- QtCore.QVariant(self.jogIncAngSpinBox.value()))
+ self.jogIncAngSpinBox.value())
formWindow.cursor().setProperty('float_num',
- QtCore.QVariant(self.floatSpinBox.value()))
+ self.floatSpinBox.value())
formWindow.cursor().setProperty('float_alt_num',
- QtCore.QVariant(self.floatAltSpinBox.value()))
+ self.floatAltSpinBox.value())
formWindow.cursor().setProperty('view_type_string',
- QtCore.QVariant(self.viewComboBox.currentText()))
+ self.viewComboBox.currentText())
formWindow.cursor().setProperty('toggle_float_option',
- QtCore.QVariant(self.toggleCheckBox.isChecked()))
+ self.toggleCheckBox.isChecked())
formWindow.cursor().setProperty('command_text_string',
- QtCore.QVariant(self.commandEditBox.text()))
+ self.commandEditBox.text())
formWindow.cursor().setProperty('ini_mdi_number',
- QtCore.QVariant(self.MDISpinBox.value()))
+ self.MDISpinBox.value())
formWindow.cursor().setProperty('template_label_option',
- QtCore.QVariant(self.textTemplateCheckBox.isChecked()))
+ self.textTemplateCheckBox.isChecked())
# block signal so button text doesn't change when selecting action
self.widget._designer_block_signal = True
formWindow.cursor().setProperty('text',
- QtCore.QVariant(self.defaultTextTemplateEditBox.text()))
+ self.defaultTextTemplateEditBox.text())
formWindow.cursor().setProperty('textTemplate',
- QtCore.QVariant(self.textTemplateEditBox.text()))
+ self.textTemplateEditBox.text())
formWindow.cursor().setProperty('alt_textTemplate',
- QtCore.QVariant(self.altTextTemplateEditBox.text()))
+ self.altTextTemplateEditBox.text())
self.widget._designer_block_signal = False
self.accept()
@@ -1188,7 +1188,7 @@ def taskActions(self):
def updateOptions(self):
dialog = ActionButtonDialog(self.widget)
- dialog.exec_()
+ dialog.exec()
class ActionButtonTaskMenuFactory(QExtensionFactory):
diff --git a/lib/python/qtvcp/plugins/screenoptions_plugin.py b/lib/python/qtvcp/plugins/screenoptions_plugin.py
index fc5ca12b6be..96cf1b286cd 100644
--- a/lib/python/qtvcp/plugins/screenoptions_plugin.py
+++ b/lib/python/qtvcp/plugins/screenoptions_plugin.py
@@ -118,19 +118,19 @@ def updateWidget(self):
if formWindow:
formWindow.cursor().setProperty("notify_option",
- QtCore.QVariant(self.c_notify.isChecked()))
+ self.c_notify.isChecked())
formWindow.cursor().setProperty("notify_max_messages",
- QtCore.QVariant(self.c_notify_max_msgs.value()))
+ self.c_notify_max_msgs.value())
formWindow.cursor().setProperty("catch_errors_option",
- QtCore.QVariant(self.c_errors.isChecked()))
+ self.c_errors.isChecked())
formWindow.cursor().setProperty("catch_close_option",
- QtCore.QVariant(self.c_close.isChecked()))
+ self.c_close.isChecked())
formWindow.cursor().setProperty("play_sounds_option",
- QtCore.QVariant(self.c_play_sounds.isChecked()))
+ self.c_play_sounds.isChecked())
formWindow.cursor().setProperty("use_pref_file_option",
- QtCore.QVariant(self.c_use_pref_file.isChecked()))
+ self.c_use_pref_file.isChecked())
formWindow.cursor().setProperty("halCompBaseName",
- QtCore.QVariant(self.e_hal_base_name.text()))
+ self.e_hal_base_name.text())
self.accept()
@@ -152,7 +152,7 @@ def taskActions(self):
def updateLocation(self):
dialog = screenOptionsDialog(self.widget)
- dialog.exec_()
+ dialog.exec()
class screenOptionsTaskMenuFactory(QExtensionFactory):
diff --git a/lib/python/qtvcp/plugins/status_label_plugin.py b/lib/python/qtvcp/plugins/status_label_plugin.py
index b50b6424144..a6dfa3c7502 100644
--- a/lib/python/qtvcp/plugins/status_label_plugin.py
+++ b/lib/python/qtvcp/plugins/status_label_plugin.py
@@ -2,7 +2,6 @@
from qtpy import QtCore, QtGui, QtWidgets
from qtpy.QtGui import QIcon, QPixmap
-from qtpy.QtCore import QVariant
from qtpy.QtDesigner import QPyDesignerCustomWidgetPlugin, QExtensionFactory, QPyDesignerTaskMenuExtension, \
QPyDesignerPropertySheetExtension, QDesignerFormWindowInterface
@@ -117,12 +116,12 @@ def property(self, index):
name = self.propertyName(index)
print('property index:', index, name)
if 'object' in name:
- return QVariant('default')
+ return 'default'
if 'orient' in name:
- return QVariant(False)
+ return False
if 'text' == name or 'alt' in name:
- return QVariant(self.widget.text)
- return QVariant(self.widget[str(name)])
+ return self.widget.text
+ return self.widget[str(name)]
def indexOf(self, name):
# print 'NAME:',name
@@ -170,7 +169,7 @@ def setProperty(self, index, vvalue):
return
if self.formWindow:
- self.formWindow.cursor().setProperty(self.propertyName(index), QVariant(value))
+ self.formWindow.cursor().setProperty(self.propertyName(index), value)
return
def getVisible(self, index, data):
@@ -208,7 +207,7 @@ def taskActions(self):
def updateOptions(self):
dialog = StatusLabelDialog(self.widget)
- dialog.exec_()
+ dialog.exec()
class StatusLabelTaskMenuFactory(QExtensionFactory):
@@ -510,27 +509,27 @@ def updateWidget(self):
if formWindow and winProperty == 'unused':
formWindow.cursor().setProperty('feed_override_status',
- QtCore.QVariant(True))
+ True)
formWindow.cursor().setProperty('feed_override_status',
- QtCore.QVariant(False))
+ False)
elif formWindow:
# set widget option
formWindow.cursor().setProperty(winProperty + '_status',
- QtCore.QVariant(True))
+ True)
# set related data
formWindow.cursor().setProperty('index_number',
- QtCore.QVariant(self.JNumSpinBox.value()))
+ self.JNumSpinBox.value())
# block signal so button text doesn't change when selecting action
self.widget._designer_block_signal = True
formWindow.cursor().setProperty('textTemplate',
- QtCore.QVariant(self.textTemplateEditBox.text()))
+ self.textTemplateEditBox.text())
formWindow.cursor().setProperty('alt_textTemplate',
- QtCore.QVariant(self.altTextTemplateEditBox.text()))
+ self.altTextTemplateEditBox.text())
formWindow.cursor().setProperty('text',
- QtCore.QVariant(self.defaultTextTemplateEditBox.text()))
+ self.defaultTextTemplateEditBox.text())
formWindow.cursor().setProperty('halpin_name',
- QtCore.QVariant(self.halpinEditBox.text()))
+ self.halpinEditBox.text())
self.widget._designer_block_signal = False
self.accept()
diff --git a/lib/python/qtvcp/qt_makegui.py b/lib/python/qtvcp/qt_makegui.py
index 38705507222..f31cff51374 100644
--- a/lib/python/qtvcp/qt_makegui.py
+++ b/lib/python/qtvcp/qt_makegui.py
@@ -13,6 +13,47 @@
# Force the log level for this module
#log.setLevel(logger.DEBUG) # One of DEBUG, INFO, WARNING, ERROR, CRITICAL
+# PyQt6 raises KeyError when a .ui file signal connection references an overloaded
+# signal type that no longer exists (e.g. 'bool' subscript on a non-overloaded signal).
+# Patch _handle_connections to skip bad connections rather than aborting the whole load.
+try:
+ from PyQt6.uic import uiparser as _uiparser
+ from PyQt6 import QtCore as _QtCore
+
+ def _tolerant_handle_connections(self, el):
+ def name2object(obj):
+ if obj == self.uiname:
+ return self.toplevelWidget
+ else:
+ return getattr(self.toplevelWidget, obj)
+
+ for conn in el:
+ signal = conn.findtext('signal')
+ signal_name, signal_args = signal.split('(')
+ signal_args = signal_args[:-1].replace(' ', '')
+ sender = name2object(conn.findtext('sender'))
+ bound_signal = getattr(sender, signal_name)
+ slot = self.factory.getSlot(name2object(conn.findtext('receiver')),
+ conn.findtext('slot').split('(')[0])
+ try:
+ if signal_args == '':
+ bound_signal.connect(slot)
+ else:
+ signal_args_list = signal_args.split(',')
+ if len(signal_args_list) == 1:
+ bound_signal[signal_args_list[0]].connect(slot)
+ else:
+ bound_signal[tuple(signal_args_list)].connect(slot)
+ except KeyError:
+ log.warning('Skipping ui signal connection {}({}) - no matching PyQt6 overload'.format(
+ signal_name, signal_args))
+
+ _QtCore.QMetaObject.connectSlotsByName(self.toplevelWidget)
+
+ _uiparser.UIParser._handle_connections = _tolerant_handle_connections
+except ImportError:
+ pass # Not using PyQt6
+
class Trampoline(object):
def __init__(self, methods):
self.methods = methods
@@ -89,7 +130,7 @@ def __init__(self, halcomp=None, path=None):
self._idName = "TopObject" # initial name, will be replaced
self.halcomp = halcomp
self.has_closing_handler = False
- self.setFocus(True)
+ self.setFocus()
self.PATHS = path
self.PREFS_ = None
self.originalCloseEvent_ = self.closeEvent
@@ -144,23 +185,34 @@ def qrccompile(qrcname, qrcpy):
log.info('Compiling qrc: {} to \n {}'.format(qrcname, qrcpy))
try:
subprocess.call(["pyrcc5", "-o", "{}".format(qrcpy), "{}".format(qrcname)])
+ return
+ except FileNotFoundError:
+ pass
+ try:
+ subprocess.call(["rcc", "-g", "python", "-o", "{}".format(qrcpy), "{}".format(qrcname)])
+ # rcc generates PySide6 imports; rewrite to use qtpy
+ with open(qrcpy, 'r') as f:
+ content = f.read()
+ content = content.replace('from PySide6 import QtCore', 'from qtpy import QtCore')
+ with open(qrcpy, 'w') as f:
+ f.write(content)
except OSError as e:
log.error(
- '{}, pyrcc5 error. try in terminal: sudo apt install pyqt5-dev-tools to install dev tools'.format(
+ '{}, pyrcc5/rcc error. try in terminal: sudo apt install pyqt5-dev-tools or qt6-base-dev-tools to install dev tools'.format(
e))
msg = QtWidgets.QMessageBox()
msg.setIcon(QtWidgets.QMessageBox.Critical)
msg.setText("QTvcp qrc compiling ERROR! ")
msg.setInformativeText(
- 'Qrc Compile error, try: "sudo apt install pyqt5-dev-tools" to install dev tools')
+ 'Qrc Compile error, try: "sudo apt install pyqt5-dev-tools" or "qt6-base-dev-tools" to install dev tools')
msg.setWindowTitle("Error")
msg.setDetailedText('You can continue but some images may be missing')
msg.setStandardButtons(QtWidgets.QMessageBox.Retry | QtWidgets.QMessageBox.Abort)
msg.show()
- retval = msg.exec_()
+ retval = msg.exec()
if retval == QtWidgets.QMessageBox.Abort: # cancel button
log.critical("Canceled from qrc compiling Error Dialog.\n")
- raise SystemError('pyrcc5 compiling error: try: "sudo apt install pyqt5-dev-tools"')
+ raise SystemError('pyrcc5/rcc compiling error: try: "sudo apt install pyqt5-dev-tools" or "qt6-base-dev-tools"')
qrcname = self.PATHS.QRC
qrcpy = self.PATHS.QRCPY
@@ -222,7 +274,7 @@ def apply_styles(self, fname=None):
BNAME = self.PATHS.BASENAME
# apply one word system theme
if fname in (list(QtWidgets.QStyleFactory.keys())):
- QtWidgets.qApp.setStyle(fname)
+ QtWidgets.QApplication.instance().setStyle(fname)
log.info('Applied System Style name: yellow<{}>'.format(fname))
return
@@ -263,7 +315,7 @@ def apply_styles(self, fname=None):
themes = ''
log.error('QSS Filepath Error: {}'.format(qssname))
log.error("{} theme not available.".format(fname))
- current_theme = str(QtWidgets.qApp.style().objectName())
+ current_theme = str(QtWidgets.QApplication.instance().style().objectName())
for i in (list(QtWidgets.QStyleFactory.keys())):
themes += (', {}'.format(i))
log.error('QTvcp Available system themes: green<{}> {}'.format(current_theme, themes))
@@ -487,13 +539,13 @@ def __setitem__(self, item, value):
return setattr(self, item, value)
class VCPWindow(_VCPWindow):
- _instance = None
+ _instance = [None]
_instanceNum = 0
def __new__(cls, *args, **kwargs):
- if not cls._instance:
- cls._instance = _VCPWindow.__new__(cls, *args, **kwargs)
- return cls._instance
+ if not cls._instance[0]:
+ cls._instance[0] = _VCPWindow.__new__(cls, *args, **kwargs)
+ return cls._instance[0]
def __getitem__(self, item):
if item == '':
diff --git a/lib/python/qtvcp/qt_makepins.py b/lib/python/qtvcp/qt_makepins.py
index 146c77236d2..3350581fba8 100644
--- a/lib/python/qtvcp/qt_makepins.py
+++ b/lib/python/qtvcp/qt_makepins.py
@@ -21,7 +21,7 @@
from qtvcp.widgets.simple_widgets import _HalWidgetBase
from qtvcp.widgets.screen_options import ScreenOptions
from qtpy.QtCore import QObject
-from qtpy.QtWidgets import QDesktopWidget
+from qtpy.QtWidgets import QApplication
from qtvcp.core import Info
@@ -203,7 +203,7 @@ def go(x, y, w, h):
return
elif 'center' in self._geo_string.lower():
geom = self.window.frameGeometry()
- geom.moveCenter(QDesktopWidget().availableGeometry().center())
+ geom.moveCenter(QApplication.primaryScreen().availableGeometry().center())
self.window.setGeometry(geom)
return
else:
diff --git a/lib/python/qtvcp/widgets/action_button.py b/lib/python/qtvcp/widgets/action_button.py
index c78539b6dbe..e8d97a6381e 100644
--- a/lib/python/qtvcp/widgets/action_button.py
+++ b/lib/python/qtvcp/widgets/action_button.py
@@ -1692,4 +1692,4 @@ def __setitem__(self, item, value):
widget._hal_init()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/action_button_round.py b/lib/python/qtvcp/widgets/action_button_round.py
index 56b270c9ceb..92a18ee3000 100644
--- a/lib/python/qtvcp/widgets/action_button_round.py
+++ b/lib/python/qtvcp/widgets/action_button_round.py
@@ -83,7 +83,7 @@ def main():
app = QApplication(sys.argv)
widget = RoundButton()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/action_tool_button.py b/lib/python/qtvcp/widgets/action_tool_button.py
index f7540f2d524..3ec70890ccf 100644
--- a/lib/python/qtvcp/widgets/action_tool_button.py
+++ b/lib/python/qtvcp/widgets/action_tool_button.py
@@ -233,6 +233,6 @@ def main():
widget = ActionToolButton()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/adjustment_bar.py b/lib/python/qtvcp/widgets/adjustment_bar.py
index bdd6fd58182..e006eed6f23 100644
--- a/lib/python/qtvcp/widgets/adjustment_bar.py
+++ b/lib/python/qtvcp/widgets/adjustment_bar.py
@@ -397,6 +397,6 @@ def main():
widget.setValue(75)
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/axis_tool_button.py b/lib/python/qtvcp/widgets/axis_tool_button.py
index aa78f479eeb..d2c58f7a55b 100644
--- a/lib/python/qtvcp/widgets/axis_tool_button.py
+++ b/lib/python/qtvcp/widgets/axis_tool_button.py
@@ -399,6 +399,6 @@ def main():
widget = AxisToolButton()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/bar.py b/lib/python/qtvcp/widgets/bar.py
index f23d383da5a..36a1a83020a 100644
--- a/lib/python/qtvcp/widgets/bar.py
+++ b/lib/python/qtvcp/widgets/bar.py
@@ -1,13 +1,16 @@
+import enum
from qtpy import QtWidgets
from qtpy.QtGui import QColor, QBrush, QPainter, QLinearGradient
-from qtpy.QtCore import (Qt, Slot, Property, Signal, QVariant, QRectF,
+from qtpy.QtCore import (Qt, Slot, Property, Signal, QRectF,
QSize)
-
try:
- from qtpy.QtCore import Q_ENUM
-except:
- # before Qt 5.10
- from qtpy.QtCore import Q_ENUMS as Q_ENUM
+ from qtpy.QtCore import QEnum
+except ImportError:
+ try:
+ from qtpy.QtCore import Q_ENUM as QEnum
+ except ImportError:
+ # before Qt 5.10
+ from qtpy.QtCore import Q_ENUMS as QEnum
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
import hal
@@ -391,7 +394,7 @@ def resetVert(self):
self.update()
stepColorList = Property(
- QVariant.typeToName(QVariant.StringList),
+ 'QStringList',
get_step_color_l, set_step_color_l, reset_step_color_l)
backgroundColor = Property(QColor, getBackgroundColor, setBackgroundColor)
@@ -403,7 +406,7 @@ def resetVert(self):
setVertical = Property(bool, getVert, setVert, resetVert)
setInverted = Property(bool, getInvertedAppearance, setInvertedAppearance, resetInvertedAppearance)
-class HALPinType:
+class HALPinType(enum.IntEnum):
NONE = 0
S32 = hal.HAL_S32
FLOAT = hal.HAL_FLOAT
@@ -411,9 +414,9 @@ class HALPinType:
class HalBar(Bar, _HalWidgetBase):
HALPinType = HALPinType
- Q_ENUM(HALPinType)
+ QEnum(HALPinType)
- # older version of pyqt5 need this as well as Q_ENUM
+ # older version of pyqt5 need this as well as QEnum
NONE = 0
S32 = hal.HAL_S32
FLOAT = hal.HAL_FLOAT
@@ -537,5 +540,5 @@ def reset_invert_negative(self):
layout.addLayout(lyt)
w.show()
- app.exec_()
+ app.exec()
diff --git a/lib/python/qtvcp/widgets/basic_probe.py b/lib/python/qtvcp/widgets/basic_probe.py
index dc192f02645..3147e88bf36 100644
--- a/lib/python/qtvcp/widgets/basic_probe.py
+++ b/lib/python/qtvcp/widgets/basic_probe.py
@@ -19,9 +19,9 @@
import os
import hal
import json
-from qtpy.QtCore import QProcess, QRegExp, QFile, QEvent, Qt, Property
+from qtpy.QtCore import QProcess, QRegularExpression, QFile, QEvent, Qt, Property
from qtpy import QtGui, QtWidgets, uic, QtCore
-from qtpy.QtWidgets import QDialogButtonBox, QAbstractSlider, QLineEdit, qApp
+from qtpy.QtWidgets import QDialogButtonBox, QAbstractSlider, QLineEdit, QApplication
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
from qtvcp.core import Action, Status, Info, Path
from qtvcp.widgets.dialogMixin import GeometryMixin
@@ -56,9 +56,9 @@ def __init__(self, parent=None):
self.hilightStyle = "border: 2px solid red;"
if INFO.MACHINE_IS_METRIC:
- self.valid = QtGui.QRegExpValidator(QRegExp(r'^[+-]?((\d+(\.\d{,4})?)|(\.\d{,4}))$'))
+ self.valid = QtGui.QRegularExpressionValidator(QRegularExpression(r'^[+-]?((\d+(\.\d{,4})?)|(\.\d{,4}))$'))
else:
- self.valid = QtGui.QRegExpValidator(QRegExp(r'^[+-]?((\d+(\.\d{,3})?)|(\.\d{,3}))$'))
+ self.valid = QtGui.QRegularExpressionValidator(QRegularExpression(r'^[+-]?((\d+(\.\d{,3})?)|(\.\d{,3}))$'))
self.setMinimumSize(600, 420)
# load the widgets ui file
self.filename = PATH.find_widget_path('basic_probe.ui')
@@ -119,7 +119,7 @@ def __init__(self, parent=None):
self.cmb_probe_select.addItems(self.probe_list)
self.stackedWidget_probe_buttons.setCurrentIndex(0)
# define validators for all lineEdit widgets
- self.lineEdit_probe_tool.setValidator(QtGui.QRegExpValidator(QRegExp('[0-9]{0,5}')))
+ self.lineEdit_probe_tool.setValidator(QtGui.QRegularExpressionValidator(QRegularExpression('[0-9]{0,5}')))
for i in self.parm_list:
self['lineEdit_' + i].setValidator(self.valid)
@@ -272,7 +272,7 @@ def findBack(self, num):
def popEntry(self, obj, next=False):
STATUS.emit('focus-overlay-changed', False, None, None)
obj.setStyleSheet(self.hilightStyle)
- qApp.processEvents()
+ QApplication.processEvents()
mess = {'NAME':self.dialog_code,
'ID':'%s__' % self.objectName(),
@@ -663,7 +663,7 @@ def close(self):
def showDialog(self):
self.setWindowTitle(self._title);
self.set_geometry()
- retval = self.exec_()
+ retval = self.exec()
LOG.debug('Value of pressed button: {}'.format(retval))
# look for a custom version of basicProbe
@@ -685,5 +685,5 @@ def __init__(self, parent=None):
app = QtWidgets.QApplication(sys.argv)
w = BasicProbe()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/calculator.py b/lib/python/qtvcp/widgets/calculator.py
index afdbf3820d1..abdabd9a392 100644
--- a/lib/python/qtvcp/widgets/calculator.py
+++ b/lib/python/qtvcp/widgets/calculator.py
@@ -635,4 +635,4 @@ def applyAction(self):
app = QApplication(sys.argv)
calc = Calculator()
calc.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/camview_widget.py b/lib/python/qtvcp/widgets/camview_widget.py
index cf7c0fbf04b..9360c1d1161 100644
--- a/lib/python/qtvcp/widgets/camview_widget.py
+++ b/lib/python/qtvcp/widgets/camview_widget.py
@@ -111,7 +111,7 @@ def _hal_init(self):
##################################
def wheelEvent(self, event):
super(CamView, self).wheelEvent(event)
- mouse_state = QtWidgets.qApp.mouseButtons()
+ mouse_state = QtWidgets.QApplication.mouseButtons()
if event.angleDelta().y() < 0:
if mouse_state == QtCore.Qt.NoButton:
self.diameter -= self.rotationIncrement
@@ -671,7 +671,7 @@ def mouseDoubleClickEvent(self, event):
self.diameter = 40
def wheelEvent(self, event):
- mouse_state = QtWidgets.qApp.mouseButtons()
+ mouse_state = QtWidgets.QApplication.mouseButtons()
size = self.size()
w = size.width()
if event.angleDelta().y() < 0:
@@ -765,4 +765,4 @@ def jump():
timer.start(100)
w.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/dialogMixin.py b/lib/python/qtvcp/widgets/dialogMixin.py
index 333ce08d536..343cb443472 100644
--- a/lib/python/qtvcp/widgets/dialogMixin.py
+++ b/lib/python/qtvcp/widgets/dialogMixin.py
@@ -1,4 +1,4 @@
-from qtpy.QtWidgets import (QDesktopWidget, QMessageBox)
+from qtpy.QtWidgets import (QApplication, QMessageBox)
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
from qtvcp import logger
@@ -29,7 +29,7 @@ def get_default_geometry(self):
def set_default_geometry(self):
geom = self.frameGeometry()
- geom.moveCenter(QDesktopWidget().availableGeometry().center())
+ geom.moveCenter(QApplication.primaryScreen().availableGeometry().center())
self.setGeometry(geom)
x = self.geometry().x()
y = self.geometry().y()
@@ -71,7 +71,7 @@ def set_geometry(self):
# add 'always' or the user can reset the dialog
elif 'center' in self._geometry_string.lower():
geom = self.frameGeometry()
- geom.moveCenter(QDesktopWidget().availableGeometry().center())
+ geom.moveCenter(QApplication.primaryScreen().availableGeometry().center())
self.setGeometry(geom)
if not 'always' in self._geometry_string.lower():
self._geometry_string = self.get_current_geometry()
@@ -80,9 +80,9 @@ def set_geometry(self):
# add 'always' or the user can reset the dialog
elif 'bottomleft' in self._geometry_string.lower():
# move to bottom left of parent
- ph = QDesktopWidget().geometry().height()
- px = QDesktopWidget().geometry().x()
- py = QDesktopWidget().geometry().y()
+ ph = QApplication.primaryScreen().geometry().height()
+ px = QApplication.primaryScreen().geometry().x()
+ py = QApplication.primaryScreen().geometry().y()
dw = self.geometry().width()
dh = self.geometry().height()
self.setGeometry(px, py+ph-dh, dw, dh)
diff --git a/lib/python/qtvcp/widgets/dialog_widget.py b/lib/python/qtvcp/widgets/dialog_widget.py
index 138094edaae..876478f9a72 100644
--- a/lib/python/qtvcp/widgets/dialog_widget.py
+++ b/lib/python/qtvcp/widgets/dialog_widget.py
@@ -18,7 +18,7 @@
import os
import hal
-from qtpy.QtWidgets import (QMessageBox, QFileDialog, QDesktopWidget,
+from qtpy.QtWidgets import (QMessageBox, QFileDialog,
QDialog, QDialogButtonBox, QVBoxLayout, QPushButton, QHBoxLayout,
QHBoxLayout, QLineEdit, QPushButton, QDialogButtonBox, QTabWidget,
QTextEdit,QLabel)
@@ -244,7 +244,7 @@ def showdialog(self, messagetext, more_info=None, details=None, display_type='OK
self.forceDetailsOpen()
if use_exec:
- retval = self.exec_()
+ retval = self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
LOG.debug('Value of pressed button: {}'.format(retval))
return self.qualifiedReturn(retval)
@@ -283,7 +283,7 @@ def showEvent(self, event):
self.set_geometry()
else:
geom = self.frameGeometry()
- geom.moveCenter(QDesktopWidget().availableGeometry().center())
+ geom.moveCenter(QApplication.primaryScreen().availableGeometry().center())
self.setGeometry(geom)
super(LcncDialog, self).showEvent(event)
@@ -686,7 +686,7 @@ def load_dialog(self, extensions = None, preselect = None, directory = None, ret
STATUS.emit('play-sound', self.sound_type)
self.set_geometry()
fname = None
- if (self.exec_()):
+ if (self.exec()):
fname = self.selectedFiles()[0]
path = self.directory().absolutePath()
self.setDirectory(path)
@@ -727,7 +727,7 @@ def save_dialog(self, extensions = None, preselect = None, directory = None):
STATUS.emit('play-sound', self.sound_type)
self.set_geometry()
fname = None
- if (self.exec_()):
+ if (self.exec()):
fname = self.selectedFiles()[0]
path = self.directory().absolutePath()
self.setDirectory(path)
@@ -813,7 +813,7 @@ def __init__(self, parent=None):
b = 'button_%s' % i
self[b] = QPushButton('Zero %s' % i)
self[b].clicked.connect(self.zeroPress('%s' % i))
- buttonBox.addButton(self[b], 3)
+ buttonBox.addButton(self[b], QDialogButtonBox.ActionRole)
v = QVBoxLayout()
h = QHBoxLayout()
@@ -855,7 +855,7 @@ def load_dialog(self):
STATUS.emit('focus-overlay-changed', True, 'Set Origin Offsets', self._color)
self.set_geometry()
self.show()
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
self.record_geometry()
@@ -936,10 +936,10 @@ def __init__(self, parent=None):
STATUS.connect('interp-run', lambda w: buttonBox.setEnabled(False))
self.addtool = QPushButton('Add Tool')
self.addtool.clicked.connect(lambda: self.addTool())
- buttonBox.addButton(self.addtool, 3)
+ buttonBox.addButton(self.addtool, QDialogButtonBox.ActionRole)
self.deletetool = QPushButton('Delete Tool')
self.deletetool.clicked.connect(lambda: self.deleteTool())
- buttonBox.addButton(self.deletetool, 3)
+ buttonBox.addButton(self.deletetool, QDialogButtonBox.ActionRole)
#for i in('X', 'Y', 'Z'):
# b = 'button_%s' % i
# self[b] = QPushButton('Zero %s' % i)
@@ -989,7 +989,7 @@ def load_dialog(self):
STATUS.emit('focus-overlay-changed', True, 'Set Tool Offsets', self._color)
self.set_geometry()
self.show()
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
self.record_geometry()
@@ -1138,7 +1138,7 @@ def showdialog(self, message, more_info=None, details=None,
STATUS.emit('focus-overlay-changed', True, 'Tool Chooser', self._color)
self.set_geometry()
self.show()
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
self.record_geometry()
@@ -1243,7 +1243,7 @@ def load_dialog(self):
STATUS.emit('focus-overlay-changed', True, 'Cam View Dialog', self._color)
self.set_geometry()
self.show()
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
# **********************
@@ -1345,7 +1345,7 @@ def load_dialog(self):
self.tab.stack.setCurrentIndex(0)
self.set_geometry()
self.show()
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
self.record_geometry()
@@ -1427,7 +1427,7 @@ def load_dialog(self):
STATUS.emit('focus-overlay-changed', True, 'VersaProbe Dialog', self._color)
self.set_geometry()
self.show()
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
self.record_geometry()
@@ -1551,7 +1551,7 @@ def showdialog(self, preload=None,overlay=True):
flag = False
while flag == False:
self.Num.setFocus()
- retval = self.exec_()
+ retval = self.exec()
if retval:
try:
answer = float(self.Num.text())
@@ -1680,7 +1680,7 @@ def showdialog(self, preload=None, overlay=True):
self.edit.setFocus()
self.edit.setText(str(preload))
self.edit.deselect()
- retval = self.exec_()
+ retval = self.exec()
answer = self.edit.text()
if retval:
STATUS.emit('update-machine-log', 'keyboard Entry {}'.format(answer), 'TIME,DEBUG')
@@ -1822,7 +1822,7 @@ def showdialog(self, preload=None, overlay=True, cycle=False):
else:
if overlay:
STATUS.emit('focus-overlay-changed', True, '', self._color)
- retval = self.exec_()
+ retval = self.exec()
if overlay:
STATUS.emit('focus-overlay-changed', False, None, None)
@@ -1981,7 +1981,7 @@ def showdialog(self, nonblock=None):
STATUS.emit('play-sound', self.sound_type)
self.set_geometry()
if nonblock is not None:
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
self.record_geometry()
return False
@@ -2087,7 +2087,7 @@ def showdialog(self, line = 1, message=None, nonblock=None):
STATUS.emit('play-sound', self.sound_type)
self.set_geometry()
if not nonblock:
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
self.record_geometry()
return False
@@ -2181,7 +2181,7 @@ def showdialog(self, nonblock=None):
STATUS.emit('play-sound', self.sound_type)
self.set_geometry()
if nonblock is not None:
- self.exec_()
+ self.exec()
STATUS.emit('focus-overlay-changed', False, None, None)
self.record_geometry()
return False
diff --git a/lib/python/qtvcp/widgets/dro_widget.py b/lib/python/qtvcp/widgets/dro_widget.py
index c09335ae4b9..14ab752b3e4 100644
--- a/lib/python/qtvcp/widgets/dro_widget.py
+++ b/lib/python/qtvcp/widgets/dro_widget.py
@@ -507,6 +507,6 @@ def main():
app = QApplication(sys.argv)
widget = DROLabel()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/entry_widget.py b/lib/python/qtvcp/widgets/entry_widget.py
index 494a9301086..fed4e8fac96 100644
--- a/lib/python/qtvcp/widgets/entry_widget.py
+++ b/lib/python/qtvcp/widgets/entry_widget.py
@@ -56,7 +56,8 @@ def __init__(self, parent=None, keyboard_type='default'):
self.do_layout(keyboard_type)
- self.signalMapper.mapped[int].connect(self.buttonClicked)
+ mapped = getattr(self.signalMapper, 'mappedInt', None) or self.signalMapper.mapped[int]
+ mapped.connect(self.buttonClicked)
def do_layout(self, keyboard_type='default'):
"""
@@ -215,7 +216,7 @@ def update_panel_position(self):
widget_rect = widget.rect()
widget_bottom = widget.mapToGlobal(QtCore.QPoint(widget.frameGeometry().x(),
widget.frameGeometry().y())).y()
- screen_height = QtWidgets.qApp.desktop().availableGeometry().height()
+ screen_height = QtWidgets.QApplication.primaryScreen().availableGeometry().height()
input_panel_height = self.geometry().height() + 5
if (screen_height - widget_bottom) > input_panel_height:
@@ -281,4 +282,4 @@ def callDialog(self, widget, ktype):
test.callDialog(line, 'default')
w.setLayout(layout)
w.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/file_manager.py b/lib/python/qtvcp/widgets/file_manager.py
index 7ee62bccb97..cad5155d52f 100644
--- a/lib/python/qtvcp/widgets/file_manager.py
+++ b/lib/python/qtvcp/widgets/file_manager.py
@@ -341,7 +341,7 @@ def _hal_init(self):
order = self.SETTINGS_.value('sortIndicatorOrder', type = int)
self.SETTINGS_.endGroup()
if not None in(sect,order):
- self.table.horizontalHeader().setSortIndicator(sect,order)
+ self.table.horizontalHeader().setSortIndicator(sect, Qt.SortOrder(order))
self.connectSelection()
@@ -745,5 +745,5 @@ def resetShowListView(self, state):
gui.onUserClicked()
# gui.onMediaClicked()
gui.setRestricted(True)
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/gcode_editor.py b/lib/python/qtvcp/widgets/gcode_editor.py
index 457a3a7f4d3..c92fc322172 100644
--- a/lib/python/qtvcp/widgets/gcode_editor.py
+++ b/lib/python/qtvcp/widgets/gcode_editor.py
@@ -229,19 +229,19 @@ def __init__(self, parent=None):
self.setMarginWidth(1, 0)
# Gcode highlight current line
- self.currentHandle = self.markerDefine(QsciScintilla.Background,
+ self.currentHandle = self.markerDefine(QsciScintilla.MarkerSymbol.Background,
self.CURRENT_MARKER_NUM)
self.setColorMarkerBackground(self.getColorMarkerBackground())
# User Highlight line (when clicking margin)
- self.userHandle = self.markerDefine(QsciScintilla.Background,
+ self.userHandle = self.markerDefine(QsciScintilla.MarkerSymbol.Background,
self.USER_MARKER_NUM)
self.setMarkerBackgroundColor(QColor("#ffc0c0"),
self.USER_MARKER_NUM)
# Brace matching: enable for a brace immediately before or after
# the current position
- self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
+ self.setBraceMatching(QsciScintilla.BraceMatch.SloppyBraceMatch)
# Current line visible with special background color
self.setCaretLineVisible(False)
@@ -1221,5 +1221,5 @@ def reset_auto_show_manual(self):
if 1:
w.label.setText('Edit mode title label')
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/gcode_graphics.py b/lib/python/qtvcp/widgets/gcode_graphics.py
index c1caf69e2d4..fcea06aa5db 100644
--- a/lib/python/qtvcp/widgets/gcode_graphics.py
+++ b/lib/python/qtvcp/widgets/gcode_graphics.py
@@ -119,6 +119,8 @@ def _hal_init(self):
# when qtvcp closes, this gets called
def _hal_cleanup(self):
+ self.timer.stop()
+ self.logger.stop()
if self.PREFS_:
v,z,x,y,lat,lon = self.getRecordedViewSettings()
LOG.debug('Saving {} data to file.'.format(self.HAL_NAME_))
@@ -589,5 +591,5 @@ def resetMouseWheelInvertZoom(self):
widget.use_gradient_background = True
widget.enable_dro = True
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/geditor.py b/lib/python/qtvcp/widgets/geditor.py
index 56fd1658ac7..fa371e6c01b 100644
--- a/lib/python/qtvcp/widgets/geditor.py
+++ b/lib/python/qtvcp/widgets/geditor.py
@@ -29,7 +29,7 @@
import sys
-from qtpy.QtCore import Property, Signal, QSize, QEvent, Qt, QByteArray, QVariant
+from qtpy.QtCore import Property, Signal, QSize, QEvent, Qt, QByteArray
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QMainWindow, QAction,\
QToolBar, QLineEdit, QHBoxLayout, QMessageBox, \
@@ -337,7 +337,7 @@ def undo(self):
def saveSettings(self):
self.SETTINGS_.beginGroup("geditor-{}".format(self.objectName()))
- self.SETTINGS_.setValue('state', QVariant(self.saveState().data()))
+ self.SETTINGS_.setValue('state', self.saveState().data())
self.SETTINGS_.endGroup()
def restoreSettings(self):
@@ -554,6 +554,6 @@ def reset_show_editor(self):
if 0:
w.label.setText('Edit mode title label')
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/hal_label.py b/lib/python/qtvcp/widgets/hal_label.py
index 3126aa94cca..c35ac341d75 100644
--- a/lib/python/qtvcp/widgets/hal_label.py
+++ b/lib/python/qtvcp/widgets/hal_label.py
@@ -17,7 +17,7 @@
import hal
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
-from qtpy.QtCore import Property, Slot, QVariant
+from qtpy.QtCore import Property, Slot
from qtvcp.widgets.simple_widgets import ScaledLabel
from qtvcp import logger
@@ -167,7 +167,7 @@ def reset_multi_label_l(self):
use_multi_label = Property(bool, get_use_multi_label, set_use_multi_label, reset_use_multi_label)
textTemplate = Property(str, get_textTemplate, set_textTemplate, reset_textTemplate)
- multi_label_list = Property(QVariant.typeToName(QVariant.StringList),
+ multi_label_list = Property('QStringList',
get_multi_label_l, set_multi_label_l, reset_multi_label_l)
##############################
# required class boiler code #
diff --git a/lib/python/qtvcp/widgets/hal_selectionbox.py b/lib/python/qtvcp/widgets/hal_selectionbox.py
index 67a94dfab22..3bb466ed9e9 100644
--- a/lib/python/qtvcp/widgets/hal_selectionbox.py
+++ b/lib/python/qtvcp/widgets/hal_selectionbox.py
@@ -234,6 +234,6 @@ def main():
widget = HALSelectionBox()
widget._hal_init()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/image_switcher.py b/lib/python/qtvcp/widgets/image_switcher.py
index 62d37a94478..5128913f842 100644
--- a/lib/python/qtvcp/widgets/image_switcher.py
+++ b/lib/python/qtvcp/widgets/image_switcher.py
@@ -17,7 +17,7 @@
import os
-from qtpy.QtCore import Signal, Property, QVariant
+from qtpy.QtCore import Signal, Property
from qtpy.QtWidgets import QLabel
from qtpy.QtGui import QPixmap
@@ -121,7 +121,7 @@ def get_image_l(self):
return self._imagePath
def reset_image_l(self):
self._imagePath = [self._defaultImage]
- image_list = Property(QVariant.typeToName(QVariant.StringList), get_image_l, set_image_l, reset_image_l)
+ image_list = Property('QStringList', get_image_l, set_image_l, reset_image_l)
def setImagePath(self, data):
self.defaultPixmap = data
@@ -446,7 +446,7 @@ def main():
widget._hal_init()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/indicatorMixIn.py b/lib/python/qtvcp/widgets/indicatorMixIn.py
index f3ed9e1439d..dfef5e5b593 100644
--- a/lib/python/qtvcp/widgets/indicatorMixIn.py
+++ b/lib/python/qtvcp/widgets/indicatorMixIn.py
@@ -460,7 +460,7 @@ def paintIndicator(self):
else:
size = int(self.height() * self._size)
- gradient = QtGui.QLinearGradient(top_right- QtCore.QPoint(size, 0), top_right)
+ gradient = QtGui.QLinearGradient((top_right- QtCore.QPoint(size, 0)).toPointF(), top_right.toPointF())
gradient.setColorAt(0, QtCore.Qt.white)
gradient.setColorAt(1, color)
p.setBrush(QtGui.QBrush(gradient))
@@ -475,7 +475,7 @@ def paintIndicator(self):
if self._doubleIndicator:
bot_right = rect.bottomRight() - QtCore.QPoint(self._right_edge_offset,self._top_edge_offset)
- gradient = QtGui.QLinearGradient(bot_right- QtCore.QPoint(size, 0), bot_right)
+ gradient = QtGui.QLinearGradient((bot_right- QtCore.QPoint(size, 0)).toPointF(), bot_right.toPointF())
gradient.setColorAt(0, QtCore.Qt.white)
gradient.setColorAt(1, color2)
p.setBrush(QtGui.QBrush(gradient))
@@ -561,7 +561,7 @@ def paintIndicator(self):
else:
size = int(self.height() * self._size)
- gradient = QtGui.QLinearGradient(top_left + QtCore.QPoint(size, 0), top_left)
+ gradient = QtGui.QLinearGradient((top_left + QtCore.QPoint(size, 0)).toPointF(), top_left.toPointF())
gradient.setColorAt(0, QtCore.Qt.white)
gradient.setColorAt(1, color)
p.setBrush(QtGui.QBrush(gradient))
@@ -575,7 +575,7 @@ def paintIndicator(self):
# second LED
if self._doubleIndicator:
top_bot = rect.bottomLeft() - QtCore.QPoint(self._right_edge_offset, self._top_edge_offset)
- gradient = QtGui.QLinearGradient(top_bot + QtCore.QPoint(size, 0), top_bot)
+ gradient = QtGui.QLinearGradient((top_bot + QtCore.QPoint(size, 0)).toPointF(), top_bot.toPointF())
gradient.setColorAt(0, QtCore.Qt.white)
gradient.setColorAt(1, color2)
p.setBrush(QtGui.QBrush(gradient))
@@ -1191,6 +1191,6 @@ def main():
widget._hal_init()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/jog_increments.py b/lib/python/qtvcp/widgets/jog_increments.py
index d1681e4cfae..c54caa3ba93 100644
--- a/lib/python/qtvcp/widgets/jog_increments.py
+++ b/lib/python/qtvcp/widgets/jog_increments.py
@@ -217,4 +217,4 @@ def reset_pin_name(self):
app = QtWidgets.QApplication(sys.argv)
combo = JogIncrements()
combo.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/joypad.py b/lib/python/qtvcp/widgets/joypad.py
index fca1d52e796..9b931c37b9f 100644
--- a/lib/python/qtvcp/widgets/joypad.py
+++ b/lib/python/qtvcp/widgets/joypad.py
@@ -14,20 +14,23 @@
# GNU General Public License for more details.
###############################################################################
import sys
+import enum
from qtpy import QtCore, QtGui, QtWidgets
from qtpy.QtCore import Qt, QPoint, QPointF, QRect, QRectF, QSize, QSizeF, QEvent
-from qtpy.QtGui import QPainter, QPainterPath, QPen, QBrush, QColor, QFont, QPixmap, QRadialGradient
-
try:
- from qtpy.QtCore import Q_ENUM
-except:
- # before qt5.10
- from qtpy.QtCore import Q_ENUMS as Q_ENUM
+ from qtpy.QtCore import QEnum
+except ImportError:
+ try:
+ from qtpy.QtCore import Q_ENUM as QEnum
+ except ImportError:
+ # before Qt 5.10
+ from qtpy.QtCore import Q_ENUMS as QEnum
+from qtpy.QtGui import QPainter, QPainterPath, QPen, QBrush, QColor, QFont, QPixmap, QRadialGradient
import hal
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
-class IndicatorPosition:
+class IndicatorPosition(enum.IntEnum):
NONE = 0
LEFT = 1
RIGHT = 2
@@ -37,9 +40,9 @@ class IndicatorPosition:
LEFTRIGHT = 6
TOPBOTTOM = 7
-class JoyPad(QtWidgets.QWidget, IndicatorPosition):
+class JoyPad(QtWidgets.QWidget):
IndicatorPosition = IndicatorPosition
- Q_ENUM(IndicatorPosition)
+ QEnum(IndicatorPosition)
joy_btn_pressed = QtCore.Signal(str)
joy_btn_released = QtCore.Signal(str)
@@ -534,17 +537,17 @@ def __getitem__(self, item):
def __setitem__(self, item, value):
return setattr(self, item, value)
-class HALPinType:
+class HALPinType(enum.IntEnum):
NONE = 0
BIT = hal.HAL_BIT
S32 = hal.HAL_S32
FLOAT = hal.HAL_FLOAT
-class HALPad(JoyPad, _HalWidgetBase, HALPinType):
+class HALPad(JoyPad, _HalWidgetBase):
HALPinType = HALPinType
- Q_ENUM(HALPinType)
+ QEnum(HALPinType)
- # older version of pyqt5 need this as well as Q_ENUM
+ # older version of pyqt5 need this as well as QEnum
NONE = 0
BIT = hal.HAL_BIT
S32 = hal.HAL_S32
@@ -674,5 +677,5 @@ def reset_pin_type(self):
layout.addWidget(joy)
w.setLayout(layout)
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/led_widget.py b/lib/python/qtvcp/widgets/led_widget.py
index 9136e92b181..6c55ee8b1aa 100644
--- a/lib/python/qtvcp/widgets/led_widget.py
+++ b/lib/python/qtvcp/widgets/led_widget.py
@@ -200,7 +200,7 @@ def setBorderColor(self, value):
def getAlignment(self):
return self._alignment
- @Slot(Qt.Alignment)
+ @Slot(object)
def setAlignment(self, value):
self._alignment = value
self.update()
@@ -273,7 +273,7 @@ def reset_pin_name(self):
off_gradient_color = Property(QColor, getOffGradientColor, setOffGradientColor, resetOffGradientColor)
on_gradient_color = Property(QColor, getOnGradientColor, setOnGradientColor, resetOnGradientColor)
border_color = Property(QColor, getBorderColor, setBorderColor)
- alignment = Property(Qt.Alignment, getAlignment, setAlignment, resetAlignment)
+ alignment = Property(int, getAlignment, setAlignment, resetAlignment)
currentstate = Property(bool, getState, setState, resetState)
flashing = Property(bool, getFlashState, setFlashState)
flashRate = Property(int, getFlashRate, setFlashRate)
@@ -296,4 +296,4 @@ def reset_pin_name(self):
# only flash when this is true
led.change_state(False)
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/machine_log.py b/lib/python/qtvcp/widgets/machine_log.py
index aa9043690bb..e559b168428 100644
--- a/lib/python/qtvcp/widgets/machine_log.py
+++ b/lib/python/qtvcp/widgets/machine_log.py
@@ -396,6 +396,6 @@ def main():
app = QApplication(sys.argv)
widget = MachineLog()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/macro_widget.py b/lib/python/qtvcp/widgets/macro_widget.py
index f0798cb1987..840e132cee3 100644
--- a/lib/python/qtvcp/widgets/macro_widget.py
+++ b/lib/python/qtvcp/widgets/macro_widget.py
@@ -18,7 +18,7 @@
import os
from qtpy import QtWidgets, QtCore, QtGui
-from qtpy.QtWidgets import qApp
+from qtpy.QtWidgets import QApplication
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
from qtvcp.widgets.entry_widget import TouchInterface
from qtvcp.core import Status, Action, Info
@@ -40,6 +40,10 @@
LOG.setLevel(logger.DEBUG) # One of DEBUG, INFO, WARNING, ERROR, CRITICAL
try:
from qtpy import QtSvg
+ try:
+ from qtpy.QtSvgWidgets import QSvgWidget
+ except (ImportError, AttributeError):
+ QSvgWidget = QtSvg.QSvgWidget
except:
LOG.critical("Qtvcp error with macro_widget - is package python3-pyqt5.qtsvg installed?")
@@ -83,7 +87,7 @@ def paintEvent(self, event):
# instantiate it with layer number or
# set layer number after with setLayerNumbet(int)
####################################################
-class CustomSVG(QtSvg.QSvgWidget):
+class CustomSVG(QSvgWidget):
def __init__(self, parent=None, layer=0):
super(CustomSVG, self).__init__(parent)
self.basename = 'layer'
@@ -614,7 +618,7 @@ def getNumbers(self, widget, ktype=None, next=False):
self._oldstyle = widget.styleSheet()
# change to highlight style
widget.setStyleSheet(self.hilightStyle)
- qApp.processEvents()
+ QApplication.processEvents()
# dialog call
mess = {'NAME':self._request_name,
@@ -789,4 +793,4 @@ def __setitem__(self, item, value):
sw.buildStack(['~/linuxcnc/nc_files/examples/macros/lathe'])
sw.setGeometry(50, 50, 759, 668)
sw.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/mdi_history.py b/lib/python/qtvcp/widgets/mdi_history.py
index bb22d43f692..8572820a01d 100644
--- a/lib/python/qtvcp/widgets/mdi_history.py
+++ b/lib/python/qtvcp/widgets/mdi_history.py
@@ -185,4 +185,4 @@ def reset_soft_keyboard(self):
app = QApplication(sys.argv)
w = MDIHistory()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/mdi_line.py b/lib/python/qtvcp/widgets/mdi_line.py
index a9795529eb4..8f29691f364 100644
--- a/lib/python/qtvcp/widgets/mdi_line.py
+++ b/lib/python/qtvcp/widgets/mdi_line.py
@@ -343,6 +343,6 @@ def main():
app = QApplication(sys.argv)
widget = MDILine()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/mdi_touchy.py b/lib/python/qtvcp/widgets/mdi_touchy.py
index 70fc9c453fe..47bf934319e 100644
--- a/lib/python/qtvcp/widgets/mdi_touchy.py
+++ b/lib/python/qtvcp/widgets/mdi_touchy.py
@@ -399,5 +399,5 @@ def __setitem__(self, item, value):
app = QtWidgets.QApplication(sys.argv)
w = MDITouchy()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/nurbs_editor.py b/lib/python/qtvcp/widgets/nurbs_editor.py
index adad7a8ad45..16acd554504 100644
--- a/lib/python/qtvcp/widgets/nurbs_editor.py
+++ b/lib/python/qtvcp/widgets/nurbs_editor.py
@@ -302,5 +302,5 @@ def report_gcode_error(self, result, seq, filename):
sys.exit(1)
window = NurbsEditor(path = inifilename)
window.load_dialog()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/offset_tool_button.py b/lib/python/qtvcp/widgets/offset_tool_button.py
index 9aa33991017..6fa2859e4fb 100644
--- a/lib/python/qtvcp/widgets/offset_tool_button.py
+++ b/lib/python/qtvcp/widgets/offset_tool_button.py
@@ -205,6 +205,6 @@ def main():
widget = OffsetToolButton()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/operator_value_line.py b/lib/python/qtvcp/widgets/operator_value_line.py
index eddf6e10ab6..ef993e7bd35 100644
--- a/lib/python/qtvcp/widgets/operator_value_line.py
+++ b/lib/python/qtvcp/widgets/operator_value_line.py
@@ -212,6 +212,6 @@ def main():
app = QApplication(sys.argv)
widget = OperatorValueLine()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/origin_offsetview.py b/lib/python/qtvcp/widgets/origin_offsetview.py
index 13a0ea3c183..5cf0e405fc1 100644
--- a/lib/python/qtvcp/widgets/origin_offsetview.py
+++ b/lib/python/qtvcp/widgets/origin_offsetview.py
@@ -18,9 +18,9 @@
import os
import locale
-from qtpy.QtCore import Qt, QAbstractTableModel, QVariant, Property, Slot
+from qtpy.QtCore import Qt, QAbstractTableModel, Property, Slot
from qtpy.QtGui import QColor
-from qtpy.QtWidgets import QTableView, QAbstractItemView, qApp
+from qtpy.QtWidgets import QTableView, QAbstractItemView, QApplication
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
from qtvcp.core import Status, Action, Info
@@ -234,7 +234,7 @@ def return_value(self, w, message):
text = cellContent
# update the screen
- qApp.processEvents()
+ QApplication.processEvents()
# update the dialog
self.callDialog(text,newobj,True)
@@ -246,7 +246,7 @@ def return_value(self, w, message):
text = cellContent
# update the screen
- qApp.processEvents()
+ QApplication.processEvents()
# update the dialog
self.callDialog(text,newobj,True)
@@ -528,7 +528,7 @@ def data(self, index, role):
if role == Qt.EditRole:
return self.arraydata[index.row()][index.column()]
if role == Qt.DisplayRole:
- return QVariant(self.arraydata[index.row()][index.column()])
+ return self.arraydata[index.row()][index.column()]
elif role == Qt.BackgroundRole:
value = self.arraydata[index.row()][index.column()]
if (isinstance(value, int) or isinstance(value, float) or
@@ -536,8 +536,8 @@ def data(self, index, role):
if int(index.row()) == self.parent()._system_int + 3:
return QColor(self._highlightcolor)
else:
- return QVariant()
- return QVariant()
+ return None
+ return None
def flags(self, index):
@@ -580,10 +580,10 @@ def setData(self, index, value, role):
def headerData(self, col, orientation, role):
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
- return QVariant(self.headerdata[col])
+ return self.headerdata[col]
if orientation != Qt.Horizontal and role == Qt.DisplayRole:
- return QVariant(self.Vheaderdata[col])
- return QVariant()
+ return self.Vheaderdata[col]
+ return None
if __name__ == "__main__":
from qtpy.QtWidgets import QApplication
@@ -593,4 +593,4 @@ def headerData(self, col, orientation, role):
w._hal_init()
w.setProperty('styleColorHighlight',QColor('purple'))
w.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/overlay_widget.py b/lib/python/qtvcp/widgets/overlay_widget.py
index 2aae723ff37..486a02359a3 100644
--- a/lib/python/qtvcp/widgets/overlay_widget.py
+++ b/lib/python/qtvcp/widgets/overlay_widget.py
@@ -428,7 +428,7 @@ def pop():
timer2.timeout.connect(lambda:pop() )
timer2.start(1500)
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == '__main__':
diff --git a/lib/python/qtvcp/widgets/radio_axis_selector.py b/lib/python/qtvcp/widgets/radio_axis_selector.py
index 916217d4194..8c4d8fd42b3 100644
--- a/lib/python/qtvcp/widgets/radio_axis_selector.py
+++ b/lib/python/qtvcp/widgets/radio_axis_selector.py
@@ -74,6 +74,6 @@ def main():
layout.addWidget(cb2)
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/richtext_selector.py b/lib/python/qtvcp/widgets/richtext_selector.py
index 7b817846605..68014fe6da4 100644
--- a/lib/python/qtvcp/widgets/richtext_selector.py
+++ b/lib/python/qtvcp/widgets/richtext_selector.py
@@ -377,7 +377,7 @@ def __init__(self, parent=None):
def showDialog(self, pretext = None):
if pretext:
self.window.editor.setText(pretext)
- retval = self.exec_()
+ retval = self.exec()
self.hide()
if retval:
return self.window.editor.toHtml()
@@ -407,4 +407,4 @@ def p():
d.setLayout(l)
d.show()
- app.exec_()
+ app.exec()
diff --git a/lib/python/qtvcp/widgets/round_gauge.py b/lib/python/qtvcp/widgets/round_gauge.py
index 57f7fc25cbf..d0236b31bb8 100644
--- a/lib/python/qtvcp/widgets/round_gauge.py
+++ b/lib/python/qtvcp/widgets/round_gauge.py
@@ -71,8 +71,8 @@ def draw_background(self, qp, event, w):
rect = QRect()
rect.setSize(QSize(w, w))
rect.moveCenter(center)
- fp = QPoint(int(center.x() - w/4), int(center.y() - w/4))
- bg = QRadialGradient(center, w/2, fp)
+ fp = QPointF(center.x() - w/4, center.y() - w/4)
+ bg = QRadialGradient(QPointF(center), w/2, fp)
bg.setColorAt(0, self._base_gradient_color)
bg.setColorAt(1, self._base_color)
qp.setPen(QPen(self._bezel_color, self._bezel_width))
@@ -434,4 +434,4 @@ def reset_halpin_option(self):
layout.addWidget(gauge)
layout.addWidget(slider)
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/round_progress.py b/lib/python/qtvcp/widgets/round_progress.py
index 0d6f4195928..17a223b7719 100644
--- a/lib/python/qtvcp/widgets/round_progress.py
+++ b/lib/python/qtvcp/widgets/round_progress.py
@@ -321,7 +321,7 @@ def rebuildDataBrushIfNeeded(self):
h.addWidget(qd)
h.addWidget(gui)
w.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/runFromLine_dialog.py b/lib/python/qtvcp/widgets/runFromLine_dialog.py
index 016cfa64d5a..6b6574f1394 100644
--- a/lib/python/qtvcp/widgets/runFromLine_dialog.py
+++ b/lib/python/qtvcp/widgets/runFromLine_dialog.py
@@ -80,5 +80,5 @@ def __setitem__(self, item, value):
app = QtWidgets.QApplication(sys.argv)
w = RunFromLineDialog()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/screen_options.py b/lib/python/qtvcp/widgets/screen_options.py
index dd132ce6e98..2f1178a7394 100644
--- a/lib/python/qtvcp/widgets/screen_options.py
+++ b/lib/python/qtvcp/widgets/screen_options.py
@@ -18,7 +18,6 @@
from qtpy import QtCore, QtWidgets, QtGui
from qtpy.QtWidgets import (QGraphicsBlurEffect,
QGraphicsColorizeEffect)
-from qtpy.QtCore import QVariant
import linuxcnc
@@ -931,7 +930,7 @@ def get_blurList(self):
return self.__blurList
def reset_blurList(self):
self.__blurList = []
- focusBlurList = QtCore.Property(QVariant.typeToName(QVariant.StringList), get_blurList, set_blurList, reset_blurList)
+ focusBlurList = QtCore.Property('QStringList', get_blurList, set_blurList, reset_blurList)
def set_focusTint(self, data):
self.use_focus_tint = data
@@ -949,7 +948,7 @@ def get_tintList(self):
return self.__tintList
def reset_tintList(self):
self.__tintList = []
- focusTintList = QtCore.Property(QVariant.typeToName(QVariant.StringList), get_tintList, set_tintList, reset_tintList)
+ focusTintList = QtCore.Property('QStringList', get_tintList, set_tintList, reset_tintList)
# Dialogs ##########################################
diff --git a/lib/python/qtvcp/widgets/simple_widgets.py b/lib/python/qtvcp/widgets/simple_widgets.py
index 331110d9f2b..8af83620e10 100644
--- a/lib/python/qtvcp/widgets/simple_widgets.py
+++ b/lib/python/qtvcp/widgets/simple_widgets.py
@@ -13,14 +13,17 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-try:
- from qtpy.QtCore import Q_ENUM
-except:
- # before qt5.10
- from qtpy.QtCore import Q_ENUMS as Q_ENUM
-
+import enum
from qtpy import QtCore, QtGui, QtWidgets
from qtpy.QtCore import Property, Slot
+try:
+ from qtpy.QtCore import QEnum
+except ImportError:
+ try:
+ from qtpy.QtCore import Q_ENUM as QEnum
+ except ImportError:
+ # before Qt 5.10
+ from qtpy.QtCore import Q_ENUMS as QEnum
from qtvcp.widgets.widget_baseclass import (_HalWidgetBase,
_HalToggleBase, _HalSensitiveBase, _HalScaleBase)
from qtvcp.widgets.indicatorMixIn import IndicatedMixIn
@@ -40,22 +43,12 @@
# Force the log level for this module
#LOG.setLevel(logger.DEBUG) # One of DEBUG, INFO, WARNING, ERROR, CRITICAL
-class HALPinType:
+class HALPinType(enum.IntEnum):
NONE = 0
BIT = hal.HAL_BIT
S32 = hal.HAL_S32
FLOAT = hal.HAL_FLOAT
- def name(enum):
- if enum == hal.HAL_BIT:
- return 'BIT'
- elif enum == hal.HAL_S32:
- return 'S32'
- elif enum == hal.HAL_FLOAT:
- return 'FLOAT'
- else:
- return 'NONE'
-
# reacts to HAL pin changes
class LCDNumber(QtWidgets.QLCDNumber, _HalWidgetBase):
def __init__(self, parent=None):
@@ -360,11 +353,11 @@ def setText(self, text):
super(IndicatedPushButton, self).setText(self._false_string)
# button controls HAL pins
-class PushButton(QtWidgets.QPushButton, IndicatedMixIn, HALPinType):
+class PushButton(QtWidgets.QPushButton, IndicatedMixIn):
HALPinType = HALPinType
- Q_ENUM(HALPinType)
+ QEnum(HALPinType)
- # older version of pyqt5 need this as well as Q_ENUM
+ # older version of pyqt5 need this as well as QEnum
NONE = 0
BIT = hal.HAL_BIT
S32 = hal.HAL_S32
@@ -437,7 +430,7 @@ def makeGroupPin(self):
if not self._pin_type == HALPinType.NONE:
ptype = self._pin_type
if self._groupPinName == '':
- name = HALPinType.name(self._pin_type)
+ name = HALPinType(self._pin_type).name
pname = self.HAL_NAME_ + '.exclusive'+name
else:
pname = self._groupPinName
diff --git a/lib/python/qtvcp/widgets/state_label.py b/lib/python/qtvcp/widgets/state_label.py
index 7bab1f615f7..8f86b41764a 100644
--- a/lib/python/qtvcp/widgets/state_label.py
+++ b/lib/python/qtvcp/widgets/state_label.py
@@ -182,4 +182,4 @@ def __setitem__(self, item, value):
app = QApplication(sys.argv)
label = Lcnc_STATUS_Bool_Label()
label.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/state_led.py b/lib/python/qtvcp/widgets/state_led.py
index d172023f14d..ab6b9c2668a 100644
--- a/lib/python/qtvcp/widgets/state_led.py
+++ b/lib/python/qtvcp/widgets/state_led.py
@@ -561,4 +561,4 @@ def __setitem__(self, item, value):
led = StateLED()
led.show()
#led.startFlashing()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/status_label.py b/lib/python/qtvcp/widgets/status_label.py
index 0336f895913..e993c6dfa63 100644
--- a/lib/python/qtvcp/widgets/status_label.py
+++ b/lib/python/qtvcp/widgets/status_label.py
@@ -961,8 +961,8 @@ def reset_halpin_name(self):
time_stamp_status = QtCore.Property(bool, get_time_stamp, set_time_stamp,
reset_time_stamp)
halpin_status = QtCore.Property(bool, get_halpin, set_halpin, reset_halpin)
- state_label_list = QtCore.Property(QtCore.QVariant.typeToName(QtCore.QVariant.StringList), get_state_label_l, set_state_label_l, reset_state_label_l)
- motion_type_list = QtCore.Property(QtCore.QVariant.typeToName(QtCore.QVariant.StringList), get_motion_label_l, set_motion_label_l, reset_motion_label_l)
+ state_label_list = QtCore.Property('QStringList', get_state_label_l, set_state_label_l, reset_state_label_l)
+ motion_type_list = QtCore.Property('QStringList', get_motion_label_l, set_motion_label_l, reset_motion_label_l)
halpin_name = QtCore.Property(str, get_halpin_name, set_halpin_name, reset_halpin_name)
# boilder code
def __getitem__(self, item):
@@ -982,4 +982,4 @@ def __setitem__(self, item, value):
label.setProperty('motion_type_status',True)
label._hal_init()
label.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/stylesheeteditor.py b/lib/python/qtvcp/widgets/stylesheeteditor.py
index 19531fb8e11..448379ddd15 100644
--- a/lib/python/qtvcp/widgets/stylesheeteditor.py
+++ b/lib/python/qtvcp/widgets/stylesheeteditor.py
@@ -227,7 +227,7 @@ def on_openButton_clicked(self):
'qtvcp/screens',PATH.BASENAME)))
dialog.setSidebarUrls(urls)
- result = dialog.exec_()
+ result = dialog.exec()
if result:
fileName = dialog.selectedFiles()[0]
file = QFile(fileName)
@@ -267,7 +267,7 @@ def on_saveButton_clicked(self):
dialog.setSidebarUrls(urls)
- result = dialog.exec_()
+ result = dialog.exec()
if result:
fileName = dialog.selectedFiles()[0]
self.saveStyleSheet(fileName)
diff --git a/lib/python/qtvcp/widgets/system_tool_button.py b/lib/python/qtvcp/widgets/system_tool_button.py
index e89b41a4ca7..26607726888 100644
--- a/lib/python/qtvcp/widgets/system_tool_button.py
+++ b/lib/python/qtvcp/widgets/system_tool_button.py
@@ -126,6 +126,6 @@ def main():
widget = SystemToolButton()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/tool_chooser.py b/lib/python/qtvcp/widgets/tool_chooser.py
index 651ad3cdccb..13f94dd5966 100644
--- a/lib/python/qtvcp/widgets/tool_chooser.py
+++ b/lib/python/qtvcp/widgets/tool_chooser.py
@@ -19,9 +19,9 @@
import os
import operator
from qtpy import QtGui, QtWidgets, uic
-from qtpy.QtCore import Qt, QAbstractTableModel, QVariant
+from qtpy.QtCore import Qt, QAbstractTableModel
from qtpy.QtGui import QColor, QIcon
-from qtpy.QtWidgets import (QTableView, QAbstractItemView, QCheckBox,QStyledItemDelegate, qApp)
+from qtpy.QtWidgets import (QTableView, QAbstractItemView, QCheckBox, QStyledItemDelegate, QHeaderView)
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
from qtvcp.core import Status, Action, Info, Tool
from qtvcp import logger
@@ -73,7 +73,7 @@ def createAllView(self):
self.setMinimumSize(100, 100)
hh = self.horizontalHeader()
- hh.setSectionResizeMode(3)
+ hh.setSectionResizeMode(QHeaderView.ResizeToContents)
hh.setStretchLastSection(True)
hh.setSortIndicator(1,Qt.AscendingOrder)
@@ -141,12 +141,12 @@ def data(self, index, role=Qt.DisplayRole):
elif role == Qt.BackgroundRole:
if self.arraydata[index.row()][1] == self.parent()._current_tool:
return QColor(self._current_tool_bg_color)
- return QVariant()
+ return None
elif role == Qt.ForegroundRole:
if self.arraydata[index.row()][1] == self.parent()._current_tool:
return QColor(self._current_tool_color)
- return QVariant()
+ return None
def flags(self, index):
if not index.isValid():
@@ -156,10 +156,10 @@ def flags(self, index):
def headerData(self, col, orientation, role):
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
- return QVariant(self.headerdata[col])
+ return self.headerdata[col]
elif orientation != Qt.Horizontal and role == Qt.DisplayRole:
- return QVariant('')
- return QVariant()
+ return ''
+ return None
def sort(self, Ncol, order):
self.layoutAboutToBeChanged.emit()
@@ -178,5 +178,5 @@ def sort(self, Ncol, order):
app = QtWidgets.QApplication(sys.argv)
w = ToolChooser()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/tool_offsetview.py b/lib/python/qtvcp/widgets/tool_offsetview.py
index 0e98a108345..c41b3fd5a94 100644
--- a/lib/python/qtvcp/widgets/tool_offsetview.py
+++ b/lib/python/qtvcp/widgets/tool_offsetview.py
@@ -18,10 +18,20 @@
import os
import operator
-from qtpy.QtCore import Qt, QAbstractTableModel, QVariant, Property, QSize, Slot
+from qtpy.QtCore import Qt, QAbstractTableModel, Property, QSize, Slot
from qtpy.QtGui import QColor, QIcon
from qtpy.QtWidgets import (QTableView, QAbstractItemView, QCheckBox,
-QItemEditorFactory,QDoubleSpinBox,QSpinBox,QStyledItemDelegate, qApp)
+QItemEditorFactory,QDoubleSpinBox,QSpinBox,QStyledItemDelegate, QApplication, QHeaderView)
+
+# QVariant type IDs for ItemEditorFactory: use QVariant constants on PyQt5,
+# fall back to the stable Qt metatype integers on PyQt6 where they were removed.
+try:
+ from qtpy.QtCore import QVariant as _QVariant
+ _DOUBLE_TYPE = _QVariant.Double
+ _INT_TYPE = _QVariant.Int
+except AttributeError:
+ _DOUBLE_TYPE = 6 # QMetaType::Double
+ _INT_TYPE = 2 # QMetaType::Int
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
from qtvcp.core import Status, Action, Info, Tool, Path
from qtvcp import logger
@@ -53,13 +63,13 @@ def __init__(self):
super(ItemEditorFactory,self).__init__()
def createEditor(self, userType, parent):
- if userType == QVariant.Double:
+ if userType == _DOUBLE_TYPE:
doubleSpinBox = QDoubleSpinBox(parent)
doubleSpinBox.setDecimals(4)
doubleSpinBox.setMaximum(99999)
doubleSpinBox.setMinimum(-99999)
return doubleSpinBox
- elif userType == QVariant.Int:
+ elif userType == _INT_TYPE:
spinBox = QSpinBox(parent)
spinBox.setMaximum(20000)
spinBox.setMinimum(1)
@@ -140,7 +150,7 @@ def createAllView(self):
# set horizontal header properties
hh = self.horizontalHeader()
# auto adjust to contents
- hh.setSectionResizeMode(3)
+ hh.setSectionResizeMode(QHeaderView.ResizeToContents)
hh.setStretchLastSection(True)
hh.setSortIndicator(1,Qt.AscendingOrder)
@@ -228,7 +238,7 @@ def return_value(self, w, message):
text = cellContent
# update the screen
- qApp.processEvents()
+ QApplication.processEvents()
# update the dialog
self.callDialog(text,newobj,True)
@@ -247,7 +257,7 @@ def return_value(self, w, message):
text = cellContent
# update the screen
- qApp.processEvents()
+ QApplication.processEvents()
# update the dialog
self.callDialog(text,newobj,True)
@@ -539,7 +549,7 @@ def data(self, index, role=Qt.DisplayRole):
elif self.arraydata[index.row()][0].isChecked():
return QColor(self._selectedcolor)
else:
- return QVariant()
+ return None
elif role == Qt.CheckStateRole:
if index.column() == 0:
@@ -556,7 +566,7 @@ def data(self, index, role=Qt.DisplayRole):
and value < 0 ):
return QColor('red')
- return QVariant()
+ return None
# Returns the item flags for the given index.
@@ -623,10 +633,10 @@ def setData(self, index, value, role):
# Similarly, for vertical headers, the section number corresponds to the row number.
def headerData(self, col, orientation, role):
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
- return QVariant(self.headerdata[col])
+ return self.headerdata[col]
if orientation != Qt.Horizontal and role == Qt.DisplayRole:
- return QVariant('')
- return QVariant()
+ return ''
+ return None
# Sorts the model by column in the given order.
def sort(self, Ncol, order):
@@ -650,4 +660,4 @@ def sort(self, Ncol, order):
w.highlight('lightblue')
#w.setProperty('styleColorHighlight',QColor('purple'))
w.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/lib/python/qtvcp/widgets/touchEntry.py b/lib/python/qtvcp/widgets/touchEntry.py
index 27d5ac0c6bb..fb555cd815e 100644
--- a/lib/python/qtvcp/widgets/touchEntry.py
+++ b/lib/python/qtvcp/widgets/touchEntry.py
@@ -282,4 +282,4 @@ def entryUpdate(self):
w.show()
w = TouchDoubleSpinBox()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/user_dro_label.py b/lib/python/qtvcp/widgets/user_dro_label.py
index ffdd0b03928..a00737fb517 100644
--- a/lib/python/qtvcp/widgets/user_dro_label.py
+++ b/lib/python/qtvcp/widgets/user_dro_label.py
@@ -293,6 +293,6 @@ def main():
app = QApplication(sys.argv)
widget = UserDROLabel()
widget.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
if __name__ == "__main__":
main()
diff --git a/lib/python/qtvcp/widgets/versa_probe.py b/lib/python/qtvcp/widgets/versa_probe.py
index ef1706d5b27..88b0054371b 100644
--- a/lib/python/qtvcp/widgets/versa_probe.py
+++ b/lib/python/qtvcp/widgets/versa_probe.py
@@ -63,9 +63,9 @@ def __init__(self, parent=None):
STATUS.connect('tool-info-changed', lambda w, data: self._tool_info(data))
if INFO.MACHINE_IS_METRIC:
- self.valid = QtGui.QRegExpValidator(QtCore.QRegExp(r'^((\d{1,4}(\.\d{1,3})?)|(\.\d{1,3}))$'))
+ self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression(r'^((\d{1,4}(\.\d{1,3})?)|(\.\d{1,3}))$'))
else:
- self.valid = QtGui.QRegExpValidator(QtCore.QRegExp(r'^((\d{1,3}(\.\d{1,4})?)|(\.\d{1,4}))$'))
+ self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression(r'^((\d{1,3}(\.\d{1,4})?)|(\.\d{1,4}))$'))
self.setMinimumSize(600, 420)
# Load the widgets UI file will use local file if available:
self.filename = PATH.find_widget_path('versa_probe.ui')
@@ -734,7 +734,7 @@ def close(self):
def showDialog(self):
self.setWindowTitle(self._title);
self.set_geometry()
- retval = self.exec_()
+ retval = self.exec()
LOG.debug('Value of pressed button: {}'.format(retval))
# look for a custom version of Versa Probe
@@ -758,5 +758,5 @@ def __init__(self, parent=None):
w = VersaProbeParent()
w.setObjectName('versaprobeParent')
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/virtualkeyboard.py b/lib/python/qtvcp/widgets/virtualkeyboard.py
index ea6c2ed222f..7383f75cf00 100644
--- a/lib/python/qtvcp/widgets/virtualkeyboard.py
+++ b/lib/python/qtvcp/widgets/virtualkeyboard.py
@@ -187,5 +187,5 @@ def __setitem__(self, item, value):
app = QtWidgets.QApplication(sys.argv)
w = VirtualKeyboard()
w.show()
- sys.exit( app.exec_() )
+ sys.exit( app.exec() )
diff --git a/lib/python/qtvcp/widgets/xembed.py b/lib/python/qtvcp/widgets/xembed.py
index 990705b9359..83c18d5f125 100644
--- a/lib/python/qtvcp/widgets/xembed.py
+++ b/lib/python/qtvcp/widgets/xembed.py
@@ -140,4 +140,4 @@ def reset_command(self):
ex.embed('halcmd loadusr gladevcp --xid ../../gladevcp/offsetpage.glade')
ex.show()
ex.setWindowTitle('embed')
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/share/qtvcp/panels/test_button/test_button_handler.py b/share/qtvcp/panels/test_button/test_button_handler.py
index 1d62716c53e..e25ca9ce492 100644
--- a/share/qtvcp/panels/test_button/test_button_handler.py
+++ b/share/qtvcp/panels/test_button/test_button_handler.py
@@ -40,7 +40,7 @@ def __init__(self, halcomp,widgets,paths):
# the HAL pins are built but HAL is not set ready
def initialized__(self):
geom = self.w.frameGeometry()
- geom.moveCenter(QDesktopWidget().availableGeometry().center())
+ geom.moveCenter(QApplication.primaryScreen().availableGeometry().center())
self.w.setGeometry(geom)
if self.w.USEROPTIONS_ is not None:
diff --git a/share/qtvcp/panels/test_led/test_led_handler.py b/share/qtvcp/panels/test_led/test_led_handler.py
index 18448164adb..bd4189018c7 100644
--- a/share/qtvcp/panels/test_led/test_led_handler.py
+++ b/share/qtvcp/panels/test_led/test_led_handler.py
@@ -39,7 +39,7 @@ def __init__(self, halcomp,widgets,paths):
# the HAL pins are built but HAL is not set ready
def initialized__(self):
geom = self.w.frameGeometry()
- geom.moveCenter(QDesktopWidget().availableGeometry().center())
+ geom.moveCenter(QApplication.primaryScreen().availableGeometry().center())
self.w.setGeometry(geom)
if self.w.USEROPTIONS_ is not None:
diff --git a/share/qtvcp/screens/qtdragon/qtdragon_handler.py b/share/qtvcp/screens/qtdragon/qtdragon_handler.py
index 52cd316de38..b727bedef19 100644
--- a/share/qtvcp/screens/qtdragon/qtdragon_handler.py
+++ b/share/qtvcp/screens/qtdragon/qtdragon_handler.py
@@ -76,7 +76,7 @@ def __init__(self, halcomp, widgets, paths):
self.w = widgets
self.gcodes = GCodes(widgets)
# This validator precludes using comma as a decimal
- self.valid = QtGui.QRegExpValidator(QtCore.QRegExp('-?[0-9]{0,6}[.][0-9]{0,3}'))
+ self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('-?[0-9]{0,6}[.][0-9]{0,3}'))
self.KEYBIND = KEYBIND
KEYBIND.add_call('Key_F11','on_keycall_F11')
KEYBIND.add_call('Key_F12','on_keycall_F12')
diff --git a/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py b/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py
index 8fe8ac60ddc..bb1a5e2e8bd 100644
--- a/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py
+++ b/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py
@@ -80,7 +80,7 @@ def __init__(self, halcomp, widgets, paths):
self.w = widgets
self.gcodes = GCodes(widgets)
# This validator precludes using comma as a decimal
- self.valid = QtGui.QRegExpValidator(QtCore.QRegExp('-?[0-9]{0,6}[.][0-9]{0,3}'))
+ self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('-?[0-9]{0,6}[.][0-9]{0,3}'))
self.styleeditor = SSE(widgets, paths)
self.KEYBIND = KEYBIND
KEYBIND.add_call('Key_F4', 'on_keycall_F4')
diff --git a/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py b/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py
index edd86cb4d94..b6801e28576 100644
--- a/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py
+++ b/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py
@@ -80,7 +80,7 @@ def __init__(self, halcomp, widgets, paths):
self.w = widgets
self.gcodes = GCodes(widgets)
# This validator precludes using comma as a decimal
- self.valid = QtGui.QRegExpValidator(QtCore.QRegExp('-?[0-9]{0,6}[.][0-9]{0,3}'))
+ self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('-?[0-9]{0,6}[.][0-9]{0,3}'))
self.styleeditor = SSE(widgets, paths)
self.KEYBIND = KEYBIND
KEYBIND.add_call('Key_F4', 'on_keycall_F4')
diff --git a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py
index 0050ef0b18d..27e1f5d9b13 100644
--- a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py
+++ b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py
@@ -74,7 +74,7 @@ def __init__(self, halcomp, widgets, paths):
self.w = widgets
self.gcodes = GCodes(widgets)
# This validator precludes using comma as a decimal
- self.valid = QtGui.QRegExpValidator(QtCore.QRegExp('-?[0-9]{0,6}[.][0-9]{0,3}'))
+ self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('-?[0-9]{0,6}[.][0-9]{0,3}'))
self.KEYBIND = KEYBIND
KEYBIND.add_call('Key_F11','on_keycall_F11')
KEYBIND.add_call('Key_F12','on_keycall_F12')
diff --git a/src/emc/usr_intf/axis/Submakefile b/src/emc/usr_intf/axis/Submakefile
index f2bcd4b1142..3b294a2c91e 100644
--- a/src/emc/usr_intf/axis/Submakefile
+++ b/src/emc/usr_intf/axis/Submakefile
@@ -21,7 +21,7 @@ $(EMCMODULE): $(call TOOBJS, $(EMCMODULESRCS)) ../lib/liblinuxcnc.a ../lib/libnm
$(TOGLMODULE): $(call TOOBJS, $(TOGLMODULESRCS))
$(ECHO) Linking python module $(notdir $@)
- $(Q)$(CC) $(LDFLAGS) -shared -o $@ $(TCL_CFLAGS) $^ -L/usr/X11R6/lib -lX11 -lepoxy -lXmu $(TCL_LIBS)
+ $(Q)$(CC) $(LDFLAGS) -shared -o $@ $(TCL_CFLAGS) $^ -L/usr/X11R6/lib -lX11 -lepoxy -lGL -lXmu $(TCL_LIBS)
$(TKDARMODULE): $(call TOOBJS, $(TKDARMODULESRCS))
$(ECHO) Linking python module $(notdir $@)
diff --git a/src/emc/usr_intf/qtplasmac/pmx485-test.py b/src/emc/usr_intf/qtplasmac/pmx485-test.py
index 1556add41f7..3f10a70a340 100755
--- a/src/emc/usr_intf/qtplasmac/pmx485-test.py
+++ b/src/emc/usr_intf/qtplasmac/pmx485-test.py
@@ -66,7 +66,7 @@ def __init__(self):
self.setWindowIcon(QIcon(os.path.join(self.iconBase, self.iconPath)))
self.setWindowTitle('Powermax Communicator')
qtRectangle = self.frameGeometry()
- centerPoint = QDesktopWidget().availableGeometry().center()
+ centerPoint = QApplication.primaryScreen().availableGeometry().center()
qtRectangle.moveCenter(centerPoint)
self.move(qtRectangle.topLeft())
self.createGridLayout()