Compare commits

..

1 Commits

Author SHA1 Message Date
dw-0
024ab046b9 Merge 02bb1b34fd into d414be609a 2024-05-25 21:35:24 +02:00
3 changed files with 7 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ from utils.logger import Logger
class Moonraker(BaseInstance): class Moonraker(BaseInstance):
@classmethod @classmethod
def blacklist(cls) -> List[str]: def blacklist(cls) -> List[str]:
return ["None", "mcu", "obico"] return ["None", "mcu"]
def __init__(self, suffix: str = ""): def __init__(self, suffix: str = ""):
super().__init__(instance_type=self, suffix=suffix) super().__init__(instance_type=self, suffix=suffix)

View File

@@ -172,18 +172,14 @@ class InstanceManager:
] ]
instance_list = [ instance_list = [
self.instance_type(suffix=self._get_instance_suffix(name, service)) self.instance_type(suffix=self._get_instance_suffix(service))
for service in service_list for service in service_list
] ]
return sorted(instance_list, key=lambda x: self._sort_instance_list(x.suffix)) return sorted(instance_list, key=lambda x: self._sort_instance_list(x.suffix))
def _get_instance_suffix(self, name: str, file_path: Path) -> str: def _get_instance_suffix(self, file_path: Path) -> str:
# to get the suffix of the instance, we remove the name of the instance from return file_path.stem.split("-")[-1] if "-" in file_path.stem else ""
# the file name, if the remaining part an empty string we return it
# otherwise there is and hyphen left, and we return the part after the hyphen
suffix = file_path.stem[len(name) :]
return suffix[1:] if suffix else ""
def _sort_instance_list(self, s: Union[int, str, None]): def _sort_instance_list(self, s: Union[int, str, None]):
if s is None: if s is None:

View File

@@ -312,10 +312,9 @@ class ObicoExtension(BaseExtension):
end="", end="",
) )
if not get_confirm("Do you want to link the printers now?"): if not get_confirm("Do you want to link the printers now?"):
Logger.print_info("Linking to Obico server skipped ...") self._link_obico_instances(unlinked_instances)
return else:
Logger.print_info("Linking to server skipped ...")
self._link_obico_instances(unlinked_instances)
def _remove_obico_instances( def _remove_obico_instances(
self, self,