Pass application

This commit is contained in:
Lipu Fei 2019-03-28 14:43:37 +01:00
parent 3ad79a5888
commit f4d0e39788
3 changed files with 19 additions and 14 deletions

View file

@ -1,12 +1,15 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional, Dict, Any
from typing import Optional, Dict, Any, TYPE_CHECKING
from PyQt5.QtCore import QObject, Qt, pyqtProperty, pyqtSignal, pyqtSlot
from UM.Qt.ListModel import ListModel
if TYPE_CHECKING:
from cura.CuraApplication import CuraApplication
#
# This model holds all first-start machine actions for the currently active machine. It has 2 roles:
@ -20,7 +23,7 @@ class FirstStartMachineActionsModel(ListModel):
ContentRole = Qt.UserRole + 2
ActionRole = Qt.UserRole + 3
def __init__(self, parent: Optional[QObject] = None) -> None:
def __init__(self, application: "CuraApplication", parent: Optional[QObject] = None) -> None:
super().__init__(parent)
self.addRoleName(self.TitleRole, "title")
@ -29,9 +32,7 @@ class FirstStartMachineActionsModel(ListModel):
self._current_action_index = 0
from cura.CuraApplication import CuraApplication
self._application = CuraApplication.getInstance()
self._application = application
self._application.initializationFinished.connect(self._initialize)
def _initialize(self) -> None: