Remove absolute plugin imports, some fixes

This commit is contained in:
ChrisTerBeke 2019-07-29 16:11:01 +02:00
parent 7d69b1727d
commit ddd282eef3
16 changed files with 67 additions and 62 deletions

View file

@ -3,6 +3,10 @@ from datetime import datetime, timezone
from typing import TypeVar, Dict, List, Any, Type, Union
# Type variable used in the parse methods below, which should be a subclass of BaseModel.
T = TypeVar("T", bound="BaseModel")
class BaseModel:
def __init__(self, **kwargs) -> None:
@ -29,9 +33,6 @@ class BaseModel:
def toDict(self) -> Dict[str, Any]:
return self.__dict__
# Type variable used in the parse methods below, which should be a subclass of BaseModel.
T = TypeVar("T", bound="BaseModel")
## Parses a single model.
# \param model_class: The model class.
# \param values: The value of the model, which is usually a dictionary, but may also be already parsed.

View file

@ -1,5 +1,5 @@
## Class representing a material that was fetched from the cluster API.
from plugins.UM3NetworkPrinting.src.Models.BaseModel import BaseModel
from .BaseModel import BaseModel
class ClusterMaterial(BaseModel):

View file

@ -1,8 +1,8 @@
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import pyqtProperty, QObject
BLOCKING_CHANGE_TYPES = [
"material_insert", "buildplate_change"
]
@ -11,8 +11,7 @@ BLOCKING_CHANGE_TYPES = [
class ConfigurationChangeModel(QObject):
def __init__(self, type_of_change: str, index: int, target_name: str, origin_name: str) -> None:
super().__init__()
self._type_of_change = type_of_change
# enum = ["material", "print_core_change"]
self._type_of_change = type_of_change # enum = ["material", "print_core_change"]
self._can_override = self._type_of_change not in BLOCKING_CHANGE_TYPES
self._index = index
self._target_name = target_name

View file

@ -1,5 +1,5 @@
## Class representing a local material that was fetched from the container registry.
from plugins.UM3NetworkPrinting.src.Models.BaseModel import BaseModel
from .BaseModel import BaseModel
class LocalMaterial(BaseModel):

View file

@ -6,13 +6,14 @@ from PyQt5.QtCore import pyqtProperty, pyqtSignal
from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
from plugins.UM3NetworkPrinting.src.Models.ConfigurationChangeModel import ConfigurationChangeModel
from .ConfigurationChangeModel import ConfigurationChangeModel
class UM3PrintJobOutputModel(PrintJobOutputModel):
configurationChangesChanged = 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__(output_controller, key, name, parent)
self._configuration_changes = [] # type: List[ConfigurationChangeModel]