Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion src/Pyramid-Bloc/PyramidLibraryElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,28 @@ Class {
#instVars : [
'name',
'icon',
'block'
'block',
'status'
],
#category : #'Pyramid-Bloc-plugin-navigation'
}

{ #category : #accessing }
PyramidLibraryElement class >> statusNotUsable [
^ #notUsable
]

{ #category : #accessing }
PyramidLibraryElement class >> statusOk [

^ #ok
]

{ #category : #accessing }
PyramidLibraryElement class >> statusUnstable [
^ #unstable
]

{ #category : #converting }
PyramidLibraryElement >> asArray [

Expand Down Expand Up @@ -85,3 +102,15 @@ PyramidLibraryElement >> name: anObject [

name := anObject
]

{ #category : #accessing }
PyramidLibraryElement >> status [

^ status ifNil: [self class statusUnstable]
]

{ #category : #accessing }
PyramidLibraryElement >> status: aSymbol [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the different status should be defined on class methods (instead of calling #ok or #unstable, call PyramidLibraryElement statusUnstable). Easier to maintain.


status := aSymbol
]
93 changes: 73 additions & 20 deletions src/Pyramid-Toplo/PyramidToploThemePlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,83 @@ PyramidToploThemePlugin class >> toploIconThemeCategoryFromClass: aClass withCat
PyramidToploThemePlugin class >> toploLibraryCategory [

<pyramidLibraryCategory: 1>
| classes elements |
classes := ToElement allSubclasses , { ToElement }.
elements := classes
reject: [ :each |
each isAbstract or: [
(each name findString: 'Abstract') > 0 or: [
[
each new.
false ]
on: Error
do: [ true ] ] ] ]
thenCollect: [ :class |
| allowedClasses allClasses elements knownNotUsable testClass okElements unserializedElements |
allowedClasses := {
ToButton.
ToRadioButton.
ToToggleButton.
ToLabel.
ToImage.
ToAlbum.
ToTextField}.
knownNotUsable := #( #ToCircularMenuInnerElement
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need this list ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this list because these elements cause errors, and the test to create an element and verify if it works does not work for these elements.

#ToCircularMenuList #ToExPicsumNode
#ToAnimatedIcon ).
testClass := Smalltalk at: #ToSerializerTest.
allClasses := ToElement allSubclasses , { ToElement }.
allClasses := allClasses reject: [ :each |
each isAbstract or: [
(each name findString: 'Abstract') > 0 ] ].
elements := allClasses collect: [ :class |
| notUsable serializable status |
notUsable := [
class new.
false ]
on: Error
do: [ :e | true ].
notUsable := notUsable or: [
knownNotUsable includes:
class name asSymbol ].
serializable := [
| suite prefix |
prefix := 'test' , class name.
suite := testClass suite tests
select: [ :t |
t selector beginsWith:
prefix ].
suite isNotEmpty ]
on: Error
do: [ false ].
status := notUsable
ifTrue: [
PyramidLibraryElement statusNotUsable ]
ifFalse: [
((allowedClasses includes: class) and: [
serializable ])
ifTrue: [ PyramidLibraryElement statusOk ]
ifFalse: [
PyramidLibraryElement statusUnstable ] ].
PyramidLibraryElement new
icon:
(Smalltalk ui icons iconNamed: class systemIconName);
icon: (Smalltalk ui icons iconNamed:
(status = PyramidLibraryElement statusNotUsable
ifTrue: [ #error ]
ifFalse: [
status = PyramidLibraryElement statusUnstable
ifTrue: [ #warning ]
ifFalse: [ class systemIconName ] ]));
name: class name;
block: [ { class new } ];
status: status;
yourself ].

^ { (PyramidLibraryCategory new
name: 'Toplo';
icon: (Smalltalk ui icons iconNamed: #box);
elements: (elements sorted: [ :a :b | a name < b name ]);
yourself) }
elements := elements reject: [ :e |
e status = PyramidLibraryElement statusNotUsable ].
okElements := elements select: [ :e |
e status = PyramidLibraryElement statusOk ].
unserializedElements := elements select: [ :e |
e status
= PyramidLibraryElement statusUnstable ].
^ {
(PyramidLibraryCategory new
name: 'Toplo-Verified';
icon: (Smalltalk ui icons iconNamed: #smallOk);
elements: (okElements sorted: [ :a :b | a name < b name ]);
yourself).
(PyramidLibraryCategory new
name: 'Toplo-Unverified';
icon: (Smalltalk ui icons iconNamed: #warning);
elements:
(unserializedElements sorted: [ :a :b | a name < b name ]);
yourself) }
]

{ #category : #adding }
Expand Down
Loading