mirror of
https://github.com/Ultimaker/Cura.git
synced 2026-01-18 05:45:40 -07:00
parent
a999048109
commit
d2e5ba50c7
1 changed files with 28 additions and 1 deletions
|
|
@ -1,10 +1,37 @@
|
|||
from cura.CuraApplication import CuraApplication
|
||||
import re
|
||||
|
||||
from typing import Any, Optional, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
|
||||
class PrintInformationPatches():
|
||||
def __init__(self, print_information):
|
||||
def __init__(self, print_information) -> None:
|
||||
self._print_information = print_information
|
||||
self._print_information._defineAbbreviatedMachineName = self._defineAbbreviatedMachineName
|
||||
|
||||
self._global_stack = None # type: Optional[GlobalStack]
|
||||
CuraApplication.getInstance().getMachineManager().globalContainerChanged.connect(self._onMachineChanged)
|
||||
self._onMachineChanged()
|
||||
|
||||
def _onMachineChanged(self) -> None:
|
||||
if self._global_stack:
|
||||
definition_container = self._global_stack.getBottom()
|
||||
if definition_container.getId() == "blackbelt":
|
||||
self._global_stack.containersChanged.disconnect(self._onContainersChanged)
|
||||
|
||||
self._global_stack = CuraApplication.getInstance().getGlobalContainerStack()
|
||||
|
||||
if self._global_stack:
|
||||
definition_container = self._global_stack.getBottom()
|
||||
if definition_container.getId() == "blackbelt":
|
||||
self._global_stack.containersChanged.connect(self._onContainersChanged)
|
||||
|
||||
def _onContainersChanged(self, container: Any) -> None:
|
||||
self._print_information._updateJobName()
|
||||
|
||||
|
||||
## Created an acronymn-like abbreviated machine name from the currently active machine name
|
||||
# Called each time the global stack is switched
|
||||
# Copied verbatim from PrintInformation._defineAbbreviatedMachineName, with a minor patch to set the abbreviation from settings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue