Skip to content

Commit

Permalink
Merge branch 'pharo-spec:Pharo13' into p13-fix-RegexSyntaxError-SpSea…
Browse files Browse the repository at this point in the history
…rchInputFieldOptionsPresenter
  • Loading branch information
hernanmd authored Nov 7, 2024
2 parents 2ea5c6b + 8b90efb commit 04a5ca7
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 19 deletions.
9 changes: 8 additions & 1 deletion src/Spec2-Adapters-Morphic/SpMorphicTextAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ SpMorphicTextAdapter >> accept: aString notifying: aNotifyier [
notifying: aNotifyier
]

{ #category : 'widget API' }
SpMorphicTextAdapter >> addExtraActionsTo: actionGroup [

"override to add extra actions between user defined and edition"
]

{ #category : 'initialization' }
SpMorphicTextAdapter >> addFocusRotationKeyBindings [
"Text areas needs to be able to process tab. Cancel the binding."
Expand Down Expand Up @@ -91,9 +97,10 @@ SpMorphicTextAdapter >> codePaneMenu: aMenu shifted: shifted [

self presenter internalActions ifNotNil: [ :group |
actionGroup add: group beRoot ].
self addExtraActionsTo: actionGroup.
self presenter actions ifNotNil: [ :group |
actionGroup add: group beRoot ].
self presenter hasEditionContextMenu ifTrue: [
self presenter hasEditionContextMenu ifTrue: [
actionGroup add: self presenter editionCommandsGroup beRoot ].

menuPresenter := self presenter newMenu.
Expand Down
20 changes: 20 additions & 0 deletions src/Spec2-Backend-Tests/SpNotebookAdapterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ SpNotebookAdapterTest >> initializeTestedInstance [
addPage: (SpNotebookPage title: 'Mock2' icon: (self iconNamed: #changeUpdate) provider: [ SpLabelPresenter new ])
]

{ #category : 'tests' }
SpNotebookAdapterTest >> testAccessPage [

| newPage |

newPage := SpNotebookPage title: 'Mock3' provider: [ SpLabelPresenter new ].
presenter addPage: newPage.
self assert: (presenter pageNamed: 'Mock3') equals: newPage.
presenter removeAll.
self should: [ presenter pageNamed: 'Mock3' ] raise: NotFound.
]

{ #category : 'tests' }
SpNotebookAdapterTest >> testAddPage [
self assert: self adapter numberOfTabs equals: 2.
Expand All @@ -42,6 +54,14 @@ SpNotebookAdapterTest >> testClickOnPage [
self assert: self adapter selectedPageName equals: 'Mock2'
]

{ #category : 'tests' }
SpNotebookAdapterTest >> testHasPages [

self assert: presenter hasPages.
presenter removeAll.
self deny: presenter hasPages.
]

{ #category : 'tests' }
SpNotebookAdapterTest >> testRemoveAll [

Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Code-Commands/SpCodeDebugItCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ SpCodeDebugItCommand class >> defaultName [
{ #category : 'default' }
SpCodeDebugItCommand class >> defaultShortcutKey [

^ $d shift command mac
| $d shift control win
| $d shift control unix
^ $d shift actionModifier
]

{ #category : 'private' }
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Code-Commands/SpCodeDoItCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ SpCodeDoItCommand class >> defaultName [
{ #category : 'default' }
SpCodeDoItCommand class >> defaultShortcutKey [

^ $d command mac
| $d control win
| $d control unix
^ $d actionModifier
]

{ #category : 'accessing' }
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Code-Commands/SpCodeInspectItCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ SpCodeInspectItCommand class >> defaultName [
{ #category : 'default' }
SpCodeInspectItCommand class >> defaultShortcutKey [

^ $i command mac
| $i control win
| $i control unix
^ $i actionModifier
]

{ #category : 'documentation' }
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Code-Commands/SpCodePrintItCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ SpCodePrintItCommand class >> defaultName [
{ #category : 'default' }
SpCodePrintItCommand class >> defaultShortcutKey [

^ $p command mac
| $p control win
| $p control unix
^ $p actionModifier
]

{ #category : 'execution' }
Expand Down
8 changes: 8 additions & 0 deletions src/Spec2-Code-Morphic/SpMorphicCodeAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Class {
#package : 'Spec2-Code-Morphic'
}

{ #category : 'widget API' }
SpMorphicCodeAdapter >> addExtraActionsTo: group [

self presenter isOverrideContextMenu ifTrue: [ ^ self ].

group add: self presenter rootCommandsGroup beRoot
]

{ #category : 'widget API' }
SpMorphicCodeAdapter >> behavior [

Expand Down
8 changes: 7 additions & 1 deletion src/Spec2-Code/SpCodePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ SpCodePresenter >> hasEditionContextMenu [
"Answer if edition context menu is active.
Edition context menu is available by default, but it can be disabled by calling `SpTextPresenter>>#withoutEditionContextMenu` or `SpCodePresenter>>#overridingContextMenu`"

^ super hasEditionContextMenu and: [ overrideContextMenu not ]
^ super hasEditionContextMenu and: [ self isOverrideContextMenu not ]
]

{ #category : 'testing' }
Expand Down Expand Up @@ -539,6 +539,12 @@ SpCodePresenter >> interactionModel: anInteractionModel [
self basicInteractionModel: anInteractionModel
]

{ #category : 'private - testing' }
SpCodePresenter >> isOverrideContextMenu [

^ overrideContextMenu
]

{ #category : 'private - bindings' }
SpCodePresenter >> isScripting [

Expand Down
2 changes: 1 addition & 1 deletion src/Spec2-Commands/SpBrowseInstancesCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ SpBrowseInstancesCommand class >> shortName [
{ #category : 'executing' }
SpBrowseInstancesCommand >> execute [

self target instanceSide inspectAllInstances
self target instanceSide allInstances inspect
]
2 changes: 1 addition & 1 deletion src/Spec2-Commands/SpBrowseSubInstancesCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ SpBrowseSubInstancesCommand class >> shortName [
{ #category : 'executing' }
SpBrowseSubInstancesCommand >> execute [

self target instanceSide inspectSubInstances
self target instanceSide allSubInstances inspect
]
6 changes: 6 additions & 0 deletions src/Spec2-CommonWidgets/SpFilteringListPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ SpFilteringListPresenter >> unfilteredItems [
^ unfilteredItems
]

{ #category : 'accessing' }
SpFilteringListPresenter >> unfilteredItems: someItems [

unfilteredItems := someItems
]

{ #category : 'api - events' }
SpFilteringListPresenter >> whenSelectionChangedDo: aBlock [

Expand Down
2 changes: 1 addition & 1 deletion src/Spec2-Core/SpApplication.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Example:
```
MyApplication>>start
(self new: MyMainPresenter) openWithSpec
(self new: MyMainPresenter) open
```
Expand Down
19 changes: 19 additions & 0 deletions src/Spec2-Core/SpNotebookPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ SpNotebookPresenter >> addPageTitle: aString provider: aBlock [
^ self addPage: (SpNotebookPage title: aString provider: aBlock)
]

{ #category : 'testing' }
SpNotebookPresenter >> hasPageNamed: aTitle [

^ self pages anySatisfy: [ : page | page title = aTitle ]
]

{ #category : 'testing' }
SpNotebookPresenter >> hasPages [

^ self pages isNotEmpty
]

{ #category : 'initialization' }
SpNotebookPresenter >> initialize [

Expand All @@ -55,6 +67,13 @@ SpNotebookPresenter >> pageAt: index [
^ self pages at: index
]

{ #category : 'api' }
SpNotebookPresenter >> pageNamed: aTitle [
"Answer the receiver's <SpNotebookPage> with aTitle as name. Raise a <NotFound> exception if not present"

^ self pages detect: [ : page | page title = aTitle ]
]

{ #category : 'private' }
SpNotebookPresenter >> pageTitleChanged: aPage [

Expand Down
6 changes: 4 additions & 2 deletions src/Spec2-ListView/SpListViewPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ SpListViewPresenter class >> exampleWithIconsAndMorph [
It shows also the fact you can put any presenter inside, giving a huge power
to your lists."

| application |
application := SpApplication new useBackend: #Gtk.
^ self new
application: (SpApplication new useBackend: #Gtk);
application: application;
items: self environment allClasses;
setup: [ :aPresenter |
| presenter morph |
Expand All @@ -157,7 +159,7 @@ SpListViewPresenter class >> exampleWithIconsAndMorph [
morph: ((morph := SimpleButtonMorph new)
color: Color blue;
target: [
self inform: 'Clicked: ', morph label ];
application inform: 'Clicked: ', morph label ];
actionSelector: #value;
yourself);
yourself);
Expand Down

0 comments on commit 04a5ca7

Please sign in to comment.