mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Apply suggestion to remove unnecessary extra arguments
CURA-12093
This commit is contained in:
parent
101a637bbb
commit
d74e0487cd
@ -78,17 +78,12 @@ class GcodeStartEndFormatter:
|
|||||||
|
|
||||||
_instruction_regex = re.compile(r"{(?P<condition>if|else|elif|endif)?\s*(?P<expression>.*?)\s*(?:,\s*(?P<extruder_nr_expr>.*))?\s*}(?P<end_of_line>\n?)")
|
_instruction_regex = re.compile(r"{(?P<condition>if|else|elif|endif)?\s*(?P<expression>.*?)\s*(?:,\s*(?P<extruder_nr_expr>.*))?\s*}(?P<end_of_line>\n?)")
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self, all_extruder_settings: Dict[str, Dict[str, Any]], default_extruder_nr: int = -1) -> None:
|
||||||
all_extruder_settings: Dict[str, Dict[str, Any]],
|
|
||||||
default_extruder_nr: int = -1,
|
|
||||||
cura_application: CuraApplication = None,
|
|
||||||
extruder_manager: ExtruderManager = None
|
|
||||||
) -> None:
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._all_extruder_settings: Dict[str, Dict[str, Any]] = all_extruder_settings
|
self._all_extruder_settings: Dict[str, Dict[str, Any]] = all_extruder_settings
|
||||||
self._default_extruder_nr: int = default_extruder_nr
|
self._default_extruder_nr: int = default_extruder_nr
|
||||||
self._cura_application = cura_application if cura_application is not None else CuraApplication.getInstance()
|
self._cura_application = CuraApplication.getInstance()
|
||||||
self._extruder_manager = extruder_manager if extruder_manager is not None else ExtruderManager.getInstance()
|
self._extruder_manager = ExtruderManager.getInstance()
|
||||||
|
|
||||||
def format(self, text: str) -> str:
|
def format(self, text: str) -> str:
|
||||||
remaining_text: str = text
|
remaining_text: str = text
|
||||||
|
@ -216,5 +216,7 @@ def extruder_manager():
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def test_startEndGCode_replace(cura_application, extruder_manager, original_gcode, expected_gcode):
|
def test_startEndGCode_replace(cura_application, extruder_manager, original_gcode, expected_gcode):
|
||||||
formatter = GcodeStartEndFormatter(all_extruder_settings, -1, cura_application, extruder_manager)
|
formatter = GcodeStartEndFormatter(all_extruder_settings, -1)
|
||||||
|
formatter._cura_application = cura_application
|
||||||
|
formatter._extruder_manager = extruder_manager
|
||||||
assert formatter.format(original_gcode) == expected_gcode
|
assert formatter.format(original_gcode) == expected_gcode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user