Show Add Machine dialog after User Agreement dialog is closed

CURA-4501
This commit is contained in:
Lipu Fei 2017-10-30 10:33:49 +01:00
parent b5904cd239
commit aab601927c
3 changed files with 26 additions and 2 deletions

View File

@ -300,6 +300,9 @@ class CuraApplication(QtApplication):
preferences.addPreference("view/invert_zoom", False)
self._need_to_show_user_agreement = not Preferences.getInstance().getValue("general/accepted_user_agreement")
self._has_user_agreement_shown = False
for key in [
"dialog_load_path", # dialog_save_path is in LocalFileOutputDevicePlugin
"dialog_profile_path",
@ -372,6 +375,22 @@ class CuraApplication(QtApplication):
def _onEngineCreated(self):
self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider())
onHasUserAgreementShownChanged = pyqtSignal()
@pyqtProperty(bool)
def needToShowUserAgreement(self):
return self._need_to_show_user_agreement
@pyqtProperty(bool, notify = onHasUserAgreementShownChanged)
def hasUserAgreementShown(self):
return self._has_user_agreement_shown
def setHasShownUserAgreement(self, shown = True):
emit_signal = self._has_user_agreement_shown != shown
self._has_user_agreement_shown = shown
if emit_signal:
self.onHasUserAgreementShownChanged.emit()
## The "Quit" button click event handler.
@pyqtSlot()
def closeApplication(self):

View File

@ -42,7 +42,7 @@ class UserAgreement(QObject, Extension):
Logger.log("i", "User did NOT agree to the user agreement")
Preferences.getInstance().setValue("general/accepted_user_agreement", False)
CuraApplication.getInstance().quit()
CuraApplication.getInstance().setHasShownUserAgreement(True)
def createUserAgreementWindow(self):
path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), "UserAgreement.qml"))
@ -50,4 +50,4 @@ class UserAgreement(QObject, Extension):
component = QQmlComponent(Application.getInstance()._engine, path)
self._user_agreement_context = QQmlContext(Application.getInstance()._engine.rootContext())
self._user_agreement_context.setContextProperty("manager", self)
self._user_agreement_window = component.create(self._user_agreement_context)
self._user_agreement_window = component.create(self._user_agreement_context)

View File

@ -894,6 +894,11 @@ UM.MainWindow
if(!base.visible)
{
base.visible = true;
}
// check later if the user agreement dialog has been closed
if (CuraApplication.needToShowUserAgreement && !CuraApplication.hasUserAgreementShown)
{
restart();
}
else if(Cura.MachineManager.activeMachineId == null || Cura.MachineManager.activeMachineId == "")