diff --git a/src/Pyramid-Examples/PyramidSimpleExamples.class.st b/src/Pyramid-Examples/PyramidSimpleExamples.class.st new file mode 100644 index 00000000..16825723 --- /dev/null +++ b/src/Pyramid-Examples/PyramidSimpleExamples.class.st @@ -0,0 +1,437 @@ +Class { + #name : #PyramidSimpleExamples, + #superclass : #Object, + #category : #'Pyramid-Examples' +} + +{ #category : #'pyramid-serialized-bloc' } +PyramidSimpleExamples class >> little_cat [ + "This class has been generated using Pyramid. + + By: YannLEGOFF + 2023-07-27 12:03:13" + + + ^ '[ + BlElement { + #children : BlChildrenArray [ + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 50.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : @8 + }, + #position : Point [ 200, 80 ], + #margin : BlInsets { + #top : 0.0, + #left : 0.0, + #bottom : 0.0, + #right : 0.0 + }, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : Float [ #infinity ], + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : Color [ #green ] + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #eyeLeft + } + }, + #layout : BlBasicLayout { }, + #eventDispatcher : BlElementEventDispatcher { + #owner : @4, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : @8 + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : @8 + }, + #position : Point [ 20, 80 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : @16 + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #eyeRight + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @22, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 10.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 200.0 + } + }, + #position : Point [ 0.0, 0.0 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : Color [ #blue ] + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #mustach1 + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @37, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 10.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 200.0 + } + }, + #position : Point [ 0, 20 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : @16 + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #mustach2 + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @53, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 10.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 200.0 + } + }, + #position : Point [ 0, 40 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : @16 + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #mustach3 + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @68, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 10.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 200.0 + } + }, + #position : Point [ -200, 0 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : @16 + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #mustach4 + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @83, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 10.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 200.0 + } + }, + #position : Point [ -200, 20 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : @16 + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #mustach5 + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @98, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 10.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 200.0 + } + }, + #position : Point [ -200, 40 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : @16 + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #mustach6 + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @113, + #handlers : [ ] + } + } + ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : @8 + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : @8 + }, + #position : Point [ 100, 150 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : @48 + } + }, + #clipChildren : false + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #nose + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @35, + #handlers : [ ] + } + } + ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 300.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 300.0 + } + }, + #position : Point [ 0.0, 1.0 ], + #margin : @11, + #padding : @11, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @12, + #maxWidth : @12, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #geometry : BlEllipseGeometry { + #extent : Point [ 300.0, 300.0 ], + #pathCache : BlPathCache { + #geometry : @146, + #strokedBounds : BlBounds { + #left : 0.0, + #top : 0.0, + #right : 300.0, + #bottom : 300.0 + } + } + }, + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : Color [ #red ] + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #background + } + }, + #layout : @19, + #eventDispatcher : BlElementEventDispatcher { + #owner : @2, + #handlers : [ ] + } + } +]' +] diff --git a/src/Pyramid-Examples/package.st b/src/Pyramid-Examples/package.st new file mode 100644 index 00000000..0b6144d4 --- /dev/null +++ b/src/Pyramid-Examples/package.st @@ -0,0 +1 @@ +Package { #name : #'Pyramid-Examples' } diff --git a/src/Pyramid/PyramidVisualPystonForCly.class.st b/src/Pyramid/PyramidVisualPystonForCly.class.st index 4907e0ed..d20c54aa 100644 --- a/src/Pyramid/PyramidVisualPystonForCly.class.st +++ b/src/Pyramid/PyramidVisualPystonForCly.class.st @@ -77,6 +77,7 @@ PyramidVisualPystonForCly >> belongsToRemovedBrowserContext [ PyramidVisualPystonForCly >> build [ | buttonEditor buttonOpen | + self cellInset: 5. buttonEditor := self buttonEditor. buttonOpen := self buttonOpen. blElement := self getStonFromMethod materializeAsBlElement. @@ -94,15 +95,22 @@ PyramidVisualPystonForCly >> build [ { #category : #'as yet unclassified' } PyramidVisualPystonForCly >> buttonEditor [ + ^ self buttonLabel: 'Edit' help: 'Open the design in Pyramid' action: [ self openEditor ]. + +] + +{ #category : #'as yet unclassified' } +PyramidVisualPystonForCly >> buttonLabel: aLabel help: aString action: aBlock [ + | button | - button := SimpleButtonMorph newWithLabel: 'Edit'. + button := SimpleButtonMorph newWithLabel: aLabel. + button actionSelector: #value; - helpText: 'Open the PyEditor on this STON'; - extent: 100 @ 25; - useRoundedCorners; - color: Color white. - button target: [ self openEditor ]. + helpText: aString; + extent: 200 @ 25; + themeChanged; + target: aBlock. ^ button ] @@ -110,17 +118,11 @@ PyramidVisualPystonForCly >> buttonEditor [ { #category : #'as yet unclassified' } PyramidVisualPystonForCly >> buttonOpen [ - | button | - button := SimpleButtonMorph newWithLabel: 'Open'. - button - actionSelector: #value; - helpText: 'Open the this STON in new space'; - extent: 100 @ 25; - useRoundedCorners; - color: Color white. - button target: [ self openInNewSpace ]. + ^ self + buttonLabel: 'Open in new Space' + help: 'Open this design in a new BlSpace' + action: [ self openInNewSpace ] - ^ button ] { #category : #initialization } @@ -132,7 +134,7 @@ PyramidVisualPystonForCly >> defaultIconName [ { #category : #initialization } PyramidVisualPystonForCly >> defaultTitle [ - ^ 'Bloc preview' + ^ 'Pyramid preview' ] { #category : #controlling } @@ -144,14 +146,14 @@ PyramidVisualPystonForCly >> detachFromSystem [ { #category : #'as yet unclassified' } PyramidVisualPystonForCly >> getStonFromMethod [ - ^(method literals select: [ :e | e isString ]) first. + ^ (method valueWithReceiver: self arguments: { }) + ] { #category : #testing } PyramidVisualPystonForCly >> isSimilarTo: anotherBrowserTool [ (super isSimilarTo: anotherBrowserTool) ifFalse: [ ^ false ]. - ^ self method = anotherBrowserTool method ] @@ -212,18 +214,13 @@ PyramidVisualPystonForCly >> resetStateForSnapshot [ { #category : #initialization } PyramidVisualPystonForCly >> setUpModelFromContext [ - method := context firstSelectedMethod. - "blElement := self getStonFromMethod materializeAsBlElement. - blElement isCollection ifTrue: [ - blElement := BlElement new - addChildren: blElement; - size: 1500 @ 1500; - yourself ]" + method := context firstSelectedMethod ] { #category : #updating } PyramidVisualPystonForCly >> update [ + super update. method := method origin localMethodNamed: method selector ifAbsent: [ ^ self ]. @@ -234,7 +231,5 @@ PyramidVisualPystonForCly >> update [ size: 1500 @ 1500; yourself ]. - super update. - imageMorph form: blElement exportAsForm ]