Spec2 Pharo8/9; icons

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Spec2 Pharo8/9; icons

eftomi
Dear all,

What would be the best Pharo version to start building a Spec2 GUI for an app - Pharo 9 which is under development but with novelties in Spec2, or Pharo 8?

What's the best (easiest ...) way to import new icons into Smalltalk ui icons? Is there any special bitmap format to be considered?

Thanks and best wishes,
Tomaz
Reply | Threaded
Open this post in threaded view
|

Re: Spec2 Pharo8/9; icons

Stéphane Ducasse
Hello Tomaz

Dear all,

What would be the best Pharo version to start building a Spec2 GUI for an app - Pharo 9 which is under development but with novelties in Spec2, or Pharo 8?

I would go for P9. It may be a bit shaky from time to time but for example you can milestoned your image and if the next one is shaky you wait. 
We are always developing in bleeding edge so eating our own dog food (and p9 has been nice so far). 

Just now we got Spec20 0.6 and it contains many improvements. 
I hope to be able to start to code some mini tutorial (learning myself and writing what I’m learning). 

What's the best (easiest ...) way to import new icons into Smalltalk ui icons? Is there any special bitmap format to be considered?

png is better and there is a library to manage icons
I do not have the name but you can load icons. 
But look around. 


Thanks and best wishes,
Tomaz

--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Julie Jonas 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Reply | Threaded
Open this post in threaded view
|

Re: Spec2 Pharo8/9; icons

eftomi
Thanks, Stephane, I'll switch to P9.

> png is better and there is a library to manage icons
> I do not have the name but you can load icons. 
> But look around. 

For icons I found the necessary code in ThemeIcons>>loadIconsFromUrl. Here's a simplistic approach to load icons from PNGs in a local ZIP archive, if somebody needs it:

| themeIcons newIcons |

newIcons := IdentityDictionary new.
themeIcons := ThemeIcons new.

((FileSystem zip: 'C:\icons\a.zip' asFileReference)
    open workingDirectory allChildrenMatching: '*.png') do:
        [ :each | newIcons
            at: each base asSymbol
            put: (themeIcons readPNGFrom: each )].
newIcons.

Best wishes,
Tomaz
Reply | Threaded
Open this post in threaded view
|

Re: Spec2 Pharo8/9; icons

Stéphane Ducasse
thanks for sharing. I will add it to the chapter Tips of the new book on Spec20 :)

I remember also that there is a project to manage icon sets.

On 20 May 2020, at 21:44, Tomaž Turk <[hidden email]> wrote:

Thanks, Stephane, I'll switch to P9.

> png is better and there is a library to manage icons
> I do not have the name but you can load icons. 
> But look around. 

For icons I found the necessary code in ThemeIcons>>loadIconsFromUrl. Here's a simplistic approach to load icons from PNGs in a local ZIP archive, if somebody needs it:

| themeIcons newIcons |

newIcons := IdentityDictionary new.
themeIcons := ThemeIcons new.

((FileSystem zip: 'C:\icons\a.zip' asFileReference) 
    open workingDirectory allChildrenMatching: '*.png') do:
        [ :each | newIcons 
            at: each base asSymbol
            put: (themeIcons readPNGFrom: each )].
newIcons.

Best wishes,
Tomaz

--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Aurore Dalle 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Reply | Threaded
Open this post in threaded view
|

Re: Spec2 Pharo8/9; icons

eftomi
Hi,

> I remember also that there is a project to manage icon sets.

I found the library - it's ImageForm
(https://github.com/pablo1n7/ImageForm). If you use it, there's no need to
use ThemeIcons>>#readPNGFrom:.

The above code becomes:


To make this example complete:




Best wishes
Tomaz





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Spec2 Pharo8/9; icons

eftomi
I'm sorry, the raw tag at forum.world.st ate the code :-)

| newIcons |

newIcons := IdentityDictionary new.
((FileSystem zip: 'C:\icons\a.zip' asFileReference)
    open workingDirectory allChildrenMatching: '*.png') do:
        [ :each | newIcons
            at: each base asSymbol
            put: (ImageForm open: each )].

SpToolBarButton new
   label: 'Go!';
   icon: (newIcons at: #iconFileName).


Tomaz
Reply | Threaded
Open this post in threaded view
|

Re: Spec2 Pharo8/9; icons

Stéphane Ducasse
In recent spec2 (head) we added support so that an application can have an iconProvider so it means that you can 
using the ThemeIcons load and manage a set of icons for your application.


On 27 May 2020, at 20:54, Tomaž Turk <[hidden email]> wrote:

I'm sorry, the raw tag at forum.world.st ate the code :-)

| newIcons |

newIcons := IdentityDictionary new.
((FileSystem zip: 'C:\icons\a.zip' asFileReference) 
    open workingDirectory allChildrenMatching: '*.png') do:
        [ :each | newIcons 
            at: each base asSymbol
            put: (ImageForm open: each )].

SpToolBarButton new 
   label: 'Go!';
   icon: (newIcons at: #iconFileName).


Tomaz

--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Aurore Dalle 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Reply | Threaded
Open this post in threaded view
|

Re: Spec2 Pharo8/9; icons

eftomi
> In recent spec2 (head) we added support so that an application can have an iconProvider so it means that you can
> using the ThemeIcons load and manage a set of icons for your application.

This is great, thanks!

Best wishes
Tomaz