Skip to content

Commit

Permalink
Merge pull request #62 from plantec/OnBloc-removal
Browse files Browse the repository at this point in the history
On bloc removal
  • Loading branch information
plantec committed Jul 13, 2023
2 parents 70d9b62 + c9c0404 commit 1c65bd8
Show file tree
Hide file tree
Showing 23 changed files with 189 additions and 145 deletions.
6 changes: 3 additions & 3 deletions src/BaselineOfToplo/BaselineOfToplo.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ BaselineOfToplo >> baselineForCommon: spec [
BaselineOfToplo >> dependencies: spec [

spec
baseline: 'OnBloc'
with: [ spec repository: 'github://plantec/OnBloc/src' ].
baseline: 'Bloc'
with: [ spec repository: 'github://pharo-graphics/bloc/src' ].

spec
baseline: 'Album'
Expand All @@ -35,7 +35,7 @@ BaselineOfToplo >> registerPackages: spec [
"Core"
spec
package: #Toplo
with: [ spec requires: #( #OnBloc #Album ) ].
with: [ spec requires: #( #Bloc #Album ) ].

"IDE"
spec
Expand Down
12 changes: 6 additions & 6 deletions src/Toplo-LookAndFeel-Tests/SpaceTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SpaceTests >> createDefaultButton [
SpaceTests >> testCannotSwitchThemeDarkOrLight [

| space theme |
space := OBlSpace new.
space := BlSpace new.
theme := ToCustomNoDarkNoLightTestTheme new.
space toTheme: theme.
self assert: space toTheme isSupportLightAndDark not.
Expand All @@ -36,7 +36,7 @@ SpaceTests >> testChangeSpaceTheme [
"test button skin tokens"
self assert: (button skin token: #background) equals: (ToThemeLight new colorBgContainer).

space := OBlSpace new.
space := BlSpace new.
space root addChild: button.

space toTheme: ToThemeDark new.
Expand All @@ -57,7 +57,7 @@ SpaceTests >> testChangeSpaceThemeAndDontTouchSpecifiedElementTheme [

button2 := self createDefaultButton.

space := OBlSpace new.
space := BlSpace new.
space root addChild: button1.
space root addChild: button2.

Expand All @@ -77,7 +77,7 @@ SpaceTests >> testChangeSpaceThemeAndDontTouchSpecifiedElementTheme [
SpaceTests >> testDefaultSpaceTheme [

| space |
space := OBlSpace new.
space := BlSpace new.
self assert: space toTheme class equals: ToAbstractTheme current class.

]
Expand All @@ -86,15 +86,15 @@ SpaceTests >> testDefaultSpaceTheme [
SpaceTests >> testSpaceBackground [

| space |
space := OBlSpace new.
space := BlSpace new.
self assert: space root background paint color equals: space toTheme backgroundColor
]

{ #category : #tests }
SpaceTests >> testSwitchThemeDarkOrLight [

| space |
space := OBlSpace new.
space := BlSpace new.
self assert: space toTheme isLight.

space switchThemeDarkOrLight.
Expand Down
6 changes: 3 additions & 3 deletions src/Toplo-LookAndFeel-Tests/ToCustomThemeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ToCustomThemeTest >> testChangeSpaceTheme [
| button space |

button := ToButton skinType: #default.
space := OBlSpace new.
space := BlSpace new.
space root addChild: button.

space toTheme: ToThemeDark new.
Expand All @@ -51,7 +51,7 @@ ToCustomThemeTest >> testChangeSpaceTheme [
ToCustomThemeTest >> testChangeThemeAddChildInAParentInASpace [

| space button pane |
space := OBlSpace new.
space := BlSpace new.
space toTheme: ToCustomNoDarkNoLightTestTheme new.

pane := ToPane horizontal.
Expand Down Expand Up @@ -109,7 +109,7 @@ ToCustomThemeTest >> testNoDarkAndNoLightTheme [
ToCustomThemeTest >> testOtherThemeThanDefaultBeforeAddElement [

| space button |
space := OBlSpace new.
space := BlSpace new.
space toTheme: ToCustomNoDarkNoLightTestTheme new.

button := ToButton skinType: #default.
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-LookAndFeel-Tests/ToThemeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ToThemeTest >> testSkins [
ToThemeTest >> testThemeBeforeAddElement [

| space button |
space := OBlSpace new.
space := BlSpace new.
space toTheme: ToThemeDark new.

button := ToButton skinType: #default.
Expand Down
12 changes: 6 additions & 6 deletions src/Toplo-LookAndFeel/ToLAFExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Class {
ToLAFExamples class >> example_ButtonSkins [

| space button1 button2 button3 button4 button5 pane |
space := OBlSpace new.
space := BlSpace new.
space root layout: (BlLinearLayout vertical cellSpacing: 10).

pane := ToPane horizontal.
Expand Down Expand Up @@ -142,7 +142,7 @@ ToLAFExamples class >> example_ButtonSkins_Dark [
ToLAFExamples class >> example_LabelsSkins [

| space label1 label2 label3 label4 label5 label6 |
space := OBlSpace new.
space := BlSpace new.
space root layout: (BlLinearLayout vertical cellSpacing: 10).

label1 := ToLabel skinType: #default.
Expand Down Expand Up @@ -188,7 +188,7 @@ ToLAFExamples class >> example_LabelsSkins_Dark [
ToLAFExamples class >> example_MoreButtonSkins [

| space |
space := OBlSpace new.
space := BlSpace new.
space root layout: (BlFlowLayout horizontal).

1 to: 100 do:[ :i | | button1 button2 button3 button4 button5 |
Expand Down Expand Up @@ -231,7 +231,7 @@ ToLAFExamples class >> example_MoreButtonSkins_Dark [
ToLAFExamples class >> example_RadioButtonSkins [

| space button1 button2 pane |
space := OBlSpace new.
space := BlSpace new.
space root layout: (BlLinearLayout vertical cellSpacing: 10).

pane := ToPane horizontal.
Expand Down Expand Up @@ -262,7 +262,7 @@ ToLAFExamples class >> example_RadioButtonSkins_Dark [
ToLAFExamples class >> example_TitleLabelsSkins [

| space label1 label2 label3 label4 label5 |
space := OBlSpace new.
space := BlSpace new.
space root layout: (BlLinearLayout vertical cellSpacing: 10).

label1 := ToLabel skinType: #h1.
Expand Down Expand Up @@ -342,7 +342,7 @@ ToLAFExamples class >> example_themeColorCustomization [
ToLAFExamples class >> example_toButtonChangeThemeOnClickChangeSkinOnRightClick [

| but space |
space := OBlSpace new.
space := BlSpace new.

but := ToButton skinType: #default.
but labelText: 'Switch to the dark theme'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Extension { #name : #OBlSpace }
Extension { #name : #BlSpace }

{ #category : #'*Toplo-Tests' }
OBlSpace class >> pulseUntilEmptyTaskQueue: aSpace timeout: aDuration [
BlSpace class >> pulseUntilEmptyTaskQueue: aSpace timeout: aDuration [
"Wait until a BlSpace doesn't have available tasks to execute.
Inspired on BlDevScripterWaitStep>>#forEmptySpaceTaskQueueTimeout:"
Expand Down
10 changes: 5 additions & 5 deletions src/Toplo-Tests/ToNotebookTest.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : #ToNotebookTest,
#superclass : #OBlParameterizedTest,
#superclass : #BlParameterizedTest,
#category : #'Toplo-Tests-Widget-Notebook'
}

Expand Down Expand Up @@ -34,12 +34,12 @@ ToNotebookTest >> testBodyFactoryIsValuedOnSelect [
self assert: redCount equals: 1.
self assert: greenCount equals: 0.

OBlSpace simulateClickOn: greenPage titleElement.
BlSpace simulateClickOn: greenPage titleElement.
self waitTestingSpaces.
self assert: redCount equals: 1.
self assert: greenCount equals: 1.

OBlSpace simulateClickOn: redPage titleElement.
BlSpace simulateClickOn: redPage titleElement.
self waitTestingSpaces.
self assert: redCount equals: 2.
self assert: greenCount equals: 1
Expand Down Expand Up @@ -69,7 +69,7 @@ ToNotebookTest >> testClosePage [
self waitTestingSpaces.
self assert: (aNotebook pages includes: redPage).

OBlSpace simulateClickOn: redPage closeButton.
BlSpace simulateClickOn: redPage closeButton.
self waitTestingSpaces.
self deny: (aNotebook pages includes: redPage).
self assert: greenPage isSelected.
Expand Down Expand Up @@ -113,7 +113,7 @@ ToNotebookTest >> testSelectPage [
self assert: orangePage isSelected.
self deny: greenPage isSelected.

OBlSpace simulateClickOn: greenPage titleElement.
BlSpace simulateClickOn: greenPage titleElement.
self waitTestingSpaces.
self assert: greenPage isSelected.
self deny: orangePage isSelected.
Expand Down
8 changes: 4 additions & 4 deletions src/Toplo-Tests/ToObservableCollectionDataSourceTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ToObservableCollectionDataSourceTest >> testRangeChangedNotification [
| datasource rangeEvent |
datasource := ToObservableCollectionDataSource new.
datasource
when: OBlInfiniteDataSourceItemRangeChanged
when: BlInfiniteDataSourceItemRangeChanged
do: [ :event | rangeEvent := event ].
datasource data: ToObservableCollection new.
datasource data addAll: self statesOfAmerica.
Expand Down Expand Up @@ -41,7 +41,7 @@ ToObservableCollectionDataSourceTest >> testRangeInsertedNotification [
| datasource rangeEvent |
datasource := ToObservableCollectionDataSource new.
datasource
when: OBlInfiniteDataSourceItemRangeInserted
when: BlInfiniteDataSourceItemRangeInserted
do: [ :event | rangeEvent := event ].
datasource data: ToObservableCollection new.
datasource data addAll: self statesOfAmerica.
Expand All @@ -60,7 +60,7 @@ ToObservableCollectionDataSourceTest >> testRangeRemovedNotification [
| datasource rangeEvent |
datasource := ToObservableCollectionDataSource new.
datasource
when: OBlInfiniteDataSourceItemRangeRemoved
when: BlInfiniteDataSourceItemRangeRemoved
do: [ :event | rangeEvent := event ].
datasource data: ToObservableCollection new.
datasource data addAll: self statesOfAmerica.
Expand Down Expand Up @@ -92,7 +92,7 @@ ToObservableCollectionDataSourceTest >> testWithData [
| datasource changedEvent |
datasource := ToObservableCollectionDataSource new.
datasource
when: OBlInfiniteDataSourceChanged
when: BlInfiniteDataSourceChanged
do: [ :event | changedEvent := event ].
datasource data:
(ToObservableCollection newFrom: self statesOfAmerica).
Expand Down
4 changes: 2 additions & 2 deletions src/Toplo/BlElement.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BlElement >> openInOBlSpaceWithoutToTheme [
deprecated: 'Use #openInSpaceWithoutToTheme instead'
transformWith: '`@receiver openInOBlSpaceWithoutToTheme' -> '`@receiver openInSpaceWithoutToTheme '.

sp := OBlSpace new.
sp := BlSpace new.
self flag:'labordep : temporary set a nil toTheme setup, this methods should be removed when Look&Feel management will be ok'.
sp toTheme: nil.
sp root addChild: self.
Expand All @@ -36,7 +36,7 @@ BlElement >> openInOBlSpaceWithoutToTheme [
BlElement >> openInSpaceWithoutToTheme [
"This is a development method : use this method when your Space cannot support ToTheme management"
| sp |
sp := OBlSpace new.
sp := BlSpace new.
self flag:'labordep : temporary set a nil toTheme setup, this methods should be removed when Look&Feel management will be ok'.
sp toTheme: nil.
sp root addChild: self.
Expand Down
6 changes: 3 additions & 3 deletions src/Toplo/BlHost.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Extension { #name : #BlHost }
BlHost >> oblWorld [

^ self universe spaces
detect: [ :sp | sp title = self oblWorldTitle ]
detect: [ :sp | sp title = 'OnBloc World' ]
ifNone: [ | w |
self flag:'labordep : temporary set a nil toTheme setup, this methods should be removed when Look&Feel management will be ok'.
w := OBlSpace new
w := BlSpace new
toTheme: nil;
host: self;
title: self oblWorldTitle;
title: 'OnBloc World' ;
yourself.
self universe attachSpace: w.
w ]
Expand Down
49 changes: 46 additions & 3 deletions src/Toplo/BlSpace.extension.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,50 @@
Extension { #name : #BlSpace }

{ #category : #'*Toplo' }
BlSpace >> popupLayer [
{ #category : #'*Toplo-LookAndFeel' }
BlSpace >> isSupportToTheme [
"Development method : to check if the Space support ToTheme management"

^ self root
^ self root toTheme isNil
]

{ #category : #'*Toplo-LookAndFeel' }
BlSpace >> isThemeInstalled [
"This method is temporary here to detect when a Theme is installed, this is dirty and a Space need to have a dresser pattern"

self flag:'laborded : this is necessary to have this state for the first instanciation, this is temporary'.
^ self root userData at: #isToThemeInstalled ifAbsentPut:[ false ]
]

{ #category : #'*Toplo-LookAndFeel' }
BlSpace >> switchThemeDarkOrLight [
"Switch to the opposite theme : dark or light (if available)"
| newTheme |

(self toTheme isNil or:[self toTheme isSupportLightAndDark not]) ifTrue:[ ^ self ].

newTheme := self toTheme isLight
ifTrue: [ self toTheme darkTheme ]
ifFalse: [ self toTheme lightTheme ].

newTheme ifNil:[ ^ self ].
self toTheme: newTheme
]

{ #category : #'*Toplo-LookAndFeel' }
BlSpace >> toTheme [

| theme |
theme := self root toTheme.

"Check theme installation : this is dirty and temporary"
(theme notNil and:[self isThemeInstalled not]) ifTrue:[ theme installOnSpace: self ].

^ theme
]

{ #category : #'*Toplo-LookAndFeel' }
BlSpace >> toTheme: aTheme [

aTheme ifNotNil: [ aTheme installOnSpace: self ].
self root toTheme: aTheme
]
50 changes: 0 additions & 50 deletions src/Toplo/OBlSpace.extension.st

This file was deleted.

Loading

0 comments on commit 1c65bd8

Please sign in to comment.