Skip to content

Commit

Permalink
add postConstructionBlock for the proxies to fix material fix size image
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyan11 committed Jul 31, 2024
1 parent ed14963 commit b417590
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/Pyramid-Toplo-Examples/PyramidToploExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ PyramidToploExamples class >> icons2 [
"This class has been generated using Pyramid.
By: YannLEGOFF
2024-07-30 18:25:18"
2024-07-31 10:27:35"

<pyStash>
^ [ {(ToImage new
Expand All @@ -649,14 +649,16 @@ PyramidToploExamples class >> icons2 [
arguments: {(PyramidExternalRessourceProxy new
pyramidExternalRessourceSource: (PyramidExternalRessourceSource new
target: ToMaterialDesignIconProvider;
selector: #round_timelapse;
selector: #twotone_mediation;
arguments: {};
yourself);
yourself)};
postConstructionBlock: [:obj | obj constraints horizontal matchParent.
obj constraints vertical matchParent ];
yourself);
yourself);
constraintsDo: [:constraints | constraints horizontal exact: 200.0.
constraints vertical exact: 200.0 ];
constraintsDo: [:constraints | constraints horizontal exact: 128.0.
constraints vertical exact: 128.0 ];
layout: BlFrameLayout new;
id: #A;
yourself)} ] value
Expand Down
5 changes: 5 additions & 0 deletions src/Pyramid-Toplo/PyramidToploThemePlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ PyramidToploThemePlugin class >> toploIconThemeCategoryFromClass: aClass withCat
(PyramidExternalRessourceProxy new
pyramidExternalRessourceSource:
(PyramidExternalRessourceSource new
postConstructionBlock: [ :obj |
obj constraints horizontal
matchParent.
obj constraints vertical
matchParent ];
target: BlSvgConverter;
selector: #convertFromString:;
arguments:
Expand Down
32 changes: 28 additions & 4 deletions src/Pyramid/PyramidExternalRessourceSource.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Class {
#instVars : [
'target',
'selector',
'arguments'
'arguments',
'postConstructionBlock'
],
#category : #'Pyramid-external-ressources'
}
Expand Down Expand Up @@ -63,13 +64,31 @@ PyramidExternalRessourceSource >> fromSton: stonReader [
{ #category : #'as yet unclassified' }
PyramidExternalRessourceSource >> getRessource [

^ self target perform: self selector withArguments: self arguments
| ressource |
ressource := self target
perform: self selector
withArguments: self arguments.
self postConstructionBlock ifNotNil: [ :block | block value: ressource ].
^ ressource
]

{ #category : #initialization }
PyramidExternalRessourceSource >> initialize [

arguments := { }
arguments := { }.
postConstructionBlock := nil.
]

{ #category : #accessing }
PyramidExternalRessourceSource >> postConstructionBlock [

^ postConstructionBlock
]

{ #category : #accessing }
PyramidExternalRessourceSource >> postConstructionBlock: anObject [

postConstructionBlock := anObject
]

{ #category : #accessing }
Expand All @@ -88,7 +107,12 @@ PyramidExternalRessourceSource >> selector: anObject [
PyramidExternalRessourceSource >> stashAccessors [

<stashAccessors>
^ { #target . #selector . #arguments }
| accessors |
accessors := OrderedCollection new.
accessors addAll: { #target. #selector. #arguments }.
self postConstructionBlock ifNotNil: [
accessors add: #postConstructionBlock ].
^ accessors
]

{ #category : #'as yet unclassified' }
Expand Down

0 comments on commit b417590

Please sign in to comment.