mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-19 03:37:29 +08:00
Merge branch '5.9' into 5.9
This commit is contained in:
commit
74e027c8e1
@ -196,7 +196,7 @@ class DigitalFactoryApiClient:
|
|||||||
url = "{}/projects/{}/files".format(self.CURA_API_ROOT, library_project_id)
|
url = "{}/projects/{}/files".format(self.CURA_API_ROOT, library_project_id)
|
||||||
self._http.get(url,
|
self._http.get(url,
|
||||||
scope = self._scope,
|
scope = self._scope,
|
||||||
callback = self._parseCallback(on_finished, DigitalFactoryFileResponse, failed),
|
callback = self._parseCallback(on_finished, DigitalFactoryFileResponse, failed, default_values = {'username': ''}),
|
||||||
error_callback = failed,
|
error_callback = failed,
|
||||||
timeout = self.DEFAULT_REQUEST_TIMEOUT)
|
timeout = self.DEFAULT_REQUEST_TIMEOUT)
|
||||||
|
|
||||||
@ -205,7 +205,8 @@ class DigitalFactoryApiClient:
|
|||||||
Callable[[List[CloudApiClientModel]], Any]],
|
Callable[[List[CloudApiClientModel]], Any]],
|
||||||
model: Type[CloudApiClientModel],
|
model: Type[CloudApiClientModel],
|
||||||
on_error: Optional[Callable] = None,
|
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.
|
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:
|
if status_code >= 300 and on_error is not None:
|
||||||
on_error()
|
on_error()
|
||||||
else:
|
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)
|
self._anti_gc_callbacks.append(parse)
|
||||||
return parse
|
return parse
|
||||||
@ -262,7 +263,8 @@ class DigitalFactoryApiClient:
|
|||||||
on_finished: Union[Callable[[CloudApiClientModel], Any],
|
on_finished: Union[Callable[[CloudApiClientModel], Any],
|
||||||
Callable[[List[CloudApiClientModel]], Any]],
|
Callable[[List[CloudApiClientModel]], Any]],
|
||||||
model_class: Type[CloudApiClientModel],
|
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.
|
"""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.
|
: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:
|
if "links" in response and pagination_manager:
|
||||||
pagination_manager.setLinks(response["links"])
|
pagination_manager.setLinks(response["links"])
|
||||||
if isinstance(data, list):
|
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 = cast(Callable[[List[CloudApiClientModel]], Any], on_finished)
|
||||||
on_finished_list(results)
|
on_finished_list(results)
|
||||||
else:
|
else:
|
||||||
|
@ -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_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_use_extruder_offset_to_offset_coords": { "default_value": true },
|
||||||
"machine_width": { "default_value": 205 },
|
"machine_width": { "default_value": 205 },
|
||||||
|
"material_print_temp_wait": { "value": true },
|
||||||
"speed_slowdown_layers": { "value": 2 }
|
"speed_slowdown_layers": { "value": 2 }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user