Re: [Pharo-users] Dynamic shapes for RTEdgeBuilder

2018-04-02 Thread Alexandre Bergel
Hi Andrei,

Indeed, this is a limitation we did not see when we designed RTShapeBuilder and 
RTEdgeBuilder.
Currently, you cannot select the shape based on some properties.

Cheers,
Alexandre

> On Apr 2, 2018, at 3:55 PM, Andrei Stebakov  wrote:
> 
> If I want to select edge shape (solid vs dashed line) based on the property 
> of the "to" element, what technique can I use?
> Currently it looks like #shape method of RTEdgeBuilder only allows to specify 
> a singe shape for all edges.




Re: [Pharo-users] unsolicited package-cache use

2018-04-02 Thread Thierry Goubier

Hi Hilaire,

a BaselineOf is the same as a baseline method in a ConfigurationOf: a 
list of packages with their prerequisites and groups.


What the BaselineOf does not contain are methods describing versions 
with package versions and author names; instead, what a BaselineOf says 
is: fetch the latest(*) version(**) of each package I have listed in my 
baseline from the repository you found me in(***).


Thierry

(*) if there is more than one. With git, only one, with smalltalkhub, 
more than one.


(**) a repository is supposed to contain package versions, even if that 
version is -cypress.1 (metadata-less filetree).


(***) A repository here is a http one (i.e. smalltalkhub), a directory 
in a branch in git, a tag in git, a directory on disk, a ftp directory, 
etc...


PS: the power of Baselines + Git comes from the fact that you get a 
repository per branch / per tag.


PS2: it is possible to have multiple repositories, and rewrite as 
"latest version ... in the repositories... ". I have a use case or two 
for that feature.


Le 02/04/2018 à 15:46, Hilaire a écrit :

Hi Dale,

Sorry to reply very lately to your help email, I am getting slow on 
Pharo those those days.


I am afraid to be a bit out of sync: what is a BaselineOf? I only have a 
ConfigurationOfDrGeo and baseline methods into.


Hilaire


Le 18/01/2018 à 16:10, Dale Henrichs a écrit :


Hilaire,

Have you included a method in your BaselineOf that looks like this:

    projectClass

        ^ MetacelloCypressBaselineProject

if not, then what looks like a package-cache problem could be that you 
haven't told Metacello that you are using a metadataless 
filetree/tonel repository.


Metacello has an internal rule to not load Monticello packages of the 
same version, since they are already loaded. However, when using 
metadataless repositories the filetree/tonel Monticello package 
readers typically generate a package name using the author/version 
`-cypress.1`, which make Metacello think that the versions are the 
same and the package is not loaded ... by including the above method 
in your baselineof, Metacello will know to ignore the Monticello 
author/version of the package and always load it


Of course, because Monticello only installs changed definitions when 
loading a package, "loading the same package over and over again" 
costs a little bit in loading the _definitions_ into the image from 
disk, but doesn't end up compiling any new methods or creating new 
classes ...


Dale

On 1/18/18 6:49 AM, Hilaire wrote:
It was a month ago; I don't remember the details but from what I can 
recover from my memory the scenario was:


- From my dev. environment I saved code through Tonel, in the DrGeo 
used CVS.


- When building, I specifically ask the code saved thought Tonel to 
be installed but the package-cache code version was used instead. It 
could be out of sync.



Le 18/01/2018 à 15:22, Dale Henrichs a écrit :

Hilaire,

Metacello just uses Monticello for loading and it is Monticello that 
is using the package-cache ... if there were a way to turn of the 
package-cache for Monticello I don't think that Metacello would know 
the difference.


But, I am curious why you care whether or not package is used?

Is there a specific problem that you are having?

Dale 









Re: [Pharo-users] unsolicited package-cache use

2018-04-02 Thread Hilaire

Reading the BaselineOf class comment, will start with that..


Le 02/04/2018 à 21:13, Hilaire a écrit :
My needs are simple, but still I don't understand what I should do 
from my ConfigurationOfDrGeo


--
Dr. Geo
http://drgeo.eu





Re: [Pharo-users] How to #currentVersion from a Configuration

2018-04-02 Thread Hilaire

May be old ConfigurationOf breaks on some part

I only added a baseline to my configuration:

baseline1801: spec
    

    spec for: #common do: [
        spec blessing: #baseline;
            repository: repoPath;
            description: 'Dr. Geo, an interactive geometry application.';
            author: 'HilaireFernandes'.

        spec project: 'XML Parser' with: [
            spec className: 'ConfigurationOfXMLSupport';
            version: '1.0.1';
            loads: #('default');
            file: 'ConfigurationOfXMLSupport';
            repository: repoPath].

        spec
repository:'http://smalltalkhub.com/mc/PharoExtras/Gettext/main/';
            package: 'Gettext' with: 'Gettext-EstebanLorenzano.35'.

        spec package: 'DrGeoII-Core' with: [spec requires: #('XML 
Parser' 'Gettext')].


        spec group: 'release' with: #('DrGeoII-Core' 'DrGeo-French' 
'DrGeoII-Polymorph' 'DrGeoII-User' 'DrGeoII-Installer');

            group: 'default' with: 'release';
            group: 'development' with: #('release' 'DrGeoII-Test').

        ]

And modified its initialize so it looks to the tonel repo:

initialize
    super initialize.
    repoPath := 'tonel://', SmalltalkImage current imageDirectory 
pathString, '/src'



Le 02/04/2018 à 19:55, Stephane Ducasse a écrit :

In my pharo 6.1 image I have

currentVersion
| cacheKey cv |
cacheKey := self configuration class.
^ MetacelloPlatform current
stackCacheFor: #currentVersion
at: cacheKey
doing: [ :cache |
cv := self currentVersionAgainst: nil.
^ cache at: cacheKey put: cv ]

And we do not change the code that Dale release and he is making sure
that old code is working so this is strange.

Stef



--
Dr. Geo
http://drgeo.eu





Re: [Pharo-users] unsolicited package-cache use

2018-04-02 Thread Hilaire
My needs are simple, but still I don't understand what I should do from 
my ConfigurationOfDrGeo



Le 02/04/2018 à 19:53, Stephane Ducasse a écrit :

Hilaire

A BaselineOf is the equivalent in better to a  ConifgurationOf
The key benefit is that you just specify a kind of ConfigurationOf
baseline and you are done
No need to express manually versions.

With a baseline you can get branches, a specific hash
So you have all the power but with less burden.

Side: I do not like the git API but I coding with git and the branches
are really really nice.
You can have multiple versions
  - release
  - dev
   - dev + a features and simply manage it

So git is really a plus
With Iceberg 20, you will also be able to manage external ressources
(icons, text...)
and this is cool

Stef





--
Dr. Geo
http://drgeo.eu





[Pharo-users] Dynamic shapes for RTEdgeBuilder

2018-04-02 Thread Andrei Stebakov
If I want to select edge shape (solid vs dashed line) based on the property
of the "to" element, what technique can I use?
Currently it looks like #shape method of RTEdgeBuilder only allows to
specify a singe shape for all edges.


Re: [Pharo-users] Quick way to switch from playground to system browser

2018-04-02 Thread Stephane Ducasse
Yes define a test and you can press the green button.
Else you can also define a class side method and it you tage it with

XX class>> foo

  ^ self new.


you will get an inspector in the returned object

On Mon, Apr 2, 2018 at 7:48 PM, Andrei Stebakov  wrote:
> I wonder if there is a best practice for modifying code in you class in
> system browser and testing the behavior in the playground.
> The way I do it, I have to type the code, use the mouse to find and switch
> to the playground and then execute some code in it.
> Is there a more ergonomic way to modify/test the new code?



Re: [Pharo-users] How to #currentVersion from a Configuration

2018-04-02 Thread Stephane Ducasse
In my pharo 6.1 image I have

currentVersion
| cacheKey cv |
cacheKey := self configuration class.
^ MetacelloPlatform current
stackCacheFor: #currentVersion
at: cacheKey
doing: [ :cache |
cv := self currentVersionAgainst: nil.
^ cache at: cacheKey put: cv ]

And we do not change the code that Dale release and he is making sure
that old code is working so this is strange.

Stef



On Mon, Apr 2, 2018 at 3:03 PM, Hilaire  wrote:
> Hello,
>
> I use to do perform this code to get the installed version from a
> ConfigurationOfDrGeo:
>
> drgeoVersion
> ^ 'Installed version: ', ConfigurationOfDrGeo new project currentVersion
> versionNumber versionString
>
> It does not work anymore, and produce the following error stack
>
> Any idea?
>
> Hilaire
>
>
> MetacelloMCVersionSpec(Object)>>error:
> [ ^ self error: 'Name not found: ' , aString ] in
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpec:forLoad:forMap:packages:
> in Block: [ ^ self error: 'Name not found: ' , aString ]
> [ (self importArray notNil or: [ self import notNil ])
> ifTrue:
> [ "expect the 'missing' name to be satisfied within context of
> imported project"
> importArray
> ifNotNil: [ importArray
> do: [ :assoc |
> ((assoc value includes: aString) and: [ map
> includesKey: assoc key ])
> ifTrue: [ importSpec := (map at: assoc key)
> mergeImportLoads: {aString};
> yourself ] ].
> importSpec ifNotNil: [ ^ importSpec ] ].
> (importSpec isNil and: [ self import notNil ])
> ifTrue: [ ^ (map at: self import ifAbsent: absentBlock)
> mergeImportLoads: {aString};
> yourself ] ].
> (aString = 'default' or: [ aString = 'ALL' ])
> ifTrue: [ self project groupSpec
> name: aString;
> includes: self packageNames;
> yourself ]
> ifFalse: [ absentBlock value ] ] in
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>packageNamed:forLoad:forMap:ifAbsent:
> in Block: [ (self importArray notNil or: [ self import notNi...etc...
> Dictionary>>at:ifAbsent:
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>packageNamed:forLoad:forMap:ifAbsent:
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpec:forLoad:forMap:packages:
> [ :req |
> (self
> resolveToLoadableSpec: req
> forLoad: forLoad
> forMap: map
> packages: packageMap)
> do: [ :loadableSpec |
> newReqd addAll: loadableSpec requires.
> newReqd addAll: loadableSpec includes ] ] in
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpecs:forLoad:map:
> in Block: [ :req | ...
> Set>>do:
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpecs:forLoad:map:
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpecs:
> [ :cache |
> names := (self resolveToLoadableSpecs: nameList)
> collect: [ :spec | spec name ].
> cache at: cacheKey put: names ] in
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>expandToLoadableSpecNames: in
> Block: [ :cache | ...
> [ :dict |
> | cache |
> cache := dict at: cacheName ifAbsent: [  ].
> cache ~~ nil
> ifTrue: [ | value hasEntry |
> hasEntry := true.
> value := cache at: key ifAbsent: [ hasEntry := false ].
> hasEntry
> ifTrue: [ ^ value ] ]
> ifFalse: [ cache := cacheClass new.
> dict at: cacheName put: cache ].
> ^ aBlock value: cache ] in
> IceMetacelloPharoPlatform(MetacelloPlatform)>>stackCacheFor:cacheClass:at:doing:
> in Block: [ :dict | ...
> [ ^ aBlock value: dict ] in
> IceMetacelloPharoPlatform(MetacelloPlatform)>>useStackCacheDuring:defaultDictionary:
> in Block: [ ^ aBlock value: dict ]
> BlockClosure>>on:do:
> IceMetacelloPharoPlatform(MetacelloPlatform)>>useStackCacheDuring:defaultDictionary:
> IceMetacelloPharoPlatform(MetacelloPlatform)>>stackCacheFor:cacheClass:at:doing:
> IceMetacelloPharoPlatform(MetacelloPlatform)>>stackCacheFor:at:doing:
> MetacelloMCVersionSpec(MetacelloVersionSpec)>>expandToLoadableSpecNames:
> MetacelloMCVersionSpec>>isPartiallyCurrent
> [ :version |
> | status matchBlock |
> status := resolvedPackageAndProjectNames isNil
> ifTrue: [ version spec isPartiallyCurrent ]
> ifFalse: [ version spec
> isPartiallyCurrentAgainst: resolvedPackageAndProjectNames ].
> matchBlock := [ :matchStatus |
> cv := version copy.
> cv versionStatus: matchStatus.
> ^ cache at: cacheKey put: cv ].
> status isAllLoadedToSpec: matchBlock.
> status isLoadedToSpec: matchBlock.
> status isLoadedMatchConstraints: matchBlock.
> status
> isSomethingLoaded: [ :matchStatus |
> latestSomethingLoaded isNil
> ifTrue: [ cv := version copy.
> cv versionStatus: matchStatus.
> latestSomethingLoaded := cv ] ] ] in [ :cache |
> | cv versions 

Re: [Pharo-users] unsolicited package-cache use

2018-04-02 Thread Stephane Ducasse
Hilaire

A BaselineOf is the equivalent in better to a  ConifgurationOf
The key benefit is that you just specify a kind of ConfigurationOf
baseline and you are done
No need to express manually versions.

With a baseline you can get branches, a specific hash
So you have all the power but with less burden.

Side: I do not like the git API but I coding with git and the branches
are really really nice.
You can have multiple versions
 - release
 - dev
  - dev + a features and simply manage it

So git is really a plus
With Iceberg 20, you will also be able to manage external ressources
(icons, text...)
and this is cool

Stef






-- Forwarded message --
From: Hilaire 
Date: Mon, Apr 2, 2018 at 3:46 PM
Subject: Re: [Pharo-users] unsolicited package-cache use
To: pharo-users@lists.pharo.org


Hi Dale,

Sorry to reply very lately to your help email, I am getting slow on
Pharo those those days.

I am afraid to be a bit out of sync: what is a BaselineOf? I only have
a ConfigurationOfDrGeo and baseline methods into.

Hilaire


Le 18/01/2018 à 16:10, Dale Henrichs a écrit :
>
>
> Hilaire,
>
> Have you included a method in your BaselineOf that looks like this:
>
> projectClass
>
> ^ MetacelloCypressBaselineProject
>
> if not, then what looks like a package-cache problem could be that you 
> haven't told Metacello that you are using a metadataless filetree/tonel 
> repository.
>
> Metacello has an internal rule to not load Monticello packages of the same 
> version, since they are already loaded. However, when using metadataless 
> repositories the filetree/tonel Monticello package readers typically generate 
> a package name using the author/version `-cypress.1`, which make Metacello 
> think that the versions are the same and the package is not loaded ... by 
> including the above method in your baselineof, Metacello will know to ignore 
> the Monticello author/version of the package and always load it
>
> Of course, because Monticello only installs changed definitions when loading 
> a package, "loading the same package over and over again" costs a little bit 
> in loading the _definitions_ into the image from disk, but doesn't end up 
> compiling any new methods or creating new classes ...
>
> Dale
>
> On 1/18/18 6:49 AM, Hilaire wrote:
>>
>> It was a month ago; I don't remember the details but from what I can recover 
>> from my memory the scenario was:
>>
>> - From my dev. environment I saved code through Tonel, in the DrGeo used CVS.
>>
>> - When building, I specifically ask the code saved thought Tonel to be 
>> installed but the package-cache code version was used instead. It could be 
>> out of sync.
>>
>>
>> Le 18/01/2018 à 15:22, Dale Henrichs a écrit :
>>>
>>> Hilaire,
>>>
>>> Metacello just uses Monticello for loading and it is Monticello that is 
>>> using the package-cache ... if there were a way to turn of the 
>>> package-cache for Monticello I don't think that Metacello would know the 
>>> difference.
>>>
>>> But, I am curious why you care whether or not package is used?
>>>
>>> Is there a specific problem that you are having?
>>>
>>> Dale
>>
>>

--
Dr. Geo
http://drgeo.eu



[Pharo-users] Quick way to switch from playground to system browser

2018-04-02 Thread Andrei Stebakov
I wonder if there is a best practice for modifying code in you class in
system browser and testing the behavior in the playground.
The way I do it, I have to type the code, use the mouse to find and switch
to the playground and then execute some code in it.
Is there a more ergonomic way to modify/test the new code?


Re: [Pharo-users] unsolicited package-cache use

2018-04-02 Thread Hilaire

Hi Dale,

Sorry to reply very lately to your help email, I am getting slow on 
Pharo those those days.


I am afraid to be a bit out of sync: what is a BaselineOf? I only have a 
ConfigurationOfDrGeo and baseline methods into.


Hilaire


Le 18/01/2018 à 16:10, Dale Henrichs a écrit :


Hilaire,

Have you included a method in your BaselineOf that looks like this:

projectClass

    ^ MetacelloCypressBaselineProject

if not, then what looks like a package-cache problem could be that you 
haven't told Metacello that you are using a metadataless 
filetree/tonel repository.


Metacello has an internal rule to not load Monticello packages of the 
same version, since they are already loaded. However, when using 
metadataless repositories the filetree/tonel Monticello package 
readers typically generate a package name using the author/version 
`-cypress.1`, which make Metacello think that the versions are the 
same and the package is not loaded ... by including the above method 
in your baselineof, Metacello will know to ignore the Monticello 
author/version of the package and always load it


Of course, because Monticello only installs changed definitions when 
loading a package, "loading the same package over and over again" 
costs a little bit in loading the _definitions_ into the image from 
disk, but doesn't end up compiling any new methods or creating new 
classes ...


Dale

On 1/18/18 6:49 AM, Hilaire wrote:
It was a month ago; I don't remember the details but from what I can 
recover from my memory the scenario was:


- From my dev. environment I saved code through Tonel, in the DrGeo 
used CVS.


- When building, I specifically ask the code saved thought Tonel to 
be installed but the package-cache code version was used instead. It 
could be out of sync.



Le 18/01/2018 à 15:22, Dale Henrichs a écrit :

Hilaire,

Metacello just uses Monticello for loading and it is Monticello that 
is using the package-cache ... if there were a way to turn of the 
package-cache for Monticello I don't think that Metacello would know 
the difference.


But, I am curious why you care whether or not package is used?

Is there a specific problem that you are having?

Dale 




--
Dr. Geo
http://drgeo.eu





[Pharo-users] How to #currentVersion from a Configuration

2018-04-02 Thread Hilaire

Hello,

I use to do perform this code to get the installed version from a 
ConfigurationOfDrGeo:


drgeoVersion
    ^ 'Installed version: ', ConfigurationOfDrGeo new project 
currentVersion versionNumber versionString


It does not work anymore, and produce the following error stack

Any idea?

Hilaire


MetacelloMCVersionSpec(Object)>>error:
[ ^ self error: 'Name not found: ' , aString ] in 
MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpec:forLoad:forMap:packages: 
in Block: [ ^ self error: 'Name not found: ' , aString ]

[ (self importArray notNil or: [ self import notNil ])
    ifTrue:
        [ "expect the 'missing' name to be satisfied within context of 
imported project"

        importArray
            ifNotNil: [ importArray
                    do: [ :assoc |
                        ((assoc value includes: aString) and: [ map 
includesKey: assoc key ])

                            ifTrue: [ importSpec := (map at: assoc key)
                                    mergeImportLoads: {aString};
                                    yourself ] ].
                importSpec ifNotNil: [ ^ importSpec ] ].
        (importSpec isNil and: [ self import notNil ])
            ifTrue: [ ^ (map at: self import ifAbsent: absentBlock)
                    mergeImportLoads: {aString};
                    yourself ] ].
(aString = 'default' or: [ aString = 'ALL' ])
    ifTrue: [ self project groupSpec
            name: aString;
            includes: self packageNames;
            yourself ]
    ifFalse: [ absentBlock value ] ] in 
MetacelloMCVersionSpec(MetacelloVersionSpec)>>packageNamed:forLoad:forMap:ifAbsent: 
in Block: [ (self importArray notNil or: [ self import notNi...etc...

Dictionary>>at:ifAbsent:
MetacelloMCVersionSpec(MetacelloVersionSpec)>>packageNamed:forLoad:forMap:ifAbsent:
MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpec:forLoad:forMap:packages:
[ :req |
(self
    resolveToLoadableSpec: req
    forLoad: forLoad
    forMap: map
    packages: packageMap)
    do: [ :loadableSpec |
        newReqd addAll: loadableSpec requires.
        newReqd addAll: loadableSpec includes ] ] in 
MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpecs:forLoad:map: 
in Block: [ :req | ...

Set>>do:
MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpecs:forLoad:map:
MetacelloMCVersionSpec(MetacelloVersionSpec)>>resolveToLoadableSpecs:
[ :cache |
names := (self resolveToLoadableSpecs: nameList)
    collect: [ :spec | spec name ].
cache at: cacheKey put: names ] in 
MetacelloMCVersionSpec(MetacelloVersionSpec)>>expandToLoadableSpecNames: 
in Block: [ :cache | ...

[ :dict |
| cache |
cache := dict at: cacheName ifAbsent: [  ].
cache ~~ nil
    ifTrue: [ | value hasEntry |
        hasEntry := true.
        value := cache at: key ifAbsent: [ hasEntry := false ].
        hasEntry
            ifTrue: [ ^ value ] ]
    ifFalse: [ cache := cacheClass new.
        dict at: cacheName put: cache ].
^ aBlock value: cache ] in 
IceMetacelloPharoPlatform(MetacelloPlatform)>>stackCacheFor:cacheClass:at:doing: 
in Block: [ :dict | ...
[ ^ aBlock value: dict ] in 
IceMetacelloPharoPlatform(MetacelloPlatform)>>useStackCacheDuring:defaultDictionary: 
in Block: [ ^ aBlock value: dict ]

BlockClosure>>on:do:
IceMetacelloPharoPlatform(MetacelloPlatform)>>useStackCacheDuring:defaultDictionary:
IceMetacelloPharoPlatform(MetacelloPlatform)>>stackCacheFor:cacheClass:at:doing:
IceMetacelloPharoPlatform(MetacelloPlatform)>>stackCacheFor:at:doing:
MetacelloMCVersionSpec(MetacelloVersionSpec)>>expandToLoadableSpecNames:
MetacelloMCVersionSpec>>isPartiallyCurrent
[ :version |
| status matchBlock |
status := resolvedPackageAndProjectNames isNil
    ifTrue: [ version spec isPartiallyCurrent ]
    ifFalse: [ version spec
            isPartiallyCurrentAgainst: resolvedPackageAndProjectNames ].
matchBlock := [ :matchStatus |
cv := version copy.
cv versionStatus: matchStatus.
^ cache at: cacheKey put: cv ].
status isAllLoadedToSpec: matchBlock.
status isLoadedToSpec: matchBlock.
status isLoadedMatchConstraints: matchBlock.
status
    isSomethingLoaded: [ :matchStatus |
        latestSomethingLoaded isNil
            ifTrue: [ cv := version copy.
                cv versionStatus: matchStatus.
                latestSomethingLoaded := cv ] ] ] in [ :cache |
| cv versions latestSomethingLoaded |
cv := nil.
versions := self sortedAndFilteredVersions.
versions
    do: [ :version |
        | status matchBlock |
        status := resolvedPackageAndProjectNames isNil
            ifTrue: [ version spec isPartiallyCurrent ]
            ifFalse: [ version spec
                    isPartiallyCurrentAgainst: 
resolvedPackageAndProjectNames ].

        matchBlock := [ :matchStatus |
        cv := version copy.
        cv versionStatus: matchStatus.
        ^ cache at: cacheKey put: cv ].
        status isAllLoadedToSpec: matchBlock.
        status isLoadedToSpec: matchBlock.
        status