Skip to content

Commit

Permalink
Merge pull request #62 from OpenSmock/Issue_0040
Browse files Browse the repository at this point in the history
Issue 0040
  • Loading branch information
Nyan11 authored Aug 7, 2023
2 parents 6312e0e + e5590da commit 33c92b9
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 95 deletions.
43 changes: 15 additions & 28 deletions src/Pyramid-Examples/PyramidSimpleExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ PyramidSimpleExamples class >> marble [
"This class has been generated using Pyramid.
By: YannLEGOFF
2023-08-03 15:51:07"
2023-08-07 16:01:14"

<pySTON>
^ '[
Expand Down Expand Up @@ -475,13 +475,7 @@ PyramidSimpleExamples class >> marble [
#geometry : BlEllipseGeometry {
#extent : Point [ 300.0, 300.0 ],
#pathCache : BlPathCache {
#geometry : @14,
#strokedBounds : BlBounds {
#left : 0.0,
#top : 0.0,
#right : 300.0,
#bottom : 300.0
}
#geometry : @14
}
},
#background : BlPaintBackground {
Expand Down Expand Up @@ -523,11 +517,7 @@ PyramidSimpleExamples class >> marble [
#identifier : #innerShadow
}
},
#layout : BlBasicLayout { },
#eventDispatcher : BlElementEventDispatcher {
#owner : @4,
#handlers : [ ]
}
#layout : BlBasicLayout { }
},
BlElement {
#children : BlChildrenArray [ ],
Expand All @@ -542,7 +532,7 @@ PyramidSimpleExamples class >> marble [
#size : 280.0
}
},
#position : Point [ 5, 5 ],
#position : Point [ 4, 4 ],
#margin : @11,
#padding : @11,
#minHeight : 0.0,
Expand All @@ -556,7 +546,7 @@ PyramidSimpleExamples class >> marble [
#geometry : BlEllipseGeometry {
#extent : Point [ 280.0, 280.0 ],
#pathCache : BlPathCache {
#geometry : @41,
#geometry : @38,
#strokedBounds : BlBounds {
#left : 0.0,
#top : 0.0,
Expand Down Expand Up @@ -586,11 +576,7 @@ PyramidSimpleExamples class >> marble [
#identifier : #lightSource
}
},
#layout : @29,
#eventDispatcher : BlElementEventDispatcher {
#owner : @32,
#handlers : [ ]
}
#layout : @28
}
],
#constraints : BlLayoutCommonConstraints {
Expand All @@ -611,7 +597,7 @@ PyramidSimpleExamples class >> marble [
#bottom : 0.0,
#right : 0.0
},
#padding : @61,
#padding : @56,
#minHeight : 0.0,
#minWidth : 0.0,
#maxHeight : @12,
Expand All @@ -623,7 +609,7 @@ PyramidSimpleExamples class >> marble [
#geometry : BlEllipseGeometry {
#extent : Point [ 300.0, 300.0 ],
#pathCache : BlPathCache {
#geometry : @63,
#geometry : @58,
#strokedBounds : BlBounds {
#left : 0.0,
#top : 0.0,
Expand All @@ -634,7 +620,12 @@ PyramidSimpleExamples class >> marble [
},
#background : BlPaintBackground {
#paint : BlColorPaint {
#color : Color [ #red ]
#color : Color {
#red : 0.9296187683284457,
#green : 0.40371456500488756,
#blue : 0.8396871945259042,
#alpha : 1.0
}
}
}
},
Expand All @@ -643,11 +634,7 @@ PyramidSimpleExamples class >> marble [
#identifier : #background
}
},
#layout : BlBasicLayout { },
#eventDispatcher : BlElementEventDispatcher {
#owner : @2,
#handlers : [ ]
}
#layout : BlBasicLayout { }
}
]'
]
Expand Down
32 changes: 26 additions & 6 deletions src/Pyramid/PyramidSaveModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,50 @@ Class {
'savingMethodName',
'savingPackageName',
'classSide',
'isSaved',
'projectModel'
],
#category : #'Pyramid-plugin-save'
}

{ #category : #converting }
PyramidSaveModel >> asTitleString [

| string |
string := '[', self savingClassName ,'] '.
string := self savingClassName.
self isClassSide ifTrue: [ string := string , 'class ' ].
string := string , '>> ' , self savingMethodName.
string := string , '>> #' , self savingMethodName.
self isSaved ifFalse: [ string := string , ' *' ].
^ string
]

{ #category : #converting }
PyramidSaveModel >> initialize [

isSaved := false.
classSide := true.
savingPackageName := ''.
savingClassName := ''.
savingMethodName := ''
]

{ #category : #testing }
PyramidSaveModel >> isClassSide [

classSide ifNil: [ classSide := true ].
^ classSide
]

{ #category : #converting }
PyramidSaveModel >> isSaved [
^ isSaved
]

{ #category : #converting }
PyramidSaveModel >> isSaved: aBoolean [

isSaved := aBoolean
]

{ #category : #testing }
PyramidSaveModel >> onClass [
classSide := true
Expand All @@ -53,7 +76,6 @@ PyramidSaveModel >> projectModel: anObject [
{ #category : #accessing }
PyramidSaveModel >> savingClassName [

savingClassName ifNil: [ savingClassName := '' ].
^ savingClassName
]

Expand All @@ -66,7 +88,6 @@ PyramidSaveModel >> savingClassName: anObject [
{ #category : #accessing }
PyramidSaveModel >> savingMethodName [

savingMethodName ifNil: [ savingMethodName := '' ].
^ savingMethodName
]

Expand All @@ -79,7 +100,6 @@ PyramidSaveModel >> savingMethodName: anObject [
{ #category : #accessing }
PyramidSaveModel >> savingPackageName [

savingPackageName ifNil: [ savingPackageName := '' ].
^ savingPackageName
]

Expand Down
22 changes: 10 additions & 12 deletions src/Pyramid/PyramidSaveModelVerifier.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,30 @@ PyramidSaveModelVerifier class >> packageIsValid [
]

{ #category : #constructor }
PyramidSaveModelVerifier class >> projectNotNil [
PyramidSaveModelVerifier class >> projectModelNotNil [

^ self new
verifyBlock: [ :model | model projectModel isNotNil ];
showBlock: [ :view | view showProjectNilError ];
showBlock: [ :view | view showProjectModelNilError ];
yourself
]

{ #category : #constructor }
PyramidSaveModelVerifier class >> verifierNoError [


^ self modelNotNil addNext: (self projectNotNil
addNext: (self methodIsValid);
addNext: (self packageIsValid addNext: (self classIsValid addNext: (self classPackageIsEqual)))).

^ self modelNotNil addNext: (self projectModelNotNil addNext:
(self methodIsValid addNext: (self packageIsValid addNext:
(self classIsValid addNext: self classPackageIsEqual))))
]

{ #category : #constructor }
PyramidSaveModelVerifier class >> verifierNoErrorForInputsView [

^ self modelNotNil addNext: (self projectNotNil
addNext: self methodIsValid;
addNext: self classIsValid;
addNext: (self packageIsValid addNext:
(self classIsValid addNext: self classPackageIsEqual)))
^ self modelNotNil addNext: (self projectModelNotNil addNext:
self methodIsValid;
addNext: self classIsValid;
addNext: (self packageIsValid addNext:
(self classIsValid addNext: self classPackageIsEqual)))
]

{ #category : #initialization }
Expand Down
36 changes: 24 additions & 12 deletions src/Pyramid/PyramidSavePlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ PyramidSavePlugin class >> openOn: aCollectionOfBlElement saveModel: aSaveModel
Error signal:
'Wrong installation of SavePlugin. Should only be one instance.' ].
savePlugin := savePlugin asArray first.
savePlugin openOn: aSaveModel.
editor projectModel roots addAll: aCollectionOfBlElement.
savePlugin openOn: aSaveModel.
editor window open
]

Expand All @@ -54,7 +54,9 @@ PyramidSavePlugin >> addPanelsOn: aPyramidSimpleWindow [
{ #category : #'as yet unclassified' }
PyramidSavePlugin >> connectOn: aPyramidEditor [

self projectModel: aPyramidEditor projectModel
self projectModel: aPyramidEditor projectModel.
self saveModel projectModel: aPyramidEditor projectModel.
aPyramidEditor projectModel addObserver: self inputsController
]

{ #category : #initialization }
Expand Down Expand Up @@ -105,12 +107,18 @@ PyramidSavePlugin >> inputsView [

{ #category : #'instance creation' }
PyramidSavePlugin >> openOn: aSaveModel [

self inputsView inputClass text: aSaveModel savingClassName.
"self inputsView inputClass text: aSaveModel savingClassName.
self inputsView inputMethod text: aSaveModel savingMethodName.
self inputsView inputPackage text: aSaveModel savingPackageName.
aSaveModel isClassSide ifTrue: [ self inputsView buttonClass click ] ifFalse: [ self inputsView buttonInstance click ]

self inputsView model isSaved: aSaveModel isSaved."

aSaveModel projectModel: self projectModel.
self savingService savingModel: aSaveModel.
self inputsController model: aSaveModel.

aSaveModel isClassSide
ifTrue: [ self inputsView buttonClass click ]
ifFalse: [ self inputsView buttonInstance click ]
]

{ #category : #accessing }
Expand All @@ -123,18 +131,22 @@ PyramidSavePlugin >> projectModel [
PyramidSavePlugin >> projectModel: aPyramidProjectModel [

projectModel := aPyramidProjectModel.
self saveModel projectModel: projectModel.
self inputsController updateView
]

{ #category : #actions }
PyramidSavePlugin >> saveAction [
PyramidSavePlugin >> saveAction [
"Action executed by save button"

[ self savingService save ]
on: PyramidSaveError do: [
^ UIManager default alert: 'Cannot save the project, check project configuration before.' title: 'Error'.
].
[
self savingService save.
self inputsController isSaved ]
on: PyramidSaveError
do: [
^ UIManager default
alert:
'Cannot save the project, check project configuration before.'
title: 'Error' ]
]

{ #category : #accessing }
Expand Down
Loading

0 comments on commit 33c92b9

Please sign in to comment.