mirror of
https://github.com/dw-0/kiauh.git
synced 2026-01-01 04:03:37 +05:00
Compare commits
1 Commits
2bbdf3eab9
...
024ab046b9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
024ab046b9 |
@@ -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)
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user