Merge WIP_onboarding

This commit is contained in:
Lipu Fei 2019-03-21 09:21:56 +01:00
commit 85a3b54111
4 changed files with 16 additions and 8 deletions

View file

@ -29,7 +29,6 @@ class GlobalStacksModel(ListModel):
self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection") self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection")
self.addRoleName(self.MetaDataRole, "metadata") self.addRoleName(self.MetaDataRole, "metadata")
self.addRoleName(self.DiscoverySourceRole, "discoverySource") self.addRoleName(self.DiscoverySourceRole, "discoverySource")
self._container_stacks = []
self._change_timer = QTimer() self._change_timer = QTimer()
self._change_timer.setInterval(200) self._change_timer.setInterval(200)
@ -40,7 +39,6 @@ class GlobalStacksModel(ListModel):
CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged) CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged)
CuraContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged) CuraContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged)
CuraContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged) CuraContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged)
self._filter_dict = {}
self._updateDelayed() self._updateDelayed()
## Handler for container added/removed events from registry ## Handler for container added/removed events from registry

View file

@ -1,11 +1,13 @@
# Copyright (c) 2017 Ultimaker B.V. # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional
from PyQt5.QtCore import pyqtProperty, QObject from PyQt5.QtCore import pyqtProperty, QObject
class MaterialOutputModel(QObject): class MaterialOutputModel(QObject):
def __init__(self, guid: str, type: str, color: str, brand: str, name: str, parent = None): def __init__(self, guid: Optional[str], type: str, color: str, brand: str, name: str, parent = None) -> None:
super().__init__(parent) super().__init__(parent)
self._guid = guid self._guid = guid
self._type = type self._type = type
@ -15,7 +17,7 @@ class MaterialOutputModel(QObject):
@pyqtProperty(str, constant = True) @pyqtProperty(str, constant = True)
def guid(self) -> str: def guid(self) -> str:
return self._guid return self._guid if self._guid else ""
@pyqtProperty(str, constant = True) @pyqtProperty(str, constant = True)
def type(self) -> str: def type(self) -> str:

View file

@ -2,6 +2,7 @@
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from collections import defaultdict from collections import defaultdict
from typing import Dict
from PyQt5.QtCore import QTimer from PyQt5.QtCore import QTimer
@ -18,7 +19,7 @@ catalog = i18nCatalog("cura")
## Keep track of all objects in the project ## Keep track of all objects in the project
class ObjectsModel(ListModel): class ObjectsModel(ListModel):
def __init__(self): def __init__(self) -> None:
super().__init__() super().__init__()
Application.getInstance().getController().getScene().sceneChanged.connect(self._updateSceneDelayed) Application.getInstance().getController().getScene().sceneChanged.connect(self._updateSceneDelayed)
@ -48,7 +49,7 @@ class ObjectsModel(ListModel):
filter_current_build_plate = Application.getInstance().getPreferences().getValue("view/filter_current_build_plate") filter_current_build_plate = Application.getInstance().getPreferences().getValue("view/filter_current_build_plate")
active_build_plate_number = self._build_plate_number active_build_plate_number = self._build_plate_number
group_nr = 1 group_nr = 1
name_count_dict = defaultdict(int) name_count_dict = defaultdict(int) # type: Dict[str, int]
for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()): for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
if not isinstance(node, SceneNode): if not isinstance(node, SceneNode):

View file

@ -27,9 +27,17 @@ from UM.Version import Version
from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice
from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager
<<<<<<< HEAD
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.Settings.GlobalStack import GlobalStack from cura.Settings.GlobalStack import GlobalStack
from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
=======
from typing import Optional, TYPE_CHECKING
if TYPE_CHECKING:
from cura.Settings.GlobalStack import GlobalStack
>>>>>>> origin/WIP_onboarding
i18n_catalog = i18nCatalog("cura") i18n_catalog = i18nCatalog("cura")
@ -450,9 +458,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
Logger.log("d", "Checking if cloud connection is possible...") Logger.log("d", "Checking if cloud connection is possible...")
# Pre-Check: Skip if active machine already has been cloud connected or you said don't ask again # Pre-Check: Skip if active machine already has been cloud connected or you said don't ask again
active_machine = self._application.getMachineManager().activeMachine # type: Optional[GlobalStack] active_machine = self._application.getMachineManager().activeMachine # type: Optional[GlobalStack]
if active_machine: if active_machine:
# Check 1A: Printer isn't already configured for cloud # Check 1A: Printer isn't already configured for cloud
if ConnectionType.CloudConnection.value in active_machine.configuredConnectionTypes: if ConnectionType.CloudConnection.value in active_machine.configuredConnectionTypes:
Logger.log("d", "Active machine was already configured for cloud.") Logger.log("d", "Active machine was already configured for cloud.")