Add specific message when connecting to slave, prevent duplicate messages

This commit is contained in:
ChrisTerBeke 2019-08-07 01:02:46 +02:00
parent 8a2e394abc
commit 2ed033da7c
No known key found for this signature in database
GPG key ID: A49F1AB9D7E0C263
3 changed files with 60 additions and 14 deletions

View file

@ -7,14 +7,27 @@ from UM.Message import Message
I18N_CATALOG = i18nCatalog("cura")
## Message shown when uploading a print job to a cluster is blocked because another upload is already in progress.
## Message shown when trying to connect to a legacy printer device.
class LegacyDeviceNoLongerSupportedMessage(Message):
# Singleton used to prevent duplicate messages of this type at the same time.
__is_visible = False
def __init__(self) -> None:
super().__init__(
text = I18N_CATALOG.i18nc("@info:status", "You are attempting to connect to a printer that is not "
"running Ultimaker Connect. Please update the printer to the "
"latest firmware."),
title = I18N_CATALOG.i18nc("@info:title", "Update your printer"),
lifetime = 10
text = I18N_CATALOG.i18nc("@info:status", "You are attempting to connect to a printer that is not "
"running Ultimaker Connect. Please update the printer to the "
"latest firmware."),
title = I18N_CATALOG.i18nc("@info:title", "Update your printer"),
lifetime = 10
)
def show(self) -> None:
if LegacyDeviceNoLongerSupportedMessage.__is_visible:
return
super().show()
LegacyDeviceNoLongerSupportedMessage.__is_visible = True
def hide(self, send_signal = True) -> None:
super().hide(send_signal)
LegacyDeviceNoLongerSupportedMessage.__is_visible = False

View file

@ -0,0 +1,33 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from UM import i18nCatalog
from UM.Message import Message
I18N_CATALOG = i18nCatalog("cura")
## Message shown when trying to connect to a printer that is not a host.
class NotClusterHostMessage(Message):
# Singleton used to prevent duplicate messages of this type at the same time.
__is_visible = False
def __init__(self) -> None:
super().__init__(
text = I18N_CATALOG.i18nc("@info:status", "You are attempting to connect to a printer that is not "
"the host of an Ultimaker Connect group. Please connect to "
"the host instead."),
title = I18N_CATALOG.i18nc("@info:title", "Not a cluster host"),
lifetime = 10
)
def show(self) -> None:
if NotClusterHostMessage.__is_visible:
return
super().show()
NotClusterHostMessage.__is_visible = True
def hide(self, send_signal = True) -> None:
super().hide(send_signal)
NotClusterHostMessage.__is_visible = False