Skip to content

Commit

Permalink
Made solution and reset clear playground
Browse files Browse the repository at this point in the history
  • Loading branch information
Feluxus committed Jul 11, 2024
1 parent 9081fb2 commit ac9aa00
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
18 changes: 11 additions & 7 deletions src/InteractivePongTutorial-Core/IPTBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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].

]

Expand Down Expand Up @@ -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].


]
Expand Down
18 changes: 8 additions & 10 deletions src/InteractivePongTutorial-Core/IPTEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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.
]
Expand Down

0 comments on commit ac9aa00

Please sign in to comment.