Merge WIP_onboarding

This commit is contained in:
Lipu Fei 2019-03-20 11:28:30 +01:00
commit c3c9c53f13
77 changed files with 265 additions and 308 deletions

View file

@ -48,8 +48,7 @@ from cura.Arranging.Arrange import Arrange
from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob
from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob
from cura.Arranging.ShapeArray import ShapeArray from cura.Arranging.ShapeArray import ShapeArray
from cura.MultiplyObjectsJob import MultiplyObjectsJob from cura.UI.GlobalStacksModel import GlobalStacksModel
from cura.GlobalStacksModel import GlobalStacksModel
from cura.Scene.ConvexHullDecorator import ConvexHullDecorator from cura.Scene.ConvexHullDecorator import ConvexHullDecorator
from cura.Operations.SetParentOperation import SetParentOperation from cura.Operations.SetParentOperation import SetParentOperation
from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator
@ -68,19 +67,19 @@ from UM.Settings.SettingFunction import SettingFunction
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
from cura.Settings.MachineNameValidator import MachineNameValidator from cura.Settings.MachineNameValidator import MachineNameValidator
from cura.Machines.Models.BuildPlateModel import BuildPlateModel from cura.UI.MachineModels.BuildPlateModel import BuildPlateModel
from cura.Machines.Models.NozzleModel import NozzleModel from cura.UI.MachineModels.DiscoveredPrintersModel import DiscoveredPrintersModel
from cura.Machines.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel from cura.UI.MachineModels.NozzleModel import NozzleModel
from cura.Machines.Models.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel from cura.UI.MachineModels.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel
from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel from cura.UI.MachineModels.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel
from cura.Machines.Models.FavoriteMaterialsModel import FavoriteMaterialsModel from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel
from cura.Machines.Models.GenericMaterialsModel import GenericMaterialsModel from cura.UI.MachineModels.FavoriteMaterialsModel import FavoriteMaterialsModel
from cura.Machines.Models.MaterialBrandsModel import MaterialBrandsModel from cura.UI.MachineModels.FirstStartMachineActionsModel import FirstStartMachineActionsModel
from cura.Machines.Models.QualityManagementModel import QualityManagementModel from cura.UI.MachineModels.GenericMaterialsModel import GenericMaterialsModel
from cura.Machines.Models.QualitySettingsModel import QualitySettingsModel from cura.UI.MachineModels.MaterialBrandsModel import MaterialBrandsModel
from cura.Machines.Models.FirstStartMachineActionsModel import FirstStartMachineActionsModel from cura.UI.MachineModels.QualityManagementModel import QualityManagementModel
from cura.UI.MachineModels.QualitySettingsModel import QualitySettingsModel
from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.UI.MachineModels.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel
from cura.Machines.MachineErrorChecker import MachineErrorChecker from cura.Machines.MachineErrorChecker import MachineErrorChecker
@ -94,30 +93,26 @@ from .AutoSave import AutoSave
from . import PlatformPhysics from . import PlatformPhysics
from . import BuildVolume from . import BuildVolume
from . import CameraAnimation from . import CameraAnimation
from . import PrintInformation
from . import CuraActions from . import CuraActions
from cura.Scene import ZOffsetDecorator from cura.Scene import ZOffsetDecorator
from . import CuraSplashScreen from cura.UI import CuraSplashScreen, MachineActionManager, PrintInformation
from . import PrintJobPreviewImageProvider from . import PrintJobPreviewImageProvider
from . import MachineActionManager
from cura.TaskManagement.OnExitCallbackManager import OnExitCallbackManager from cura.TaskManagement.OnExitCallbackManager import OnExitCallbackManager
from cura.Settings.MachineManager import MachineManager from cura.Settings.MachineManager import MachineManager
from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderManager import ExtruderManager
from cura.Settings.UserChangesModel import UserChangesModel from cura.UI.UserChangesModel import UserChangesModel
from cura.Settings.ExtrudersModel import ExtrudersModel from cura.UI.ExtrudersModel import ExtrudersModel
from cura.Settings.MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler from cura.Settings.MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler
from cura.Settings.ContainerManager import ContainerManager from cura.Settings.ContainerManager import ContainerManager
from cura.Settings.SidebarCustomMenuItemsModel import SidebarCustomMenuItemsModel from cura.Settings.SidebarCustomMenuItemsModel import SidebarCustomMenuItemsModel
import cura.Settings.cura_empty_instance_containers import cura.Settings.cura_empty_instance_containers
from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions
from cura.ObjectsModel import ObjectsModel from cura.UI.ObjectsModel import ObjectsModel
from cura.Machines.Models.DiscoveredPrintersModel import DiscoveredPrintersModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
from cura.PrinterOutputDevice import PrinterOutputDevice
from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage
from cura import ApplicationMetadata, UltimakerCloudAuthentication from cura import ApplicationMetadata, UltimakerCloudAuthentication
@ -1010,7 +1005,7 @@ class CuraApplication(QtApplication):
qmlRegisterSingletonType(SimpleModeSettingsManager, "Cura", 1, 0, "SimpleModeSettingsManager", self.getSimpleModeSettingsManager) qmlRegisterSingletonType(SimpleModeSettingsManager, "Cura", 1, 0, "SimpleModeSettingsManager", self.getSimpleModeSettingsManager)
qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager) qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager)
qmlRegisterType(WelcomePagesModel, "Cura", 1, 0, "WelcomePageModel") qmlRegisterType(WelcomePagesModel, "Cura", 1, 0, "WelcomePagesModel")
qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage") qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage")

View file

@ -9,7 +9,7 @@ from typing import Union
MYPY = False MYPY = False
if MYPY: if MYPY:
from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
class FirmwareUpdater(QObject): class FirmwareUpdater(QObject):
firmwareProgressChanged = pyqtSignal() firmwareProgressChanged = pyqtSignal()

View file

@ -3,14 +3,15 @@
from typing import TYPE_CHECKING, Set, Union, Optional from typing import TYPE_CHECKING, Set, Union, Optional
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
from PyQt5.QtCore import QTimer from PyQt5.QtCore import QTimer
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel from cura.UI.ExtruderOutputModel import ExtruderOutputModel
class GenericOutputController(PrinterOutputController): class GenericOutputController(PrinterOutputController):

View file

@ -1,34 +0,0 @@
# Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot
class MaterialOutputModel(QObject):
def __init__(self, guid, type, color, brand, name, parent = None):
super().__init__(parent)
self._guid = guid
self._type = type
self._color = color
self._brand = brand
self._name = name
@pyqtProperty(str, constant = True)
def guid(self):
return self._guid
@pyqtProperty(str, constant=True)
def type(self):
return self._type
@pyqtProperty(str, constant=True)
def brand(self):
return self._brand
@pyqtProperty(str, constant=True)
def color(self):
return self._color
@pyqtProperty(str, constant=True)
def name(self):
return self._name

View file

@ -7,7 +7,7 @@ from UM.Scene.SceneNode import SceneNode #For typing.
from cura.API import Account from cura.API import Account
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType
from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager, QNetworkReply, QAuthenticator from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager, QNetworkReply, QAuthenticator
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QUrl, QCoreApplication from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QUrl, QCoreApplication

View file

@ -4,13 +4,11 @@
from UM.Logger import Logger from UM.Logger import Logger
from UM.Signal import Signal from UM.Signal import Signal
from typing import Union
MYPY = False MYPY = False
if MYPY: if MYPY:
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel from cura.UI.ExtruderOutputModel import ExtruderOutputModel
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice

View file

@ -16,8 +16,8 @@ from UM.FlameProfiler import pyqtSlot
MYPY = False MYPY = False
if MYPY: if MYPY:
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel
from cura.PrinterOutput.FirmwareUpdater import FirmwareUpdater from cura.PrinterOutput.FirmwareUpdater import FirmwareUpdater
from UM.FileHandler.FileHandler import FileHandler from UM.FileHandler.FileHandler import FileHandler
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
@ -73,7 +73,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
super().__init__(device_id = device_id, parent = parent) # type: ignore # MyPy complains with the multiple inheritance super().__init__(device_id = device_id, parent = parent) # type: ignore # MyPy complains with the multiple inheritance
self._printers = [] # type: List[PrinterOutputModel] self._printers = [] # type: List[PrinterOutputModel]
self._unique_configurations = [] # type: List[ConfigurationModel] self._unique_configurations = [] # type: List[PrinterConfigurationModel]
self._monitor_view_qml_path = "" # type: str self._monitor_view_qml_path = "" # type: str
self._monitor_component = None # type: Optional[QObject] self._monitor_component = None # type: Optional[QObject]
@ -216,7 +216,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
# Returns the unique configurations of the printers within this output device # Returns the unique configurations of the printers within this output device
@pyqtProperty("QVariantList", notify = uniqueConfigurationsChanged) @pyqtProperty("QVariantList", notify = uniqueConfigurationsChanged)
def uniqueConfigurations(self) -> List["ConfigurationModel"]: def uniqueConfigurations(self) -> List["PrinterConfigurationModel"]:
return self._unique_configurations return self._unique_configurations
def _updateUniqueConfigurations(self) -> None: def _updateUniqueConfigurations(self) -> None:

View file

@ -4,8 +4,8 @@ from PyQt5.QtCore import Qt, pyqtSlot, QObject
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
from UM.Scene.Camera import Camera from UM.Scene.Camera import Camera
from cura.ObjectsModel import ObjectsModel from cura.UI.ObjectsModel import ObjectsModel
from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel
from UM.Application import Application from UM.Application import Application
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator

View file

@ -22,10 +22,10 @@ from UM.Settings.SettingFunction import SettingFunction
from UM.Signal import postponeSignals, CompressTechnique from UM.Signal import postponeSignals, CompressTechnique
from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionType from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderManager import ExtruderManager
from cura.Settings.ExtruderStack import ExtruderStack from cura.Settings.ExtruderStack import ExtruderStack
@ -106,7 +106,7 @@ class MachineManager(QObject):
# There might already be some output devices by the time the signal is connected # There might already be some output devices by the time the signal is connected
self._onOutputDevicesChanged() self._onOutputDevicesChanged()
self._current_printer_configuration = ConfigurationModel() # Indicates the current configuration setup in this printer self._current_printer_configuration = PrinterConfigurationModel() # Indicates the current configuration setup in this printer
self.activeMaterialChanged.connect(self._onCurrentConfigurationChanged) self.activeMaterialChanged.connect(self._onCurrentConfigurationChanged)
self.activeVariantChanged.connect(self._onCurrentConfigurationChanged) self.activeVariantChanged.connect(self._onCurrentConfigurationChanged)
# Force to compute the current configuration # Force to compute the current configuration
@ -174,7 +174,7 @@ class MachineManager(QObject):
self.outputDevicesChanged.emit() self.outputDevicesChanged.emit()
@pyqtProperty(QObject, notify = currentConfigurationChanged) @pyqtProperty(QObject, notify = currentConfigurationChanged)
def currentConfiguration(self) -> ConfigurationModel: def currentConfiguration(self) -> PrinterConfigurationModel:
return self._current_printer_configuration return self._current_printer_configuration
def _onCurrentConfigurationChanged(self) -> None: def _onCurrentConfigurationChanged(self) -> None:
@ -205,7 +205,7 @@ class MachineManager(QObject):
self.currentConfigurationChanged.emit() self.currentConfigurationChanged.emit()
@pyqtSlot(QObject, result = bool) @pyqtSlot(QObject, result = bool)
def matchesConfiguration(self, configuration: ConfigurationModel) -> bool: def matchesConfiguration(self, configuration: PrinterConfigurationModel) -> bool:
return self._current_printer_configuration == configuration return self._current_printer_configuration == configuration
@pyqtProperty("QVariantList", notify = outputDevicesChanged) @pyqtProperty("QVariantList", notify = outputDevicesChanged)
@ -1375,7 +1375,7 @@ class MachineManager(QObject):
self.setActiveMachine(new_machine.getId()) self.setActiveMachine(new_machine.getId())
@pyqtSlot(QObject) @pyqtSlot(QObject)
def applyRemoteConfiguration(self, configuration: ConfigurationModel) -> None: def applyRemoteConfiguration(self, configuration: PrinterConfigurationModel) -> None:
if self._global_container_stack is None: if self._global_container_stack is None:
return return
self.blurSettings.emit() self.blurSettings.emit()
@ -1678,7 +1678,9 @@ class MachineManager(QObject):
meta_data = global_stack.getMetaData() meta_data = global_stack.getMetaData()
if "um_network_key" in meta_data: # Global stack already had a connection, but it's changed. # Global stack previously had a connection, so here it needs to change the connection information in all
# global stacks in that same group.
if "um_network_key" in meta_data:
old_network_key = meta_data["um_network_key"] old_network_key = meta_data["um_network_key"]
# Since we might have a bunch of hidden stacks, we also need to change it there. # Since we might have a bunch of hidden stacks, we also need to change it there.
metadata_filter = {"um_network_key": old_network_key} metadata_filter = {"um_network_key": old_network_key}
@ -1698,6 +1700,7 @@ class MachineManager(QObject):
# Ensure that these containers do know that they are configured for network connection # Ensure that these containers do know that they are configured for network connection
container.addConfiguredConnectionType(printer_device.connectionType.value) container.addConfiguredConnectionType(printer_device.connectionType.value)
else: # Global stack didn't have a connection yet, configure it. # Global stack previously didn't have a connection, so directly configure it.
else:
global_stack.setMetaDataEntry("um_network_key", printer_device.key) global_stack.setMetaDataEntry("um_network_key", printer_device.key)
global_stack.addConfiguredConnectionType(printer_device.connectionType.value) global_stack.addConfiguredConnectionType(printer_device.connectionType.value)

View file

@ -1,2 +0,0 @@
# Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.

View file

@ -1,29 +1,32 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 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 PyQt5.QtCore import pyqtProperty, QUrl from PyQt5.QtCore import pyqtProperty, QUrl
from UM.Stage import Stage from UM.Stage import Stage
# Since Cura has a few pre-defined "space claims" for the locations of certain components, we've provided some structure # Since Cura has a few pre-defined "space claims" for the locations of certain components, we've provided some structure
# to indicate this. # to indicate this.
# * The StageMenuComponent is the horizontal area below the stage bar. This should be used to show stage specific # * The StageMenuComponent is the horizontal area below the stage bar. This should be used to show stage specific
# buttons and elements. This component will be drawn over the bar & main component. # buttons and elements. This component will be drawn over the bar & main component.
# * The MainComponent is the component that will be drawn starting from the bottom of the stageBar and fills the rest # * The MainComponent is the component that will be drawn starting from the bottom of the stageBar and fills the rest
# of the screen. # of the screen.
class CuraStage(Stage): class CuraStage(Stage):
def __init__(self, parent = None) -> None: def __init__(self, parent = None) -> None:
super().__init__(parent) super().__init__(parent)
@pyqtProperty(str, constant = True) @pyqtProperty(str, constant = True)
def stageId(self) -> str: def stageId(self) -> str:
return self.getPluginId() return self.getPluginId()
@pyqtProperty(QUrl, constant = True) @pyqtProperty(QUrl, constant = True)
def mainComponent(self) -> QUrl: def mainComponent(self) -> QUrl:
return self.getDisplayComponent("main") return self.getDisplayComponent("main")
@pyqtProperty(QUrl, constant = True) @pyqtProperty(QUrl, constant = True)
def stageMenuComponent(self) -> QUrl: def stageMenuComponent(self) -> QUrl:
return self.getDisplayComponent("menu") return self.getDisplayComponent("menu")
__all__ = ["CuraStage"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from PyQt5.QtCore import pyqtProperty, QObject, pyqtSignal from PyQt5.QtCore import pyqtProperty, QObject, pyqtSignal
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel
class ExtruderConfigurationModel(QObject): class ExtruderConfigurationModel(QObject):
@ -67,4 +67,4 @@ class ExtruderConfigurationModel(QObject):
# Calculating a hash function using the position of the extruder, the material GUID and the hotend id to check if is # Calculating a hash function using the position of the extruder, the material GUID and the hotend id to check if is
# unique within a set # unique within a set
def __hash__(self): def __hash__(self):
return hash(self._position) ^ (hash(self._material.guid) if self._material is not None else hash(0)) ^ hash(self._hotend_id) return hash(self._position) ^ (hash(self._material.guid) if self._material is not None else hash(0)) ^ hash(self._hotend_id)

View file

@ -2,13 +2,13 @@
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel
from typing import Optional, TYPE_CHECKING from typing import Optional, TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel
class ExtruderOutputModel(QObject): class ExtruderOutputModel(QObject):

View file

@ -2,23 +2,25 @@
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty, QTimer from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty, QTimer
from typing import Iterable from typing import Iterable, TYPE_CHECKING
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
import UM.Qt.ListModel from UM.Qt.ListModel import ListModel
from UM.Application import Application from UM.Application import Application
import UM.FlameProfiler import UM.FlameProfiler
from cura.Settings.ExtruderStack import ExtruderStack # To listen to changes on the extruders. if TYPE_CHECKING:
from cura.Settings.ExtruderStack import ExtruderStack # To listen to changes on the extruders.
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
## Model that holds extruders. ## Model that holds extruders.
# #
# This model is designed for use by any list of extruders, but specifically # This model is designed for use by any list of extruders, but specifically
# intended for drop-down lists of the current machine's extruders in place of # intended for drop-down lists of the current machine's extruders in place of
# settings. # settings.
class ExtrudersModel(UM.Qt.ListModel.ListModel): class ExtrudersModel(ListModel):
# The ID of the container stack for the extruder. # The ID of the container stack for the extruder.
IdRole = Qt.UserRole + 1 IdRole = Qt.UserRole + 1

View file

@ -1,12 +1,12 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 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 PyQt5.QtCore import pyqtProperty, Qt, QTimer from PyQt5.QtCore import Qt, QTimer
from UM.Qt.ListModel import ListModel from UM.Qt.ListModel import ListModel
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from cura.PrinterOutputDevice import ConnectionType from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
from cura.Settings.GlobalStack import GlobalStack from cura.Settings.GlobalStack import GlobalStack
@ -17,9 +17,9 @@ class GlobalStacksModel(ListModel):
HasRemoteConnectionRole = Qt.UserRole + 3 HasRemoteConnectionRole = Qt.UserRole + 3
ConnectionTypeRole = Qt.UserRole + 4 ConnectionTypeRole = Qt.UserRole + 4
MetaDataRole = Qt.UserRole + 5 MetaDataRole = Qt.UserRole + 5
SectionNameRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page DiscoverySourceRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page
def __init__(self, parent = None): def __init__(self, parent = None) -> None:
super().__init__(parent) super().__init__(parent)
self._catalog = i18nCatalog("cura") self._catalog = i18nCatalog("cura")
@ -28,7 +28,7 @@ class GlobalStacksModel(ListModel):
self.addRoleName(self.IdRole, "id") self.addRoleName(self.IdRole, "id")
self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection") self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection")
self.addRoleName(self.MetaDataRole, "metadata") self.addRoleName(self.MetaDataRole, "metadata")
self.addRoleName(self.SectionNameRole, "sectionName") self.addRoleName(self.DiscoverySourceRole, "discoverySource")
self._container_stacks = [] self._container_stacks = []
self._change_timer = QTimer() self._change_timer = QTimer()
@ -44,12 +44,12 @@ class GlobalStacksModel(ListModel):
self._updateDelayed() self._updateDelayed()
## Handler for container added/removed events from registry ## Handler for container added/removed events from registry
def _onContainerChanged(self, container): def _onContainerChanged(self, container) -> None:
# We only need to update when the added / removed container GlobalStack # We only need to update when the added / removed container GlobalStack
if isinstance(container, GlobalStack): if isinstance(container, GlobalStack):
self._updateDelayed() self._updateDelayed()
def _updateDelayed(self): def _updateDelayed(self) -> None:
self._change_timer.start() self._change_timer.start()
def _update(self) -> None: def _update(self) -> None:
@ -61,7 +61,8 @@ class GlobalStacksModel(ListModel):
has_remote_connection = False has_remote_connection = False
for connection_type in container_stack.configuredConnectionTypes: for connection_type in container_stack.configuredConnectionTypes:
has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value,
ConnectionType.CloudConnection.value]
if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: if container_stack.getMetaDataEntry("hidden", False) in ["True", True]:
continue continue
@ -73,6 +74,6 @@ class GlobalStacksModel(ListModel):
"id": container_stack.getId(), "id": container_stack.getId(),
"hasRemoteConnection": has_remote_connection, "hasRemoteConnection": has_remote_connection,
"metadata": container_stack.getMetaData().copy(), "metadata": container_stack.getMetaData().copy(),
"sectionName": section_name}) "discoverySource": section_name})
items.sort(key=lambda i: not i["hasRemoteConnection"]) items.sort(key = lambda i: not i["hasRemoteConnection"])
self.setItems(items) self.setItems(items)

View file

@ -12,7 +12,7 @@ from UM.PluginRegistry import PluginRegistry # So MachineAction can be added as
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.Settings.GlobalStack import GlobalStack from cura.Settings.GlobalStack import GlobalStack
from .MachineAction import MachineAction from cura.MachineAction import MachineAction
## Raised when trying to add an unknown machine action as a required action ## Raised when trying to add an unknown machine action as a required action

View file

@ -3,7 +3,7 @@
from UM.Logger import Logger from UM.Logger import Logger
from cura.Machines.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel from cura.UI.MachineModels.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel
# #

View file

@ -1,7 +1,7 @@
# Copyright (c) 2019 Ultimaker B.V. # Copyright (c) 2019 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 Callable, List, Optional, TYPE_CHECKING from typing import Callable, Dict, List, Optional, TYPE_CHECKING
from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject
@ -81,34 +81,34 @@ class DiscoveredPrintersModel(QObject):
def __init__(self, parent: Optional["QObject"]) -> None: def __init__(self, parent: Optional["QObject"]) -> None:
super().__init__(parent) super().__init__(parent)
self._discovered_printer_dict = dict() self._discovered_printer_by_ip_dict = dict() # type: Dict[str, DiscoveredPrinter]
discoveredPrintersChanged = pyqtSignal() discoveredPrintersChanged = pyqtSignal()
@pyqtProperty(list, notify = discoveredPrintersChanged) @pyqtProperty(list, notify = discoveredPrintersChanged)
def discovered_printers(self) -> "List[DiscoveredPrinter]": def discovered_printers(self) -> "List[DiscoveredPrinter]":
item_list = list(x for x in self._discovered_printer_dict.values()) item_list = list(x for x in self._discovered_printer_by_ip_dict.values())
item_list.sort(key = lambda x: x.name) item_list.sort(key = lambda x: x.name)
return item_list return item_list
def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None], def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None],
machine_type: str, device) -> None: machine_type: str, device) -> None:
if ip_address in self._discovered_printer_dict: if ip_address in self._discovered_printer_by_ip_dict:
Logger.log("e", "Printer with ip [%s] has already been added", ip_address) Logger.log("e", "Printer with ip [%s] has already been added", ip_address)
return return
discovered_printer = DiscoveredPrinter(ip_address, key, name, create_callback, machine_type, device, parent = self) discovered_printer = DiscoveredPrinter(ip_address, key, name, create_callback, machine_type, device, parent = self)
self._discovered_printer_dict[ip_address] = discovered_printer self._discovered_printer_by_ip_dict[ip_address] = discovered_printer
self.discoveredPrintersChanged.emit() self.discoveredPrintersChanged.emit()
def updateDiscoveredPrinter(self, ip_address: str, def updateDiscoveredPrinter(self, ip_address: str,
name: Optional[str] = None, name: Optional[str] = None,
machine_type: Optional[str] = None) -> None: machine_type: Optional[str] = None) -> None:
if ip_address not in self._discovered_printer_dict: if ip_address not in self._discovered_printer_by_ip_dict:
Logger.log("e", "Printer with ip [%s] is not known", ip_address) Logger.log("e", "Printer with ip [%s] is not known", ip_address)
return return
item = self._discovered_printer_dict[ip_address] item = self._discovered_printer_by_ip_dict[ip_address]
if name is not None: if name is not None:
item.setName(name) item.setName(name)
@ -116,11 +116,11 @@ class DiscoveredPrintersModel(QObject):
item.setMachineType(machine_type) item.setMachineType(machine_type)
def removeDiscoveredPrinter(self, ip_address: str) -> None: def removeDiscoveredPrinter(self, ip_address: str) -> None:
if ip_address not in self._discovered_printer_dict: if ip_address not in self._discovered_printer_by_ip_dict:
Logger.log("i", "Key [%s] does not exist in the discovered printers list.", ip_address) Logger.log("i", "Key [%s] does not exist in the discovered printers list.", ip_address)
return return
del self._discovered_printer_dict[ip_address] del self._discovered_printer_by_ip_dict[ip_address]
self.discoveredPrintersChanged.emit() self.discoveredPrintersChanged.emit()
@pyqtSlot("QVariant") @pyqtSlot("QVariant")

View file

@ -1,7 +1,7 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 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 cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel
## Model that shows the list of favorite materials. ## Model that shows the list of favorite materials.
class FavoriteMaterialsModel(BaseMaterialsModel): class FavoriteMaterialsModel(BaseMaterialsModel):

View file

@ -1,8 +1,7 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 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 UM.Logger import Logger from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel
from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel
class GenericMaterialsModel(BaseMaterialsModel): class GenericMaterialsModel(BaseMaterialsModel):

View file

@ -1,10 +1,9 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 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 PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty from PyQt5.QtCore import Qt, pyqtSignal
from UM.Qt.ListModel import ListModel from UM.Qt.ListModel import ListModel
from UM.Logger import Logger from cura.UI.MachineModels.BaseMaterialsModel import BaseMaterialsModel
from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel
class MaterialTypesModel(ListModel): class MaterialTypesModel(ListModel):

View file

@ -0,0 +1,34 @@
# Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import pyqtProperty, QObject
class MaterialOutputModel(QObject):
def __init__(self, guid: str, type: str, color: str, brand: str, name: str, parent = None):
super().__init__(parent)
self._guid = guid
self._type = type
self._color = color
self._brand = brand
self._name = name
@pyqtProperty(str, constant = True)
def guid(self) -> str:
return self._guid
@pyqtProperty(str, constant = True)
def type(self) -> str:
return self._type
@pyqtProperty(str, constant = True)
def brand(self) -> str:
return self._brand
@pyqtProperty(str, constant = True)
def color(self) -> str:
return self._color
@pyqtProperty(str, constant = True)
def name(self) -> str:
return self._name

View file

@ -1,6 +1,8 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 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 collections import defaultdict
from PyQt5.QtCore import QTimer from PyQt5.QtCore import QTimer
from UM.Application import Application from UM.Application import Application
@ -10,7 +12,6 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from UM.Scene.Selection import Selection from UM.Scene.Selection import Selection
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from collections import defaultdict
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
@ -30,19 +31,19 @@ class ObjectsModel(ListModel):
self._build_plate_number = -1 self._build_plate_number = -1
def setActiveBuildPlate(self, nr): def setActiveBuildPlate(self, nr: int) -> None:
if self._build_plate_number != nr: if self._build_plate_number != nr:
self._build_plate_number = nr self._build_plate_number = nr
self._update() self._update()
def _updateSceneDelayed(self, source): def _updateSceneDelayed(self, source) -> None:
if not isinstance(source, Camera): if not isinstance(source, Camera):
self._update_timer.start() self._update_timer.start()
def _updateDelayed(self, *args): def _updateDelayed(self, *args) -> None:
self._update_timer.start() self._update_timer.start()
def _update(self, *args): def _update(self, *args) -> None:
nodes = [] nodes = []
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

View file

@ -5,8 +5,7 @@ import json
import math import math
import os import os
import unicodedata import unicodedata
import re # To create abbreviations for printer names. from typing import Dict, List, Optional, TYPE_CHECKING
from typing import Dict, List, Optional
from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot
@ -16,8 +15,6 @@ from UM.Scene.SceneNode import SceneNode
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError
from typing import TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication

View file

@ -1,16 +1,15 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 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 PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
from typing import Optional, TYPE_CHECKING, List from typing import Optional, TYPE_CHECKING, List
from PyQt5.QtCore import QUrl from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot, QUrl
from PyQt5.QtGui import QImage from PyQt5.QtGui import QImage
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel
class PrintJobOutputModel(QObject): class PrintJobOutputModel(QObject):
@ -25,7 +24,7 @@ class PrintJobOutputModel(QObject):
previewImageChanged = pyqtSignal() previewImageChanged = pyqtSignal()
compatibleMachineFamiliesChanged = pyqtSignal() compatibleMachineFamiliesChanged = pyqtSignal()
def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent=None) -> None: def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent = None) -> None:
super().__init__(parent) super().__init__(parent)
self._output_controller = output_controller self._output_controller = output_controller
self._state = "" self._state = ""
@ -36,7 +35,7 @@ class PrintJobOutputModel(QObject):
self._assigned_printer = None # type: Optional[PrinterOutputModel] self._assigned_printer = None # type: Optional[PrinterOutputModel]
self._owner = "" # Who started/owns the print job? self._owner = "" # Who started/owns the print job?
self._configuration = None # type: Optional[ConfigurationModel] self._configuration = None # type: Optional[PrinterConfigurationModel]
self._compatible_machine_families = [] # type: List[str] self._compatible_machine_families = [] # type: List[str]
self._preview_image_id = 0 self._preview_image_id = 0
@ -70,10 +69,10 @@ class PrintJobOutputModel(QObject):
self.previewImageChanged.emit() self.previewImageChanged.emit()
@pyqtProperty(QObject, notify=configurationChanged) @pyqtProperty(QObject, notify=configurationChanged)
def configuration(self) -> Optional["ConfigurationModel"]: def configuration(self) -> Optional["PrinterConfigurationModel"]:
return self._configuration return self._configuration
def updateConfiguration(self, configuration: Optional["ConfigurationModel"]) -> None: def updateConfiguration(self, configuration: Optional["PrinterConfigurationModel"]) -> None:
if self._configuration != configuration: if self._configuration != configuration:
self._configuration = configuration self._configuration = configuration
self.configurationChanged.emit() self.configurationChanged.emit()
@ -142,13 +141,13 @@ class PrintJobOutputModel(QObject):
@pyqtProperty(bool, notify=stateChanged) @pyqtProperty(bool, notify=stateChanged)
def isActive(self) -> bool: def isActive(self) -> bool:
inactiveStates = [ inactive_states = [
"pausing", "pausing",
"paused", "paused",
"resuming", "resuming",
"wait_cleanup" "wait_cleanup"
] ]
if self.state in inactiveStates and self.timeRemaining > 0: if self.state in inactive_states and self.timeRemaining > 0:
return False return False
return True return True

View file

@ -6,10 +6,10 @@ from typing import List
MYPY = False MYPY = False
if MYPY: if MYPY:
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel
class ConfigurationModel(QObject): class PrinterConfigurationModel(QObject):
configurationChanged = pyqtSignal() configurationChanged = pyqtSignal()
@ -19,14 +19,14 @@ class ConfigurationModel(QObject):
self._extruder_configurations = [] # type: List[ExtruderConfigurationModel] self._extruder_configurations = [] # type: List[ExtruderConfigurationModel]
self._buildplate_configuration = "" self._buildplate_configuration = ""
def setPrinterType(self, printer_type): def setPrinterType(self, printer_type: str) -> None:
self._printer_type = printer_type self._printer_type = printer_type
@pyqtProperty(str, fset = setPrinterType, notify = configurationChanged) @pyqtProperty(str, fset = setPrinterType, notify = configurationChanged)
def printerType(self) -> str: def printerType(self) -> str:
return self._printer_type return self._printer_type
def setExtruderConfigurations(self, extruder_configurations: List["ExtruderConfigurationModel"]): def setExtruderConfigurations(self, extruder_configurations: List["ExtruderConfigurationModel"]) -> None:
if self._extruder_configurations != extruder_configurations: if self._extruder_configurations != extruder_configurations:
self._extruder_configurations = extruder_configurations self._extruder_configurations = extruder_configurations
@ -40,7 +40,7 @@ class ConfigurationModel(QObject):
return self._extruder_configurations return self._extruder_configurations
def setBuildplateConfiguration(self, buildplate_configuration: str) -> None: def setBuildplateConfiguration(self, buildplate_configuration: str) -> None:
if self._buildplate_configuration != buildplate_configuration: if self._buildplate_configuration != buildplate_configuration:
self._buildplate_configuration = buildplate_configuration self._buildplate_configuration = buildplate_configuration
self.configurationChanged.emit() self.configurationChanged.emit()
@ -86,4 +86,4 @@ class ConfigurationModel(QObject):
if first_extruder: if first_extruder:
extruder_hash &= hash(first_extruder) extruder_hash &= hash(first_extruder)
return hash(self._printer_type) ^ extruder_hash ^ hash(self._buildplate_configuration) return hash(self._printer_type) ^ extruder_hash ^ hash(self._buildplate_configuration)

View file

@ -4,12 +4,12 @@
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot, QUrl from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot, QUrl
from typing import List, Dict, Optional from typing import List, Dict, Optional
from UM.Math.Vector import Vector from UM.Math.Vector import Vector
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel
from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel from cura.UI.ExtruderOutputModel import ExtruderOutputModel
MYPY = False MYPY = False
if MYPY: if MYPY:
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
@ -37,7 +37,7 @@ class PrinterOutputModel(QObject):
self._controller = output_controller self._controller = output_controller
self._controller.canUpdateFirmwareChanged.connect(self._onControllerCanUpdateFirmwareChanged) self._controller.canUpdateFirmwareChanged.connect(self._onControllerCanUpdateFirmwareChanged)
self._extruders = [ExtruderOutputModel(printer = self, position = i) for i in range(number_of_extruders)] self._extruders = [ExtruderOutputModel(printer = self, position = i) for i in range(number_of_extruders)]
self._printer_configuration = ConfigurationModel() # Indicates the current configuration setup in this printer self._printer_configuration = PrinterConfigurationModel() # Indicates the current configuration setup in this printer
self._head_position = Vector(0, 0, 0) self._head_position = Vector(0, 0, 0)
self._active_print_job = None # type: Optional[PrintJobOutputModel] self._active_print_job = None # type: Optional[PrintJobOutputModel]
self._firmware_version = firmware_version self._firmware_version = firmware_version
@ -291,7 +291,7 @@ class PrinterOutputModel(QObject):
# Returns the configuration (material, variant and buildplate) of the current printer # Returns the configuration (material, variant and buildplate) of the current printer
@pyqtProperty(QObject, notify = configurationChanged) @pyqtProperty(QObject, notify = configurationChanged)
def printerConfiguration(self) -> Optional[ConfigurationModel]: def printerConfiguration(self) -> Optional[PrinterConfigurationModel]:
if self._printer_configuration.isValid(): if self._printer_configuration.isValid():
return self._printer_configuration return self._printer_configuration
return None return None

View file

@ -10,7 +10,6 @@ from UM.Application import Application
from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from UM.Settings.SettingFunction import SettingFunction from UM.Settings.SettingFunction import SettingFunction
from UM.Qt.ListModel import ListModel from UM.Qt.ListModel import ListModel

View file

@ -1,7 +1,7 @@
# Copyright (c) 2019 Ultimaker B.V. # Copyright (c) 2019 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.
import os import os
from typing import TYPE_CHECKING, Optional from typing import TYPE_CHECKING, Optional, List, Dict, Any
from PyQt5.QtCore import QUrl, Qt from PyQt5.QtCore import QUrl, Qt
@ -25,56 +25,44 @@ class WelcomePagesModel(ListModel):
self.addRoleName(self.PageUrlRole, "page_url") self.addRoleName(self.PageUrlRole, "page_url")
self.addRoleName(self.NextPageIdRole, "next_page_id") self.addRoleName(self.NextPageIdRole, "next_page_id")
self._pages = [] self._pages = [] # type: List[Dict[str, Any]]
# Convenience function to get QUrl path to pages that's located in "resources/qml/WelcomePages".
def _getBuiltinWelcomePagePath(self, page_filename: str) -> "QUrl":
from cura.CuraApplication import CuraApplication
return QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles,
os.path.join("WelcomePages", page_filename)))
def initialize(self) -> None: def initialize(self) -> None:
from cura.CuraApplication import CuraApplication
# Add default welcome pages # Add default welcome pages
self._pages.append({"id": "welcome", self._pages.append({"id": "welcome",
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "page_url": self._getBuiltinWelcomePagePath("WelcomeContent.qml"),
os.path.join("WelcomePages",
"WelcomeContent.qml"))),
}) })
self._pages.append({"id": "user_agreement", self._pages.append({"id": "user_agreement",
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "page_url": self._getBuiltinWelcomePagePath("UserAgreementContent.qml"),
os.path.join("WelcomePages",
"UserAgreementContent.qml"))),
}) })
self._pages.append({"id": "whats_new", self._pages.append({"id": "whats_new",
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "page_url": self._getBuiltinWelcomePagePath("WhatsNewContent.qml"),
os.path.join("WelcomePages",
"WhatsNewContent.qml"))),
}) })
self._pages.append({"id": "data_collections", self._pages.append({"id": "data_collections",
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "page_url": self._getBuiltinWelcomePagePath("DataCollectionsContent.qml"),
os.path.join("WelcomePages",
"DataCollectionsContent.qml"))),
}) })
self._pages.append({"id": "add_printer_by_selection", self._pages.append({"id": "add_printer_by_selection",
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "page_url": self._getBuiltinWelcomePagePath("AddPrinterBySelectionContent.qml"),
os.path.join("WelcomePages",
"AddPrinterBySelectionContent.qml"))),
}) })
self._pages.append({"id": "add_printer_by_ip", self._pages.append({"id": "add_printer_by_ip",
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"),
os.path.join("WelcomePages",
"AddPrinterByIpContent.qml"))),
}) })
self._pages.append({"id": "machine_actions", self._pages.append({"id": "machine_actions",
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"),
os.path.join("WelcomePages",
"FirstStartMachineActionsContent.qml"))),
}) })
self._pages.append({"id": "cloud", self._pages.append({"id": "cloud",
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"),
os.path.join("WelcomePages",
"CloudContent.qml"))),
}) })
self.setItems(self._pages) self.setItems(self._pages)
def addPage(self): def addPage(self) -> None:
pass pass

View file

@ -10,20 +10,17 @@ from time import time
from typing import Any, cast, Dict, List, Optional, Set, TYPE_CHECKING from typing import Any, cast, Dict, List, Optional, Set, TYPE_CHECKING
from UM.Backend.Backend import Backend, BackendState from UM.Backend.Backend import Backend, BackendState
from UM.Scene.Camera import Camera
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from UM.Signal import Signal from UM.Signal import Signal
from UM.Logger import Logger from UM.Logger import Logger
from UM.Message import Message from UM.Message import Message
from UM.PluginRegistry import PluginRegistry from UM.PluginRegistry import PluginRegistry
from UM.Resources import Resources
from UM.Platform import Platform from UM.Platform import Platform
from UM.Qt.Duration import DurationFormat from UM.Qt.Duration import DurationFormat
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Settings.Interfaces import DefinitionContainerInterface from UM.Settings.Interfaces import DefinitionContainerInterface
from UM.Settings.SettingInstance import SettingInstance #For typing. from UM.Settings.SettingInstance import SettingInstance #For typing.
from UM.Tool import Tool #For typing. from UM.Tool import Tool #For typing.
from UM.Mesh.MeshData import MeshData #For typing.
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderManager import ExtruderManager
@ -33,7 +30,7 @@ from .StartSliceJob import StartSliceJob, StartJobResult
import Arcus import Arcus
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel from cura.UI.MachineModels.MultiBuildPlateModel import MultiBuildPlateModel
from cura.Machines.MachineErrorChecker import MachineErrorChecker from cura.Machines.MachineErrorChecker import MachineErrorChecker
from UM.Scene.Scene import Scene from UM.Scene.Scene import Scene
from UM.Settings.ContainerStack import ContainerStack from UM.Settings.ContainerStack import ContainerStack

View file

@ -24,7 +24,7 @@ from cura import LayerPolygon
import numpy import numpy
from time import time from time import time
from cura.Settings.ExtrudersModel import ExtrudersModel from cura.UI.ExtrudersModel import ExtrudersModel
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")

View file

@ -2,9 +2,7 @@
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
import os.path import os.path
from UM.Application import Application from UM.Application import Application
from UM.PluginRegistry import PluginRegistry from cura.UI.CuraStage import CuraStage
from UM.Resources import Resources
from cura.Stages.CuraStage import CuraStage
## Stage for monitoring a 3D printing while it's printing. ## Stage for monitoring a 3D printing while it's printing.

View file

@ -4,7 +4,7 @@
import os.path import os.path
from UM.Application import Application from UM.Application import Application
from UM.PluginRegistry import PluginRegistry from UM.PluginRegistry import PluginRegistry
from cura.Stages.CuraStage import CuraStage from cura.UI.CuraStage import CuraStage
## Stage for preparing model (slicing). ## Stage for preparing model (slicing).
class PrepareStage(CuraStage): class PrepareStage(CuraStage):

View file

@ -4,7 +4,7 @@
import os.path import os.path
from UM.Qt.QtApplication import QtApplication from UM.Qt.QtApplication import QtApplication
from cura.Stages.CuraStage import CuraStage from cura.UI.CuraStage import CuraStage
from typing import TYPE_CHECKING, Optional from typing import TYPE_CHECKING, Optional

View file

@ -18,8 +18,8 @@ from UM.Scene.SceneNode import SceneNode
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutputDevice import ConnectionType from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from .CloudOutputController import CloudOutputController from .CloudOutputController import CloudOutputController
from ..MeshFormatHandler import MeshFormatHandler from ..MeshFormatHandler import MeshFormatHandler

View file

@ -2,8 +2,8 @@
# 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 Union, Dict, Optional, Any from typing import Union, Dict, Optional, Any
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel
from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel from cura.UI.ExtruderOutputModel import ExtruderOutputModel
from .CloudClusterPrinterConfigurationMaterial import CloudClusterPrinterConfigurationMaterial from .CloudClusterPrinterConfigurationMaterial import CloudClusterPrinterConfigurationMaterial
from .BaseCloudModel import BaseCloudModel from .BaseCloudModel import BaseCloudModel

View file

@ -2,7 +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 typing import List, Optional, Union, Dict, Any from typing import List, Optional, Union, Dict, Any
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel
from ...UM3PrintJobOutputModel import UM3PrintJobOutputModel from ...UM3PrintJobOutputModel import UM3PrintJobOutputModel
from ...ConfigurationChangeModel import ConfigurationChangeModel from ...ConfigurationChangeModel import ConfigurationChangeModel
from ..CloudOutputController import CloudOutputController from ..CloudOutputController import CloudOutputController
@ -95,9 +95,9 @@ class CloudClusterPrintJobStatus(BaseCloudModel):
return model return model
## Creates a new configuration model ## Creates a new configuration model
def _createConfigurationModel(self) -> ConfigurationModel: def _createConfigurationModel(self) -> PrinterConfigurationModel:
extruders = [extruder.createConfigurationModel() for extruder in self.configuration or ()] extruders = [extruder.createConfigurationModel() for extruder in self.configuration or ()]
configuration = ConfigurationModel() configuration = PrinterConfigurationModel()
configuration.setExtruderConfigurations(extruders) configuration.setExtruderConfigurations(extruders)
return configuration return configuration

View file

@ -2,7 +2,7 @@ from typing import Optional
from UM.Logger import Logger from UM.Logger import Logger
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel
from .BaseCloudModel import BaseCloudModel from .BaseCloudModel import BaseCloudModel

View file

@ -3,7 +3,7 @@
from typing import List, Union, Dict, Optional, Any from typing import List, Union, Dict, Optional, Any
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from .CloudClusterBuildPlate import CloudClusterBuildPlate from .CloudClusterBuildPlate import CloudClusterBuildPlate
from .CloudClusterPrintCoreConfiguration import CloudClusterPrintCoreConfiguration from .CloudClusterPrintCoreConfiguration import CloudClusterPrintCoreConfiguration
from .BaseCloudModel import BaseCloudModel from .BaseCloudModel import BaseCloudModel

View file

@ -19,12 +19,12 @@ from UM.Scene.SceneNode import SceneNode # For typing.
from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.ContainerRegistry import ContainerRegistry
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel
from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel
from cura.PrinterOutputDevice import ConnectionType from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from .Cloud.Utils import formatTimeCompleted, formatDateCompleted from .Cloud.Utils import formatTimeCompleted, formatDateCompleted
from .ClusterUM3PrinterOutputController import ClusterUM3PrinterOutputController from .ClusterUM3PrinterOutputController import ClusterUM3PrinterOutputController
@ -522,7 +522,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
print_job = UM3PrintJobOutputModel(output_controller=ClusterUM3PrinterOutputController(self), print_job = UM3PrintJobOutputModel(output_controller=ClusterUM3PrinterOutputController(self),
key=data["uuid"], name= data["name"]) key=data["uuid"], name= data["name"])
configuration = ConfigurationModel() configuration = PrinterConfigurationModel()
extruders = [ExtruderConfigurationModel(position = idx) for idx in range(0, self._number_of_extruders)] extruders = [ExtruderConfigurationModel(position = idx) for idx in range(0, self._number_of_extruders)]
for index in range(0, self._number_of_extruders): for index in range(0, self._number_of_extruders):
try: try:

View file

@ -5,7 +5,7 @@ from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
MYPY = False MYPY = False
if MYPY: if MYPY:
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
class ClusterUM3PrinterOutputController(PrinterOutputController): class ClusterUM3PrinterOutputController(PrinterOutputController):
def __init__(self, output_device): def __init__(self, output_device):

View file

@ -18,7 +18,7 @@ from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
from .UM3OutputDevicePlugin import UM3OutputDevicePlugin from .UM3OutputDevicePlugin import UM3OutputDevicePlugin
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")

View file

@ -2,10 +2,10 @@ from typing import List, Optional
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel from cura.UI.MaterialOutputModel import MaterialOutputModel
from cura.PrinterOutputDevice import ConnectionType from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from cura.Settings.ContainerManager import ContainerManager from cura.Settings.ContainerManager import ContainerManager
from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderManager import ExtruderManager

View file

@ -7,8 +7,8 @@ from UM.Version import Version
MYPY = False MYPY = False
if MYPY: if MYPY:
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
class LegacyUM3PrinterOutputController(PrinterOutputController): class LegacyUM3PrinterOutputController(PrinterOutputController):

View file

@ -5,16 +5,16 @@ from queue import Queue
from threading import Event, Thread from threading import Event, Thread
from time import time from time import time
import os import os
from typing import Optional, TYPE_CHECKING
from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange, ServiceInfo from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange, ServiceInfo
from PyQt5.QtNetwork import QNetworkRequest, QNetworkAccessManager from PyQt5.QtNetwork import QNetworkRequest, QNetworkAccessManager
from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QObject from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QDesktopServices from PyQt5.QtGui import QDesktopServices
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.PrinterOutputDevice import ConnectionType from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from cura.Settings.GlobalStack import GlobalStack # typing
from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
@ -28,10 +28,13 @@ from UM.Version import Version
from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice
from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager
from typing import Optional if TYPE_CHECKING:
from cura.Settings.GlobalStack import GlobalStack
from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
i18n_catalog = i18nCatalog("cura") i18n_catalog = i18nCatalog("cura")
## This plugin handles the connection detection & creation of output device objects for the UM3 printer. ## This plugin handles the connection detection & creation of output device objects for the UM3 printer.
# Zero-Conf is used to detect printers, which are saved in a dict. # Zero-Conf is used to detect printers, which are saved in a dict.
# If we discover a printer that has the same key as the active machine instance a connection is made. # If we discover a printer that has the same key as the active machine instance a connection is made.
@ -448,7 +451,7 @@ 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
@ -536,7 +539,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
return return
def _onDontAskMeAgain(self, checked: bool) -> None: def _onDontAskMeAgain(self, checked: bool) -> None:
active_machine = self._application.getMachineManager().activeMachine # type: Optional["GlobalStack"] active_machine = self._application.getMachineManager().activeMachine # type: Optional[GlobalStack]
if active_machine: if active_machine:
active_machine.setMetaDataEntry("do_not_show_cloud_message", checked) active_machine.setMetaDataEntry("do_not_show_cloud_message", checked)
if checked: if checked:

View file

@ -5,7 +5,7 @@ from typing import List
from PyQt5.QtCore import pyqtProperty, pyqtSignal from PyQt5.QtCore import pyqtProperty, pyqtSignal
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
from .ConfigurationChangeModel import ConfigurationChangeModel from .ConfigurationChangeModel import ConfigurationChangeModel

View file

@ -6,7 +6,7 @@ from unittest.mock import patch, MagicMock
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from cura.UltimakerCloudAuthentication import CuraCloudAPIRoot from cura.UltimakerCloudAuthentication import CuraCloudAPIRoot
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from ...src.Cloud import CloudApiClient from ...src.Cloud import CloudApiClient
from ...src.Cloud.CloudOutputDevice import CloudOutputDevice from ...src.Cloud.CloudOutputDevice import CloudOutputDevice
from ...src.Cloud.Models.CloudClusterResponse import CloudClusterResponse from ...src.Cloud.Models.CloudClusterResponse import CloudClusterResponse

View file

@ -13,7 +13,7 @@ from time import sleep
MYPY = False MYPY = False
if MYPY: if MYPY:
from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
class AvrFirmwareUpdater(FirmwareUpdater): class AvrFirmwareUpdater(FirmwareUpdater):

View file

@ -7,9 +7,9 @@ from UM.i18n import i18nCatalog
from UM.Qt.Duration import DurationFormat from UM.Qt.Duration import DurationFormat
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionState, ConnectionType
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.GenericOutputController import GenericOutputController from cura.PrinterOutput.GenericOutputController import GenericOutputController
from .AutoDetectBaudJob import AutoDetectBaudJob from .AutoDetectBaudJob import AutoDetectBaudJob

View file

@ -5,15 +5,13 @@ import threading
import time import time
import serial.tools.list_ports import serial.tools.list_ports
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal from PyQt5.QtCore import QObject, pyqtSignal
from UM.Logger import Logger
from UM.Signal import Signal, signalemitter from UM.Signal import Signal, signalemitter
from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from cura.PrinterOutputDevice import ConnectionState from cura.PrinterOutput.PrinterOutputDevice import ConnectionState
from cura.CuraApplication import CuraApplication
from . import USBPrinterOutputDevice from . import USBPrinterOutputDevice

View file

@ -4,7 +4,7 @@
from typing import List from typing import List
from cura.MachineAction import MachineAction from cura.MachineAction import MachineAction
from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
from UM.FlameProfiler import pyqtSlot from UM.FlameProfiler import pyqtSlot

View file

@ -3,7 +3,7 @@ from typing import Tuple, List, Set, Dict
import io import io
from UM.VersionUpgrade import VersionUpgrade from UM.VersionUpgrade import VersionUpgrade
from cura.PrinterOutputDevice import ConnectionType from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
deleted_settings = {"bridge_wall_max_overhang"} # type: Set[str] deleted_settings = {"bridge_wall_max_overhang"} # type: Set[str]
renamed_configurations = {"connect_group_name": "group_name"} # type: Dict[str, str] renamed_configurations = {"connect_group_name": "group_name"} # type: Dict[str, str]

View file

@ -69,18 +69,9 @@ Item
property alias browsePackages: browsePackagesAction property alias browsePackages: browsePackagesAction
property alias showOnBoarding: showOnBoarding
UM.I18nCatalog{id: catalog; name: "cura"} UM.I18nCatalog{id: catalog; name: "cura"}
Controls2.Action
{
id: showOnBoarding
text: catalog.i18nc("@action:inmenu", "Show On boarding")
shortcut: "Ctrl+Alt+D"
}
Action Action
{ {
id: showTroubleShootingAction id: showTroubleShootingAction

View file

@ -58,16 +58,6 @@ UM.MainWindow
z: stageMenu.z + 1 z: stageMenu.z + 1
} }
Connections
{
target: Cura.Actions.showOnBoarding
onTriggered:
{
welcomeDialog.currentStep = 0
welcomeDialog.show()
}
}
Component.onCompleted: Component.onCompleted:
{ {
CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size")) CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))

View file

@ -16,7 +16,7 @@ UM.ManagementPage
title: catalog.i18nc("@title:tab", "Printers"); title: catalog.i18nc("@title:tab", "Printers");
model: Cura.GlobalStacksModel { } model: Cura.GlobalStacksModel { }
sectionRole: "sectionName" sectionRole: "discoverySource"
activeId: Cura.MachineManager.activeMachineId activeId: Cura.MachineManager.activeMachineId
activeIndex: activeMachineIndex() activeIndex: activeMachineIndex()

View file

@ -23,7 +23,7 @@ ScrollView
property string preferredCategory: "Ultimaker" property string preferredCategory: "Ultimaker"
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AlwaysOn ScrollBar.vertical.policy: ScrollBar.AsNeeded
property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll.
height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height
@ -100,7 +100,6 @@ ScrollView
{ {
id: arrow id: arrow
anchors.left: parent.left anchors.left: parent.left
//anchors.verticalCenter: label.verticalCenter
width: UM.Theme.getSize("standard_arrow").width width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width sourceSize.width: width
@ -162,7 +161,8 @@ ScrollView
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover")
Rectangle { Rectangle
{
width: parent.width / 2 width: parent.width / 2
height: width height: width
anchors.centerIn: parent anchors.centerIn: parent

View file

@ -56,7 +56,7 @@ Item
anchors.right: parent.right anchors.right: parent.right
ScrollBar.horizontal.policy: ScrollBar.AsNeeded ScrollBar.horizontal.policy: ScrollBar.AsNeeded
ScrollBar.vertical.policy: ScrollBar.AlwaysOn ScrollBar.vertical.policy: ScrollBar.AsNeeded
property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll.
height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height

View file

@ -4,7 +4,7 @@ from unittest.mock import MagicMock
from PyQt5.QtNetwork import QNetworkAccessManager from PyQt5.QtNetwork import QNetworkAccessManager
from PyQt5.QtCore import QUrl from PyQt5.QtCore import QUrl
from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState
from cura.PrinterOutputDevice import ConnectionState from cura.PrinterOutput.PrinterOutputDevice import ConnectionState
def test_properties(): def test_properties():

View file

@ -1,7 +1,7 @@
from unittest.mock import MagicMock from unittest.mock import MagicMock
import pytest import pytest
from cura.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
test_validate_data_get_set = [ test_validate_data_get_set = [
{"attribute": "connectionText", "value": "yay"}, {"attribute": "connectionText", "value": "yay"},
@ -34,4 +34,4 @@ def test_getAndSet(data):
# Attempt to set the value again # Attempt to set the value again
getattr(model, "set" + attribute)(data["value"]) getattr(model, "set" + attribute)(data["value"])
# The signal should not fire again # The signal should not fire again
assert signal.emit.call_count == 1 assert signal.emit.call_count == 1

View file

@ -5,7 +5,7 @@ import os.path
from UM.Preferences import Preferences from UM.Preferences import Preferences
from UM.Resources import Resources from UM.Resources import Resources
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.UI.MachineModels.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel
from cura.Settings.SettingVisibilityPreset import SettingVisibilityPreset from cura.Settings.SettingVisibilityPreset import SettingVisibilityPreset
setting_visibility_preset_test_settings = {"test", "zomg", "derp", "yay", "whoo"} setting_visibility_preset_test_settings = {"test", "zomg", "derp", "yay", "whoo"}

View file

@ -4,7 +4,7 @@
import pytest import pytest
from cura.MachineAction import MachineAction from cura.MachineAction import MachineAction
from cura.MachineActionManager import NotUniqueMachineActionError, UnknownMachineActionError from cura.UI.MachineActionManager import NotUniqueMachineActionError, UnknownMachineActionError
from cura.Settings.GlobalStack import GlobalStack from cura.Settings.GlobalStack import GlobalStack

View file

@ -1,7 +1,7 @@
import functools import functools
from UM.Qt.Duration import Duration from UM.Qt.Duration import Duration
from cura import PrintInformation from cura.UI import PrintInformation
from cura.Settings.MachineManager import MachineManager from cura.Settings.MachineManager import MachineManager
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch

View file

@ -2,16 +2,16 @@ from unittest.mock import MagicMock
import pytest import pytest
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
test_validate_data_get_set = [ test_validate_data_get_set = [
{"attribute": "compatibleMachineFamilies", "value": ["yay"]}, {"attribute": "compatibleMachineFamilies", "value": ["yay"]},
] ]
test_validate_data_get_update = [ test_validate_data_get_update = [
{"attribute": "configuration", "value": ConfigurationModel()}, {"attribute": "configuration", "value": PrinterConfigurationModel()},
{"attribute": "owner", "value": "WHOO"}, {"attribute": "owner", "value": "WHOO"},
{"attribute": "assignedPrinter", "value": PrinterOutputModel(MagicMock())}, {"attribute": "assignedPrinter", "value": PrinterOutputModel(MagicMock())},
{"attribute": "key", "value": "YAY"}, {"attribute": "key", "value": "YAY"},

View file

@ -4,8 +4,8 @@ from unittest.mock import MagicMock
import pytest import pytest
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel from cura.UI.PrinterConfigurationModel import PrinterConfigurationModel
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel from cura.UI.ExtruderConfigurationModel import ExtruderConfigurationModel
test_validate_data_get_set = [ test_validate_data_get_set = [
{"attribute": "extruderConfigurations", "value": [ExtruderConfigurationModel()]}, {"attribute": "extruderConfigurations", "value": [ExtruderConfigurationModel()]},
@ -16,7 +16,7 @@ test_validate_data_get_set = [
@pytest.mark.parametrize("data", test_validate_data_get_set) @pytest.mark.parametrize("data", test_validate_data_get_set)
def test_getAndSet(data): def test_getAndSet(data):
model = ConfigurationModel() model = PrinterConfigurationModel()
# Convert the first letter into a capital # Convert the first letter into a capital
attribute = list(data["attribute"]) attribute = list(data["attribute"])

View file

@ -4,8 +4,8 @@ from unittest.mock import MagicMock
import pytest import pytest
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.UI.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.UI.PrinterOutputModel import PrinterOutputModel
test_validate_data_get_set = [ test_validate_data_get_set = [
{"attribute": "name", "value": "YAY"}, {"attribute": "name", "value": "YAY"},

View file

@ -6,11 +6,8 @@
import unittest.mock import unittest.mock
import pytest import pytest
import Arcus #Prevents error: "PyCapsule_GetPointer called with incorrect name" with conflicting SIP configurations between Arcus and PyQt: Import Arcus and Savitar first!
import Savitar
from UM.Qt.QtApplication import QtApplication #QtApplication import is required, even though it isn't used.
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.MachineActionManager import MachineActionManager from cura.UI.MachineActionManager import MachineActionManager
# Create a CuraApplication object that will be shared among all tests. It needs to be initialized. # Create a CuraApplication object that will be shared among all tests. It needs to be initialized.