The Inbox: EToys-ct.368.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: EToys-ct.368.mcz

commits-2
A new version of EToys was added to project The Inbox:
http://source.squeak.org/inbox/EToys-ct.368.mcz

==================== Summary ====================

Name: EToys-ct.368
Author: ct
Time: 15 October 2019, 2:57:44.969129 pm
UUID: a02688f9-acfd-4240-a068-bdb24539e268
Ancestors: EToys-ct.366

Changes "revert to tile version" behavior in script editor: Instead of discarding the changed code, always use the new approach and convert the decompiled code back to tiles.

=============== Diff against EToys-ct.366 ===============

Item was added:
+ ----- Method: MethodWithInterface>>revertTileVersionFrom:for: (in category 'updating') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+ "Only for universal tiles."
+
+ anEditor removeAllButFirstSubmorph.
+ anEditor insertUniversalTiles.
+ anEditor showingMethodPane: false!

Item was changed:
  ----- Method: ScriptEditorMorph>>revertToTileVersion (in category 'save & revert') -----
  revertToTileVersion
  "The receiver, currently showing textual code,  is asked to revert to the last-saved tile version"
 
  | aUserScript |
 
  self
  hResizing: #shrinkWrap;
  vResizing: #shrinkWrap.
  aUserScript := playerScripted class userScriptForPlayer: playerScripted selector: scriptName.
+ aUserScript revertTileVersionFrom: self for: playerScripted.
- aUserScript revertToLastSavedTileVersionFor: self.
  self currentWorld startSteppingSubmorphsOf: self!

Item was changed:
  ----- Method: ScriptEditorMorph>>toggleWhetherShowingTiles (in category 'other') -----
  toggleWhetherShowingTiles
  "Toggle between showing the method pane and showing the tiles pane"
 
  self showingMethodPane
  ifFalse: "currently showing tiles"
  [self showSourceInScriptor]
+ ifTrue: "currently showing textual source"
+ [self revertToTileVersion]!
-
- ifTrue: "current showing textual source"
- [Preferences universalTiles
- ifTrue: [^ self revertToTileVersion].
- self savedTileVersionsCount >= 1
- ifTrue:
- [(self userScriptObject lastSourceString = (playerScripted class sourceCodeAt: scriptName))
- ifFalse:
- [(self confirm:
- 'Caution -- this script was changed
- textually; if you revert to tiles at this
- point you will lose all the changes you
- may have made textually.  Do you
- really want to do this?' translated) ifFalse: [^ self]].
- self revertToTileVersion]
- ifFalse:
- [Beeper beep]]!

Item was added:
+ ----- Method: UniclassScript>>revertTileVersionFrom:for: (in category 'updating') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+
+ anEditor removeAllButFirstSubmorph.
+ Preferences universalTiles
+ ifFalse: [
+ ((self playerClass >> self selector) decompile asTileSetForPlayer: playerScripted)
+ withIndexDo: [:tile :index |
+ anEditor insertTileRow: {tile} after: index].
+ anEditor allMorphsDo: #layoutChanged]
+ ifTrue: [
+ anEditor insertUniversalTiles].
+ anEditor showingMethodPane: false.
+ isTextuallyCoded := false.!

Item was added:
+ ----- Method: UserScript>>revertTileVersionFrom:for: (in category 'versions') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+
+ anEditor removeAllButFirstSubmorph.
+ ((self playerClass >> self selector) decompile asTileSetForPlayer: playerScripted)
+ withIndexDo: [:tile :index |
+ anEditor insertTileRow: {tile} after: index].
+ anEditor allMorphsDo: #layoutChanged.
+ anEditor showingMethodPane: false.
+ self becomeTextuallyCoded.!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: EToys-ct.368.mcz

marcel.taeumel
Are there tests for this back-and-forth conversion? How safe is this new feature? May be flag it as experimental? :-)

Best,
Marcel

Am 15.10.2019 14:58:16 schrieb [hidden email] <[hidden email]>:

A new version of EToys was added to project The Inbox:
http://source.squeak.org/inbox/EToys-ct.368.mcz

==================== Summary ====================

Name: EToys-ct.368
Author: ct
Time: 15 October 2019, 2:57:44.969129 pm
UUID: a02688f9-acfd-4240-a068-bdb24539e268
Ancestors: EToys-ct.366

Changes "revert to tile version" behavior in script editor: Instead of discarding the changed code, always use the new approach and convert the decompiled code back to tiles.

=============== Diff against EToys-ct.366 ===============

Item was added:
+ ----- Method: MethodWithInterface>>revertTileVersionFrom:for: (in category 'updating') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+ "Only for universal tiles."
+
+ anEditor removeAllButFirstSubmorph.
+ anEditor insertUniversalTiles.
+ anEditor showingMethodPane: false!

Item was changed:
----- Method: ScriptEditorMorph>>revertToTileVersion (in category 'save & revert') -----
revertToTileVersion
"The receiver, currently showing textual code, is asked to revert to the last-saved tile version"

| aUserScript |

self
hResizing: #shrinkWrap;
vResizing: #shrinkWrap.
aUserScript := playerScripted class userScriptForPlayer: playerScripted selector: scriptName.
+ aUserScript revertTileVersionFrom: self for: playerScripted.
- aUserScript revertToLastSavedTileVersionFor: self.
self currentWorld startSteppingSubmorphsOf: self!

Item was changed:
----- Method: ScriptEditorMorph>>toggleWhetherShowingTiles (in category 'other') -----
toggleWhetherShowingTiles
"Toggle between showing the method pane and showing the tiles pane"

self showingMethodPane
ifFalse: "currently showing tiles"
[self showSourceInScriptor]
+ ifTrue: "currently showing textual source"
+ [self revertToTileVersion]!
-
- ifTrue: "current showing textual source"
- [Preferences universalTiles
- ifTrue: [^ self revertToTileVersion].
- self savedTileVersionsCount >= 1
- ifTrue:
- [(self userScriptObject lastSourceString = (playerScripted class sourceCodeAt: scriptName))
- ifFalse:
- [(self confirm:
- 'Caution -- this script was changed
- textually; if you revert to tiles at this
- point you will lose all the changes you
- may have made textually. Do you
- really want to do this?' translated) ifFalse: [^ self]].
- self revertToTileVersion]
- ifFalse:
- [Beeper beep]]!

Item was added:
+ ----- Method: UniclassScript>>revertTileVersionFrom:for: (in category 'updating') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+
+ anEditor removeAllButFirstSubmorph.
+ Preferences universalTiles
+ ifFalse: [
+ ((self playerClass >> self selector) decompile asTileSetForPlayer: playerScripted)
+ withIndexDo: [:tile :index |
+ anEditor insertTileRow: {tile} after: index].
+ anEditor allMorphsDo: #layoutChanged]
+ ifTrue: [
+ anEditor insertUniversalTiles].
+ anEditor showingMethodPane: false.
+ isTextuallyCoded := false.!

Item was added:
+ ----- Method: UserScript>>revertTileVersionFrom:for: (in category 'versions') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+
+ anEditor removeAllButFirstSubmorph.
+ ((self playerClass >> self selector) decompile asTileSetForPlayer: playerScripted)
+ withIndexDo: [:tile :index |
+ anEditor insertTileRow: {tile} after: index].
+ anEditor allMorphsDo: #layoutChanged.
+ anEditor showingMethodPane: false.
+ self becomeTextuallyCoded.!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: EToys-ct.368.mcz

Christoph Thiede

Excellent idea! :-) I just added some tests.


How safe it is ... It works quite well for "simple" MessageSends such as [self forward: 13] or cascades and also supports test and color tiles. However, I did not cover full Smalltalk syntax, so assignments, variables, arrays, return nodes or even FutureNodes (I do not even know what they do exactly :D) are not yet supported. It's also a question of design, as EToys does not support most of them. Other special tiles such as for sound or random are neither respected yet. So yes, I would consider it experimental for the moment :)


Best,

Christoph



Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Dienstag, 15. Oktober 2019 15:10 Uhr
An: gettimothy via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: EToys-ct.368.mcz
 
Are there tests for this back-and-forth conversion? How safe is this new feature? May be flag it as experimental? :-)

Best,
Marcel

Am 15.10.2019 14:58:16 schrieb [hidden email] <[hidden email]>:

A new version of EToys was added to project The Inbox:
http://source.squeak.org/inbox/EToys-ct.368.mcz

==================== Summary ====================

Name: EToys-ct.368
Author: ct
Time: 15 October 2019, 2:57:44.969129 pm
UUID: a02688f9-acfd-4240-a068-bdb24539e268
Ancestors: EToys-ct.366

Changes "revert to tile version" behavior in script editor: Instead of discarding the changed code, always use the new approach and convert the decompiled code back to tiles.

=============== Diff against EToys-ct.366 ===============

Item was added:
+ ----- Method: MethodWithInterface>>revertTileVersionFrom:for: (in category 'updating') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+ "Only for universal tiles."
+
+ anEditor removeAllButFirstSubmorph.
+ anEditor insertUniversalTiles.
+ anEditor showingMethodPane: false!

Item was changed:
----- Method: ScriptEditorMorph>>revertToTileVersion (in category 'save & revert') -----
revertToTileVersion
"The receiver, currently showing textual code, is asked to revert to the last-saved tile version"

| aUserScript |

self
hResizing: #shrinkWrap;
vResizing: #shrinkWrap.
aUserScript := playerScripted class userScriptForPlayer: playerScripted selector: scriptName.
+ aUserScript revertTileVersionFrom: self for: playerScripted.
- aUserScript revertToLastSavedTileVersionFor: self.
self currentWorld startSteppingSubmorphsOf: self!

Item was changed:
----- Method: ScriptEditorMorph>>toggleWhetherShowingTiles (in category 'other') -----
toggleWhetherShowingTiles
"Toggle between showing the method pane and showing the tiles pane"

self showingMethodPane
ifFalse: "currently showing tiles"
[self showSourceInScriptor]
+ ifTrue: "currently showing textual source"
+ [self revertToTileVersion]!
-
- ifTrue: "current showing textual source"
- [Preferences universalTiles
- ifTrue: [^ self revertToTileVersion].
- self savedTileVersionsCount >= 1
- ifTrue:
- [(self userScriptObject lastSourceString = (playerScripted class sourceCodeAt: scriptName))
- ifFalse:
- [(self confirm:
- 'Caution -- this script was changed
- textually; if you revert to tiles at this
- point you will lose all the changes you
- may have made textually. Do you
- really want to do this?' translated) ifFalse: [^ self]].
- self revertToTileVersion]
- ifFalse:
- [Beeper beep]]!

Item was added:
+ ----- Method: UniclassScript>>revertTileVersionFrom:for: (in category 'updating') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+
+ anEditor removeAllButFirstSubmorph.
+ Preferences universalTiles
+ ifFalse: [
+ ((self playerClass >> self selector) decompile asTileSetForPlayer: playerScripted)
+ withIndexDo: [:tile :index |
+ anEditor insertTileRow: {tile} after: index].
+ anEditor allMorphsDo: #layoutChanged]
+ ifTrue: [
+ anEditor insertUniversalTiles].
+ anEditor showingMethodPane: false.
+ isTextuallyCoded := false.!

Item was added:
+ ----- Method: UserScript>>revertTileVersionFrom:for: (in category 'versions') -----
+ revertTileVersionFrom: anEditor for: playerScripted
+
+ anEditor removeAllButFirstSubmorph.
+ ((self playerClass >> self selector) decompile asTileSetForPlayer: playerScripted)
+ withIndexDo: [:tile :index |
+ anEditor insertTileRow: {tile} after: index].
+ anEditor allMorphsDo: #layoutChanged.
+ anEditor showingMethodPane: false.
+ self becomeTextuallyCoded.!




Carpe Squeak!