-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/PharoLauncher-Spec2/PhLPharoVersionChooserPresenter.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
" | ||
I'm a simple presenter to fix the version of a Pharo image when no version file exists. | ||
" | ||
Class { | ||
#name : #PhLPharoVersionChooserPresenter, | ||
#superclass : #SpPresenterWithModel, | ||
#traits : 'TPhLInteractionTrait', | ||
#classTraits : 'TPhLInteractionTrait classTrait', | ||
#instVars : [ | ||
'versionTable' | ||
], | ||
#category : #'PharoLauncher-Spec2' | ||
} | ||
|
||
{ #category : #examples } | ||
PhLPharoVersionChooserPresenter class >> example [ | ||
|
||
^ self new | ||
openDialog; | ||
yourself | ||
] | ||
|
||
{ #category : #layout } | ||
PhLPharoVersionChooserPresenter >> defaultLayout [ | ||
^ SpBoxLayout newHorizontal | ||
add: versionTable; | ||
yourself | ||
] | ||
|
||
{ #category : #initialization } | ||
PhLPharoVersionChooserPresenter >> initializePresenters [ | ||
versionTable := self newTable | ||
addColumn: ((SpStringTableColumn title: 'Pharo version' evaluated: #key) width: 100; yourself); | ||
addColumn: ((SpStringTableColumn | ||
title: 'version string' | ||
evaluated: #value) width: 60; yourself); | ||
showColumnHeaders; | ||
items: self pharoVersions; | ||
yourself | ||
] | ||
|
||
{ #category : #initialization } | ||
PhLPharoVersionChooserPresenter >> initializeWindow: aWindowPresenter [ | ||
|
||
aWindowPresenter | ||
title: 'Choose the Pharo version of the image:'; | ||
initialExtent: 300@300; | ||
centered | ||
] | ||
|
||
{ #category : #accessing } | ||
PhLPharoVersionChooserPresenter >> pharoVersions [ | ||
| maxPharoVersion versions | | ||
maxPharoVersion := 12. | ||
versions := (#(1.2 1.3 1.4) copyWithAll: (2 to: maxPharoVersion)) reversed. | ||
|
||
^ versions collect: [ :v | 'Pharo ', v asString -> (v * 10) asInteger asString] | ||
] | ||
|
||
{ #category : #versions } | ||
PhLPharoVersionChooserPresenter >> version [ | ||
^ versionTable selectedItem value | ||
] |