Skip to content

Commit

Permalink
add a setting to prevent close window.
Browse files Browse the repository at this point in the history
show line counts when uploading.
  • Loading branch information
EiichiroIto committed May 4, 2020
1 parent 9a1aa73 commit d45f2da
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 18 deletions.
16 changes: 14 additions & 2 deletions src/FromScratch/SpScratchApp.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ SpScratchApp class >> clipboard: anObject [
Clipboard := anObject
]

{ #category : #accessing }
SpScratchApp class >> dontClose [
^ self settings at: #dontClose ifAbsentPut: [ false ]
]

{ #category : #accessing }
SpScratchApp class >> dontClose: aBoolean [
self settings at: #dontClose put: aBoolean
]

{ #category : #accessing }
SpScratchApp class >> extension [
self subclassResponsibility
Expand Down Expand Up @@ -69,9 +79,11 @@ SpScratchApp class >> loadSettings [
{ #category : #accessing }
SpScratchApp class >> optionsFor: aSymbol [
aSymbol = #stickyWindow
ifTrue: [ ^ #(true false) ].
ifTrue: [ ^ {true . false} ].
aSymbol = #useErrorCatcher
ifTrue: [ ^ #(true false) ].
ifTrue: [ ^ {true . false} ].
aSymbol = #dontClose
ifTrue: [ ^ {true . false} ].
^ #()
]

Expand Down
26 changes: 26 additions & 0 deletions src/FromScratch/SpScratchFrame.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,23 @@ SpScratchFrame >> scriptMenuFor: aScript [
^ menu
]

{ #category : #private }
SpScratchFrame >> selectSetting: aSymbol [
| list choice appClass |
appClass := self application class.
list := appClass optionsFor: aSymbol.
list isEmpty
ifTrue: [ ^ self ].
choice := UIManager default
chooseFrom: list
title: 'Select options for ' , aSymbol.
choice = 0
ifTrue: [ ^ self ].
appClass perform: (aSymbol , ':') asSymbol with: (list at: choice).
aSymbol = #dontClose
ifTrue: [ self updateDontCloseSetting ]
]

{ #category : #private }
SpScratchFrame >> stageShotExtent: size [
^ self formFrom: self display extent: size
Expand Down Expand Up @@ -228,6 +245,15 @@ SpScratchFrame >> updateDisplay [
self display changed
]

{ #category : #private }
SpScratchFrame >> updateDontCloseSetting [
| win |
win := self window window.
self application class dontClose
ifTrue: [ win makeUnclosable ]
ifFalse: [ win makeClosable ]
]

{ #category : #stepping }
SpScratchFrame >> whenStepsDo: aBlock [
self display
Expand Down
7 changes: 7 additions & 0 deletions src/MicroWiz/MicroPythonProxy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ MicroPythonProxy >> setRawPrompted [
self status: #rawPrompted
]

{ #category : #accessing }
MicroPythonProxy >> statusString [
self isRawPrompted
ifFalse: [ ^ super statusString ].
^ '(', sendingQueue size asString, ')'
]

{ #category : #private }
MicroPythonProxy >> stringOfFileNamed: aString [
| out |
Expand Down
5 changes: 5 additions & 0 deletions src/MicroWiz/MicroWizProxy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ MicroWizProxy >> status: aSymbol [
status := aSymbol
]

{ #category : #accessing }
MicroWizProxy >> statusString [
^ self status
]

{ #category : #accessing }
MicroWizProxy >> step [
| ret |
Expand Down
17 changes: 2 additions & 15 deletions src/MicroWiz/SpMicroWizFrame.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ SpMicroWizFrame >> fileMenu [
addItem: [ :item |
item
name: 'Close';
action: [ application close ] ];
action: [ application close ];
enabled: [ application class dontClose not ] ];
addItem: [ :item |
item
name: 'Quit';
Expand Down Expand Up @@ -349,20 +350,6 @@ SpMicroWizFrame >> replLog [
^ stageFrame log
]

{ #category : #private }
SpMicroWizFrame >> selectSetting: aSymbol [
| list choice |
list := SpMicroWiz optionsFor: aSymbol.
list isEmpty
ifTrue: [ ^ self ].
choice := UIManager default
chooseFrom: list
title: 'Select options for ' , aSymbol.
choice = 0
ifTrue: [ ^ self ].
SpMicroWiz perform: (aSymbol , ':') asSymbol with: (list at: choice)
]

{ #category : #private }
SpMicroWizFrame >> settingsMenu [
| m |
Expand Down
2 changes: 1 addition & 1 deletion src/MicroWiz/SpMicroWizStage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ SpMicroWizStage >> step [
ifFalse: [ buttonConnect state: false.
^ labelStatus label: 'unconnected' ].
proxy step.
labelStatus label: proxy status.
labelStatus label: proxy statusString.
self addOutput: proxy responseString
]

Expand Down

0 comments on commit d45f2da

Please sign in to comment.