Skip to content
Open
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
15 changes: 14 additions & 1 deletion src/Pyramid-Bloc/PyramidLibraryElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Class {
#instVars : [
'name',
'icon',
'block'
'block',
'status'
],
#category : #'Pyramid-Bloc-plugin-navigation'
}
Expand Down Expand Up @@ -85,3 +86,15 @@ PyramidLibraryElement >> name: anObject [

name := anObject
]

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

^ status ifNil: [ #ok ]
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.

maybe #unstable default

]

{ #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
]
85 changes: 66 additions & 19 deletions src/Pyramid-Toplo/PyramidToploThemePlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,77 @@ 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.
ToLabel.
ToImage.
ToAlbum.
ToTextField.
ToListElement. }.
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.

ToAlbum and ToListElement are functional ?

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 ?

#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: [ #notUsable ]
ifFalse: [
((allowedClasses includes: class) and: [
serializable ])
ifTrue: [ #ok ]
ifFalse: [ #unstable ] ].
PyramidLibraryElement new
icon:
(Smalltalk ui icons iconNamed: class systemIconName);
(Smalltalk ui icons iconNamed: (status = #notUsable
ifTrue: [ #error ]
ifFalse: [
status = #unstable
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 = #notUsable ].
okElements := elements select: [ :e | e status = #ok ].
unserializedElements := elements select: [ :e |
e status = #unstable ].
^ {
(PyramidLibraryCategory new
name: 'Toplo';
icon: (Smalltalk ui icons iconNamed: #box);
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.

Another icon ? With a check ?

elements: (okElements sorted: [ :a :b | a name < b name ]);
yourself).
(PyramidLibraryCategory new
name: 'Unstable';
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.

Maybe 'Toplo' and 'Unstable' not good names. ''Toplo-Verified' and 'Toplo-Unverified' ?

icon: (Smalltalk ui icons iconNamed: #warning);
elements:
(unserializedElements sorted: [ :a :b | a name < b name ]);
yourself) }
]

{ #category : #adding }
Expand Down
Loading