Skip to content

Commit eb87c5b

Browse files
committed
qtvcp: port to PyQt6
1 parent fe65aa1 commit eb87c5b

201 files changed

Lines changed: 2725 additions & 2763 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

configs/sim/qtvcp_screens/qtaxis_lathe/qtaxis/qtaxis_handler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import os
66
import linuxcnc
77

8-
from PyQt5 import QtCore, QtWidgets
9-
from PyQt5.QtGui import QColor
8+
from PyQt6 import QtCore, QtWidgets
9+
from PyQt6.QtGui import QColor
1010

1111
from qtvcp.widgets.mdi_line import MDILine as MDI_WIDGET
1212
from qtvcp.widgets.gcode_editor import GcodeEditor as GCODE
@@ -161,8 +161,8 @@ def processed_key_event__(self,receiver,event,is_pressed,key,code,shift,cntrl):
161161
# when typing in MDI, we don't want keybinding to call functions
162162
# so we catch and process the events directly.
163163
# We do want ESC, F1 and F2 to call keybinding functions though
164-
if code not in(QtCore.Qt.Key_Escape,QtCore.Qt.Key_F1 ,QtCore.Qt.Key_F2,
165-
QtCore.Qt.Key_F3,QtCore.Qt.Key_F5,QtCore.Qt.Key_F5):
164+
if code not in(QtCore.Qt.Key.Key_Escape,QtCore.Qt.Key.Key_F1 ,QtCore.Qt.Key.Key_F2,
165+
QtCore.Qt.Key.Key_F3,QtCore.Qt.Key.Key_F5,QtCore.Qt.Key.Key_F5):
166166

167167
# search for the top widget of whatever widget received the event
168168
# then check if it's one we want the keypress events to go to
@@ -430,7 +430,7 @@ def quick_reference(self):
430430
msg.setLayout(layout)
431431
msg.setMinimumSize(700,800)
432432
msg.show()
433-
retval = msg.exec_()
433+
retval = msg.exec()
434434

435435
def launch_log_dialog(self):
436436
ACTION.CALL_DIALOG({'NAME':'MACHINELOG', 'ID':'_qtaxis_handler_'})
@@ -484,7 +484,7 @@ def make_corner_widgets(self):
484484
self.w.tool_stat.setProperty('tool_number_status', True)
485485
self.w.tool_stat.setProperty('textTemplate', 'Tool %d')
486486
self.w.tool_stat.hal_init()
487-
self.w.tool_stat.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
487+
self.w.tool_stat.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter)
488488
self.w.tool_stat.setFixedWidth(60)
489489
self.w.leftTab.setCornerWidget(self.w.tool_stat)
490490

configs/sim/qtvcp_screens/qtdragon/qtvcp/screens/qtdragon/qtdragon_handler.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os, time
2-
from PyQt5 import QtCore, QtWidgets, QtGui
2+
from PyQt6 import QtCore, QtWidgets, QtGui
33
from qtvcp.widgets.gcode_editor import GcodeEditor as GCODE
44
from qtvcp.widgets.gcode_graphics import GCodeGraphics as GRAPHICS
55
from qtvcp.widgets.mdi_line import MDILine as MDI_WIDGET
@@ -28,9 +28,9 @@
2828
QHAL = Qhal()
2929

3030
try:
31-
from PyQt5.QtWebEngineWidgets import QWebEnginePage
31+
from PyQt6.QtWebEngineWidgets import QWebEnginePage
3232
except:
33-
LOG.warning('QtDragon Warning with loading QtWebEngineWidget - is python3-pyqt5.qtwebengine installed?')
33+
LOG.warning('QtDragon Warning with loading QtWebEngineWidget - is python3-pyqt6.qtwebengine installed?')
3434

3535
# constants for tab pages
3636
TAB_MAIN = 0
@@ -66,7 +66,7 @@ def __init__(self, halcomp, widgets, paths):
6666
self.w = widgets
6767
self.gcodes = GCodes(widgets)
6868
# This validator precludes using comma as a decimal
69-
self.valid = QtGui.QRegExpValidator(QtCore.QRegExp('-?[0-9]{0,6}[.][0-9]{0,3}'))
69+
self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('-?[0-9]{0,6}[.][0-9]{0,3}'))
7070
self.KEYBIND = KEYBIND
7171
KEYBIND.add_call('Key_F11','on_keycall_F11')
7272
KEYBIND.add_call('Key_F12','on_keycall_F12')
@@ -478,7 +478,7 @@ def init_probe(self):
478478
self.probe.setObjectName('versaprobe')
479479
# only use cycle start button to start probing
480480
self.probe.setProperty('runImmediately',False)
481-
self.probe.setFocusPolicy(QtCore.Qt.ClickFocus)
481+
self.probe.setFocusPolicy(QtCore.Qt.FocusPolicy.ClickFocus)
482482

483483
elif probe == 'basicprobe':
484484
LOG.info("Using Basic Probe")
@@ -488,7 +488,7 @@ def init_probe(self):
488488
self.probe.setObjectName('basicprobe')
489489
# only use cycle start button to start probing
490490
self.probe.setProperty('runImmediately',False)
491-
self.probe.setFocusPolicy(QtCore.Qt.ClickFocus)
491+
self.probe.setFocusPolicy(QtCore.Qt.FocusPolicy.ClickFocus)
492492

493493
else:
494494
LOG.info("No valid probe widget specified")
@@ -603,8 +603,8 @@ def processed_key_event__(self,receiver,event,is_pressed,key,code,shift,cntrl):
603603
# when typing in MDI, we don't want keybinding to call functions
604604
# so we catch and process the events directly.
605605
# We do want ESC, F1 and F2 to call keybinding functions though
606-
if code not in(QtCore.Qt.Key_Escape,QtCore.Qt.Key_F1 ,QtCore.Qt.Key_F2):
607-
# QtCore.Qt.Key_F3,QtCore.Qt.Key_F4,QtCore.Qt.Key_F5):
606+
if code not in(QtCore.Qt.Key.Key_Escape,QtCore.Qt.Key.Key_F1 ,QtCore.Qt.Key.Key_F2):
607+
# QtCore.Qt.Key.Key_F3,QtCore.Qt.Key.Key_F4,QtCore.Qt.Key.Key_F5):
608608

609609
# search for the top widget of whatever widget received the event
610610
# then check if it's one we want the keypress events to go to
@@ -1390,12 +1390,12 @@ def update_gcode_properties(self, props ):
13901390
return
13911391
# pop a dialog of the properties
13921392
msg = QtWidgets.QMessageBox()
1393-
msg.setIcon(QtWidgets.QMessageBox.Information)
1393+
msg.setIcon(QtWidgets.QMessageBox.Icon.Information)
13941394
msg.setText(smallmess)
13951395
msg.setWindowTitle("Gcode Properties")
1396-
msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
1396+
msg.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok)
13971397
msg.show()
1398-
retval = msg.exec_()
1398+
retval = msg.exec()
13991399

14001400
def touchoff(self, selector):
14011401
if selector == 'touchplate':
@@ -1702,7 +1702,7 @@ def adjust_stacked_widgets(self,requestedIndex,mode_change=False):
17021702
#print ('CURRENT:',name)
17031703
# record current qsplitter settings
17041704
self.w.settings.beginGroup("qtdragon-{}".format(self.w.splitter_h.objectName()))
1705-
self.w.settings.setValue(name, QtCore.QVariant(self.w.splitter_h.saveState().data()))
1705+
self.w.settings.setValue(name, QtCore.self.w.splitter_h.saveState(.data()))
17061706
self.w.settings.endGroup()
17071707

17081708
# ignore, show or hide jog controls

configs/sim/qtvcp_screens/qtvcp_custom/qtdefault_ngc/qtdefault_ngc_handler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# **** IMPORT SECTION **** #
33
############################
44

5-
from PyQt5 import QtCore
6-
from PyQt5 import QtWidgets
5+
from PyQt6 import QtCore
6+
from PyQt6 import QtWidgets
77
from qtvcp.widgets.origin_offsetview import OriginOffsetView as OFFVIEW_WIDGET
88
from qtvcp.widgets.tool_offsetview import ToolOffsetView as TOOLVIEW_WIDGET
99
from qtvcp.widgets.dialog_widget import CamViewDialog as CAMVIEW
@@ -75,8 +75,8 @@ def processed_key_event__(self,receiver,event,is_pressed,key,code,shift,cntrl):
7575
# when typing in MDI, we don't want keybinding to call functions
7676
# so we catch and process the events directly.
7777
# We do want ESC, F1 and F2 to call keybinding functions though
78-
if code not in(QtCore.Qt.Key_Escape,QtCore.Qt.Key_F1 ,QtCore.Qt.Key_F2,
79-
QtCore.Qt.Key_F3,QtCore.Qt.Key_F5,QtCore.Qt.Key_F5):
78+
if code not in(QtCore.Qt.Key.Key_Escape,QtCore.Qt.Key.Key_F1 ,QtCore.Qt.Key.Key_F2,
79+
QtCore.Qt.Key.Key_F3,QtCore.Qt.Key.Key_F5,QtCore.Qt.Key.Key_F5):
8080
if isinstance(receiver, OFFVIEW_WIDGET) or \
8181
isinstance(receiver, MDI_WIDGET) or isinstance(receiver, TOOLVIEW_WIDGET):
8282
if is_pressed:

configs/sim/qtvcp_screens/qtvcp_experimental/qtdefault_gladevcp/qtdefault_gladevcp_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# **** IMPORT SECTION **** #
33
############################
44

5-
from PyQt5 import QtCore, QtWidgets
5+
from PyQt6 import QtCore, QtWidgets
66
from qtvcp.widgets.origin_offsetview import OriginOffsetView as OFFVIEW_WIDGET
77
from qtvcp.widgets.dialog_widget import CamViewDialog as CAMVIEW
88
from qtvcp.widgets.dialog_widget import MacroTabDialog as LATHEMACRO
@@ -59,8 +59,8 @@ def processed_key_event__(self,receiver,event,is_pressed,key,code,shift,cntrl):
5959
# when typing in MDI, we don't want keybinding to call functions
6060
# so we catch and process the events directly.
6161
# We do want ESC, F1 and F2 to call keybinding functions though
62-
if code not in(QtCore.Qt.Key_Escape,QtCore.Qt.Key_F1 ,QtCore.Qt.Key_F2,
63-
QtCore.Qt.Key_F3,QtCore.Qt.Key_F5,QtCore.Qt.Key_F5):
62+
if code not in(QtCore.Qt.Key.Key_Escape,QtCore.Qt.Key.Key_F1 ,QtCore.Qt.Key.Key_F2,
63+
QtCore.Qt.Key.Key_F3,QtCore.Qt.Key.Key_F5,QtCore.Qt.Key.Key_F5):
6464
if isinstance(receiver, OFFVIEW_WIDGET) or isinstance(receiver, MDI_WIDGET):
6565
if is_pressed:
6666
receiver.keyPressEvent(event)

configs/sim/qtvcp_screens/qtvcp_experimental/qtdefault_gladevcp_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import linuxcnc
77

8-
from PyQt5 import QtCore, QtWidgets
8+
from PyQt6 import QtCore, QtWidgets
99

1010
from qtvcp.widgets.mdi_line import MDILine as MDI_WIDGET
1111
from qtvcp.widgets.gcode_editor import GcodeEditor as GCODE
@@ -56,8 +56,8 @@ def processed_key_event__(self,receiver,event,is_pressed,key,code,shift,cntrl):
5656
# when typing in MDI, we don't want keybinding to call functions
5757
# so we catch and process the events directly.
5858
# We do want ESC, F1 and F2 to call keybinding functions though
59-
if code not in(QtCore.Qt.Key_Escape,QtCore.Qt.Key_F1 ,QtCore.Qt.Key_F2,
60-
QtCore.Qt.Key_F3,QtCore.Qt.Key_F5,QtCore.Qt.Key_F5):
59+
if code not in(QtCore.Qt.Key.Key_Escape,QtCore.Qt.Key.Key_F1 ,QtCore.Qt.Key.Key_F2,
60+
QtCore.Qt.Key.Key_F3,QtCore.Qt.Key.Key_F5,QtCore.Qt.Key.Key_F5):
6161

6262
# search for the top widget of whatever widget received the event
6363
# then check if it's one we want the keypress events to go to

configs/sim/qtvcp_screens/qtvcp_experimental/qtdefault_gladevcp_handler_1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# **** IMPORT SECTION **** #
33
############################
44

5-
from PyQt5 import QtCore
6-
from PyQt5 import QtWidgets
5+
from PyQt6 import QtCore
6+
from PyQt6 import QtWidgets
77
from qtvcp.widgets.origin_offsetview import OriginOffsetView as OFFVIEW_WIDGET
88
from qtvcp.widgets.tool_offsetview import ToolOffsetView as TOOLVIEW_WIDGET
99
from qtvcp.widgets.dialog_widget import CamViewDialog as CAMVIEW
@@ -75,8 +75,8 @@ def processed_key_event__(self,receiver,event,is_pressed,key,code,shift,cntrl):
7575
# when typing in MDI, we don't want keybinding to call functions
7676
# so we catch and process the events directly.
7777
# We do want ESC, F1 and F2 to call keybinding functions though
78-
if code not in(QtCore.Qt.Key_Escape,QtCore.Qt.Key_F1 ,QtCore.Qt.Key_F2,
79-
QtCore.Qt.Key_F3,QtCore.Qt.Key_F5,QtCore.Qt.Key_F5):
78+
if code not in(QtCore.Qt.Key.Key_Escape,QtCore.Qt.Key.Key_F1 ,QtCore.Qt.Key.Key_F2,
79+
QtCore.Qt.Key.Key_F3,QtCore.Qt.Key.Key_F5,QtCore.Qt.Key.Key_F5):
8080
if isinstance(receiver, OFFVIEW_WIDGET) or \
8181
isinstance(receiver, MDI_WIDGET) or isinstance(receiver, TOOLVIEW_WIDGET):
8282
if is_pressed:

configs/sim/qtvcp_screens/qtvcp_experimental/qtdefault_ngc/qtdefault_ngc_handler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# **** IMPORT SECTION **** #
33
############################
44

5-
from PyQt5 import QtCore
6-
from PyQt5 import QtWidgets
5+
from PyQt6 import QtCore
6+
from PyQt6 import QtWidgets
77
from qtvcp.widgets.origin_offsetview import OriginOffsetView as OFFVIEW_WIDGET
88
from qtvcp.widgets.tool_offsetview import ToolOffsetView as TOOLVIEW_WIDGET
99
from qtvcp.widgets.dialog_widget import CamViewDialog as CAMVIEW
@@ -75,8 +75,8 @@ def processed_key_event__(self,receiver,event,is_pressed,key,code,shift,cntrl):
7575
# when typing in MDI, we don't want keybinding to call functions
7676
# so we catch and process the events directly.
7777
# We do want ESC, F1 and F2 to call keybinding functions though
78-
if code not in(QtCore.Qt.Key_Escape,QtCore.Qt.Key_F1 ,QtCore.Qt.Key_F2,
79-
QtCore.Qt.Key_F3,QtCore.Qt.Key_F5,QtCore.Qt.Key_F5):
78+
if code not in(QtCore.Qt.Key.Key_Escape,QtCore.Qt.Key.Key_F1 ,QtCore.Qt.Key.Key_F2,
79+
QtCore.Qt.Key.Key_F3,QtCore.Qt.Key.Key_F5,QtCore.Qt.Key.Key_F5):
8080
if isinstance(receiver, OFFVIEW_WIDGET) or \
8181
isinstance(receiver, MDI_WIDGET) or isinstance(receiver, TOOLVIEW_WIDGET):
8282
if is_pressed:

configs/sim/woodpecker/1280x1024_5axis/woodpecker_handler.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import linuxcnc
33
import hal
44
import sys
5-
from PyQt5.QtWidgets import QMessageBox
6-
from PyQt5 import QtCore, QtWidgets, QtGui, uic
5+
from PyQt6.QtWidgets import QMessageBox
6+
from PyQt6 import QtCore, QtWidgets, QtGui, uic
77
try:
8-
from PyQt5.QtWebKitWidgets import QWebView
8+
from PyQt6.QtWebKitWidgets import QWebView
99
except ImportError:
10-
raise Exception("Qtvcp error with woodpecker - is package python-pyqt5.qtwebkit installed?")
10+
raise Exception("Qtvcp error with woodpecker - is package python-pyqt6.qtwebkit installed?")
1111
from qtvcp.widgets.gcode_editor import GcodeEditor as GCODE
1212
from qtvcp.widgets.mdi_line import MDILine as MDI_WIDGET
1313
from qtvcp.widgets.tool_offsetview import ToolOffsetView as TOOL_TABLE
@@ -63,7 +63,7 @@ def __init__(self, halcomp, widgets, paths):
6363
self.PATHS = paths
6464
self.gcodes = GCodes(widgets)
6565
self._last_count = 0
66-
self.valid = QtGui.QRegExpValidator(QtCore.QRegExp('-?[0-9]{0,6}[.][0-9]{0,3}'))
66+
self.valid = QtGui.QRegularExpressionValidator(QtCore.QRegularExpression('-?[0-9]{0,6}[.][0-9]{0,3}'))
6767
self.styleeditor = SSE(widgets, paths)
6868
KEYBIND.add_call('Key_F10','on_keycall_F10')
6969
KEYBIND.add_call('Key_F11','on_keycall_F11')
@@ -417,7 +417,7 @@ def init_widgets(self):
417417

418418
# gcode file history
419419
self.w.cmb_gcode_history.addItem("No File Loaded")
420-
self.w.cmb_gcode_history.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
420+
self.w.cmb_gcode_history.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded)
421421
# mdi history
422422
self.w.mdihistory.MDILine.setFixedHeight(30)
423423
self.w.mdihistory.MDILine.setPlaceholderText('MDI:')
@@ -434,7 +434,7 @@ def init_widgets(self):
434434

435435
#tool icons
436436
self.w.cmb_tool_icons.addItem("SELECT\nICON")
437-
self.w.cmb_tool_icons.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
437+
self.w.cmb_tool_icons.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded)
438438
path = os.path.join(PATH.CONFIGPATH, "tool_icons")
439439
if os.path.isdir(path):
440440
icons = os.listdir(path)
@@ -520,8 +520,8 @@ def processed_key_event__(self,receiver,event,is_pressed,key,code,shift,cntrl):
520520
# when typing in MDI, we don't want keybinding to call functions
521521
# so we catch and process the events directly.
522522
# We do want ESC, F1 and F2 to call keybinding functions though
523-
if code not in(QtCore.Qt.Key_Escape,QtCore.Qt.Key_F1 ,QtCore.Qt.Key_F2):
524-
# QtCore.Qt.Key_F3,QtCore.Qt.Key_F4,QtCore.Qt.Key_F5):
523+
if code not in(QtCore.Qt.Key.Key_Escape,QtCore.Qt.Key.Key_F1 ,QtCore.Qt.Key.Key_F2):
524+
# QtCore.Qt.Key.Key_F3,QtCore.Qt.Key.Key_F4,QtCore.Qt.Key.Key_F5):
525525

526526
# search for the top widget of whatever widget received the event
527527
# then check if it's one we want the keypress events to go to
@@ -1310,12 +1310,12 @@ def update_gcode_properties(self, props ):
13101310
return
13111311
# pop a dialog of the properties
13121312
msg = QtWidgets.QMessageBox()
1313-
msg.setIcon(QtWidgets.QMessageBox.Information)
1313+
msg.setIcon(QtWidgets.QMessageBox.Icon.Information)
13141314
msg.setText(smallmess)
13151315
msg.setWindowTitle("Gcode Properties")
1316-
msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
1316+
msg.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok)
13171317
msg.show()
1318-
retval = msg.exec_()
1318+
retval = msg.exec()
13191319

13201320
def touchoff(self, selector):
13211321
if selector == 'touchplate':

configs/sim/woodpecker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
### Extra libraries are required in addition to those for the installation of QTVCP for additional functionality
33

44
#### For viewing job setup sheets and help pages formatted in HTML
5-
sudo apt-get install python3-pyqt5.qtwebengine
5+
sudo apt-get install python3-pyqt6.qtwebengine
66

77
#### To communicate with Huanyang GT series VFDs
88
sudo apt-get install python3-pymodbus

configs/sim/woodpecker/compensate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import time
2222
import linuxcnc
2323
import hal
24-
from PyQt5 import QtGui, QtWidgets
24+
from PyQt6 import QtGui, QtWidgets
2525
import numpy as np
2626
import matplotlib.pyplot as plt
2727
import matplotlib.cm as cm

0 commit comments

Comments
 (0)