diff --git a/plugins/DigitalLibrary/src/DigitalFactoryApiClient.py b/plugins/DigitalLibrary/src/DigitalFactoryApiClient.py index c0ce594ecf..30b807753a 100644 --- a/plugins/DigitalLibrary/src/DigitalFactoryApiClient.py +++ b/plugins/DigitalLibrary/src/DigitalFactoryApiClient.py @@ -196,7 +196,7 @@ class DigitalFactoryApiClient: url = "{}/projects/{}/files".format(self.CURA_API_ROOT, library_project_id) self._http.get(url, scope = self._scope, - callback = self._parseCallback(on_finished, DigitalFactoryFileResponse, failed), + callback = self._parseCallback(on_finished, DigitalFactoryFileResponse, failed, default_values = {'username': ''}), error_callback = failed, timeout = self.DEFAULT_REQUEST_TIMEOUT) @@ -205,7 +205,8 @@ class DigitalFactoryApiClient: Callable[[List[CloudApiClientModel]], Any]], model: Type[CloudApiClientModel], on_error: Optional[Callable] = None, - pagination_manager: Optional[PaginationManager] = None) -> Callable[[QNetworkReply], None]: + pagination_manager: Optional[PaginationManager] = None, + default_values: Dict[str, str] = None) -> Callable[[QNetworkReply], None]: """ Creates a callback function so that it includes the parsing of the response into the correct model. @@ -234,7 +235,7 @@ class DigitalFactoryApiClient: if status_code >= 300 and on_error is not None: on_error() else: - self._parseModels(response, on_finished, model, pagination_manager = pagination_manager) + self._parseModels(response, on_finished, model, pagination_manager = pagination_manager, default_values = default_values) self._anti_gc_callbacks.append(parse) return parse @@ -262,7 +263,8 @@ class DigitalFactoryApiClient: on_finished: Union[Callable[[CloudApiClientModel], Any], Callable[[List[CloudApiClientModel]], Any]], model_class: Type[CloudApiClientModel], - pagination_manager: Optional[PaginationManager] = None) -> None: + pagination_manager: Optional[PaginationManager] = None, + default_values: Dict[str, str] = None) -> None: """Parses the given models and calls the correct callback depending on the result. :param response: The response from the server, after being converted to a dict. @@ -279,7 +281,10 @@ class DigitalFactoryApiClient: if "links" in response and pagination_manager: pagination_manager.setLinks(response["links"]) if isinstance(data, list): - results = [model_class(**c) for c in data] # type: List[CloudApiClientModel] + results = [] # type: List[CloudApiClientModel] + for model_data in data: + complete_model_data = (default_values | model_data) if default_values is not None else model_data + results.append(model_class(**complete_model_data)) on_finished_list = cast(Callable[[List[CloudApiClientModel]], Any], on_finished) on_finished_list(results) else: diff --git a/resources/definitions/ultimaker_original.def.json b/resources/definitions/ultimaker_original.def.json index e7870129ed..826a612c6c 100644 --- a/resources/definitions/ultimaker_original.def.json +++ b/resources/definitions/ultimaker_original.def.json @@ -68,6 +68,7 @@ "machine_start_gcode": { "default_value": "G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E6 ;extrude 6 mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 Y50 F9000\n;Put printing message on LCD screen\nM117 Printing..." }, "machine_use_extruder_offset_to_offset_coords": { "default_value": true }, "machine_width": { "default_value": 205 }, + "material_print_temp_wait": { "value": true }, "speed_slowdown_layers": { "value": 2 } } } \ No newline at end of file