mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-01 16:24:41 +08:00
Register all QML files in Cura's QML directory as part of the Cura module
Jaime asked for it.
This commit is contained in:
parent
4dffc414fb
commit
f21e48adbb
@ -42,7 +42,7 @@ from . import MachineManagerModel
|
|||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS
|
from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS
|
||||||
from PyQt5.QtGui import QColor, QIcon
|
from PyQt5.QtGui import QColor, QIcon
|
||||||
from PyQt5.QtQml import qmlRegisterUncreatableType, qmlRegisterSingletonType
|
from PyQt5.QtQml import qmlRegisterUncreatableType, qmlRegisterSingletonType, qmlRegisterType
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
@ -365,6 +365,15 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
qmlRegisterUncreatableType(CuraApplication, "Cura", 1, 0, "ResourceTypes", "Just an Enum type")
|
qmlRegisterUncreatableType(CuraApplication, "Cura", 1, 0, "ResourceTypes", "Just an Enum type")
|
||||||
|
|
||||||
|
qmlRegisterSingletonType(QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "Actions.qml")), "Cura", 1, 0, "Actions")
|
||||||
|
|
||||||
|
for path in Resources.getAllResourcesOfType(CuraApplication.ResourceTypes.QmlFiles):
|
||||||
|
type_name = os.path.splitext(os.path.basename(path))[0]
|
||||||
|
if type_name in ("Cura", "Actions"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
qmlRegisterType(QUrl.fromLocalFile(path), "Cura", 1, 0, type_name)
|
||||||
|
|
||||||
def onSelectionChanged(self):
|
def onSelectionChanged(self):
|
||||||
if Selection.hasSelection():
|
if Selection.hasSelection():
|
||||||
if not self.getController().getActiveTool():
|
if not self.getController().getActiveTool():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user