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

View file

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

View file

@ -2,6 +2,7 @@
# Cura is released under the terms of the LGPLv3 or higher.
from collections import defaultdict
from typing import Dict
from PyQt5.QtCore import QTimer
@ -18,7 +19,7 @@ catalog = i18nCatalog("cura")
## Keep track of all objects in the project
class ObjectsModel(ListModel):
def __init__(self):
def __init__(self) -> None:
super().__init__()
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")
active_build_plate_number = self._build_plate_number
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()):
if not isinstance(node, SceneNode):

View file

@ -27,9 +27,17 @@ from UM.Version import Version
from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice
from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager
<<<<<<< HEAD
if TYPE_CHECKING:
from cura.Settings.GlobalStack import GlobalStack
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")
@ -452,7 +460,6 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
# 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]
if active_machine:
# Check 1A: Printer isn't already configured for cloud
if ConnectionType.CloudConnection.value in active_machine.configuredConnectionTypes:
Logger.log("d", "Active machine was already configured for cloud.")