import sys from PyQt6.QtGui import QGuiApplication from PyQt6.QtQml import QQmlApplicationEngine from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal from GcodeParser import load_gcode_vertices class GcodeData(QObject): verticesChanged = pyqtSignal() def __init__(self): super().__init__() # self._vertices = load_gcode_vertices("/home/lhye200/.octoprint/uploads/20260414135441_42bff5215c6148b8b5f4d8c4f15d5ddc.gcode") self._vertices = load_gcode_vertices("test.gcode") def getVertices(self): return self._vertices vertices = pyqtProperty('QVariantList', getVertices, notify=verticesChanged) app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() model = GcodeData() engine.rootContext().setContextProperty("gcodeData", model.vertices) engine.load("gcode_view2.qml") if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec())