metadata: add PrusaSlicer aliases

The varous forks of PrusaSlicer are processed identically
outside of their identifier, so there is no need to
implement new classes for each fork.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-09-28 06:14:24 -04:00
parent 81b0c0a581
commit fdfab66951
1 changed files with 15 additions and 18 deletions

View File

@ -177,12 +177,18 @@ class UnknownSlicer(BaseSlicer):
class PrusaSlicer(BaseSlicer):
def check_identity(self, data: str) -> Optional[Dict[str, str]]:
match = re.search(r"PrusaSlicer\s(.*)\son", data)
if match:
return {
'slicer': "PrusaSlicer",
'slicer_version': match.group(1)
}
aliases = {
'PrusaSlicer': r"PrusaSlicer\s(.*)\son",
'SuperSlicer': r"SuperSlicer\s(.*)\son",
'SliCR-3D': r"SliCR-3D\s(.*)\son"
}
for name, expr in aliases.items():
match = re.search(expr, data)
if match:
return {
'slicer': name,
'slicer_version': match.group(1)
}
return None
def parse_first_layer_height(self) -> Optional[float]:
@ -329,16 +335,6 @@ class Slic3r(Slic3rPE):
def parse_estimated_time(self) -> Optional[float]:
return None
class SuperSlicer(PrusaSlicer):
def check_identity(self, data: str) -> Optional[Dict[str, str]]:
match = re.search(r"SuperSlicer\s(.*)\son", data)
if match:
return {
'slicer': "SuperSlicer",
'slicer_version': match.group(1)
}
return None
class Cura(PrusaSlicer):
def check_identity(self, data: str) -> Optional[Dict[str, str]]:
match = re.search(r"Cura_SteamEngine\s(.*)", data)
@ -637,8 +633,9 @@ class IceSL(BaseSlicer):
READ_SIZE = 512 * 1024
SUPPORTED_SLICERS: List[Type[BaseSlicer]] = [
PrusaSlicer, Slic3rPE, Slic3r, SuperSlicer,
Cura, Simplify3D, KISSlicer, IdeaMaker, IceSL]
PrusaSlicer, Slic3rPE, Slic3r, Cura, Simplify3D,
KISSlicer, IdeaMaker, IceSL
]
SUPPORTED_DATA = [
'layer_height', 'first_layer_height', 'object_height',
'filament_total', 'filament_weight_total', 'estimated_time',