Show welcome page if no printer

This commit is contained in:
Lipu Fei 2019-03-26 16:21:07 +01:00
parent 6843fb1ffb
commit 1dd48c5728
2 changed files with 7 additions and 6 deletions

View File

@ -38,6 +38,7 @@ from UM.Settings.Validator import Validator
from UM.Message import Message from UM.Message import Message
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from UM.Workspace.WorkspaceReader import WorkspaceReader from UM.Workspace.WorkspaceReader import WorkspaceReader
import UM.Util
from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation
from UM.Operations.GroupedOperation import GroupedOperation from UM.Operations.GroupedOperation import GroupedOperation
@ -548,11 +549,11 @@ class CuraApplication(QtApplication):
@pyqtProperty(bool) @pyqtProperty(bool)
def needToShowUserAgreement(self) -> bool: def needToShowUserAgreement(self) -> bool:
return not self.getPreferences().getValue("general/accepted_user_agreement") return not UM.Util.parseBool(self.getPreferences().getValue("general/accepted_user_agreement"))
@pyqtSlot(bool) @pyqtSlot(bool)
def setNeedToShowUserAgreement(self, set_value = True) -> None: def setNeedToShowUserAgreement(self, set_value: bool = True) -> None:
self.getPreferences().setValue("general/accepted_user_agreement", not set_value) self.getPreferences().setValue("general/accepted_user_agreement", str(not set_value))
@pyqtSlot(str, str) @pyqtSlot(str, str)
def writeToLog(self, severity: str, message: str) -> None: def writeToLog(self, severity: str, message: str) -> None:

View File

@ -74,13 +74,13 @@ UM.MainWindow
Cura.Actions.parent = backgroundItem Cura.Actions.parent = backgroundItem
CuraApplication.purgeWindows() CuraApplication.purgeWindows()
if (CuraApplication.needToShowUserAgreement) if (CuraApplication.needToShowUserAgreement || Cura.MachineManager.activeMachine == null)
{ {
welcomeDialog.show() welcomeDialog.visible = true
} }
else else
{ {
welcomeDialog.close() welcomeDialog.visible = false
} }
// TODO: While the new onboarding process contains the user-agreement, // TODO: While the new onboarding process contains the user-agreement,
// it should probably not entirely rely on 'needToShowUserAgreement' for show/hide. // it should probably not entirely rely on 'needToShowUserAgreement' for show/hide.