From ac9aa00b04fcacc31e07feae2db9f48c61c40a0d Mon Sep 17 00:00:00 2001 From: Felix Knoefel Date: Thu, 11 Jul 2024 14:02:08 +0200 Subject: [PATCH] Made solution and reset clear playground --- .../IPTBrowser.class.st | 18 +++++++++++------- .../IPTEditor.class.st | 18 ++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/InteractivePongTutorial-Core/IPTBrowser.class.st b/src/InteractivePongTutorial-Core/IPTBrowser.class.st index 46af670..40eab5e 100644 --- a/src/InteractivePongTutorial-Core/IPTBrowser.class.st +++ b/src/InteractivePongTutorial-Core/IPTBrowser.class.st @@ -540,15 +540,16 @@ IPTBrowser >> loadLevel: aLevelIndex [ { #category : #actions, - #'squeak_changestamp' : 'Felix Knöfel 7/10/2024 11:35' + #'squeak_changestamp' : 'Felix Knöfel 7/11/2024 14:01' } IPTBrowser >> loadSolutionButtonAction [ self levelIndex ifNotNil: [ - self selectedCodePiece loadSolutionCodeForLevel: self levelIndex andChapter: self chapter chapterNumber. + self selectedCodePiece + loadSolutionCodeForLevel: self levelIndex andChapter: self chapter chapterNumber; + compileCode. self codeEditor setCodePiece: self selectedCodePiece. - self selectedCodePiece compileCode]. - + self clearPlayground]. ] @@ -723,13 +724,16 @@ IPTBrowser >> reloadCodePieces [ { #category : #actions, - #'squeak_changestamp' : 'Felix Knöfel 7/10/2024 11:46' + #'squeak_changestamp' : 'Felix Knöfel 7/11/2024 13:57' } IPTBrowser >> resetButtonAction [ self levelIndex ifNotNil: [ - self selectedCodePiece loadInitialCodeForLevel: self levelIndex andChapter: self chapter chapterNumber. - self codeEditor setCodePiece: self selectedCodePiece]. + self selectedCodePiece + loadInitialCodeForLevel: self levelIndex andChapter: self chapter chapterNumber; + compileCode. + self codeEditor setCodePiece: self selectedCodePiece. + self clearPlayground]. ] diff --git a/src/InteractivePongTutorial-Core/IPTEditor.class.st b/src/InteractivePongTutorial-Core/IPTEditor.class.st index 2f09714..42d3f67 100644 --- a/src/InteractivePongTutorial-Core/IPTEditor.class.st +++ b/src/InteractivePongTutorial-Core/IPTEditor.class.st @@ -75,22 +75,20 @@ IPTEditor >> codePiece: aCodePiece [ { #category : #evaluating, - #'squeak_changestamp' : 'Josua Zehner 7/9/2024 11:31' + #'squeak_changestamp' : 'Felix Knöfel 7/11/2024 13:39' } IPTEditor >> contents: input notifying: aController [ - | errorMessage | - errorMessage := self codePiece checkSyntax: input. - errorMessage - ifNotEmpty: [ + (self codePiece checkSyntax: input) + ifNotEmpty: [ :errorMessage | UIManager default inform: errorMessage. - self codePiece readOnly ifTrue: [ - self contents: self codePiece code.]] + self codePiece readOnly ifTrue: [self contents: self codePiece code]] ifEmpty: [ super contents: input notifying: aController. - self codePiece code: input. - self codePiece compileCode. - self browser clearPlayground.]. + self codePiece + code: input; + compileCode. + self browser clearPlayground]. self changed: #contents. ]