adapted, added a configuration
ADD
src/PharoLauncher-Spec2-Gtk/PhLGtkConfiguration.class.st
+Class {
+ #name : #PhLGtkConfiguration,
+ #superclass : #SpGtkConfiguration,
+ #category : #'PharoLauncher-Spec2-Gtk'
+}
+
+{ #category : #configuring }
+PhLGtkConfiguration >> configureGeneral: anApplication [
+
+ self addCSSProviderFromString: '
+toolbar.compact {
+ font-size: 0.6em }
+toolbar.compact toolbutton > button {
+ padding: 2px;
+ margin: 2px }
+'
+]

ADD
src/PharoLauncher-Spec2-Gtk/PharoLauncherApplication.extension.st
+Extension { #name : #PharoLauncherApplication }
+
+{ #category : #'*PharoLauncher-Spec2-Gtk' }
+PharoLauncherApplication class >> openGtk [
+ <script>
+
+ ^ (Default := self new)
+ useBackend: #Gtk with: PhLGtkConfiguration new;
+ openAsWorld: false;
+ run
+]

ADD
src/PharoLauncher-Spec2-Gtk/package.st
+Package { #name : #'PharoLauncher-Spec2-Gtk' }

MODIFY
src/PharoLauncher-Spec2/PhLImagesPresenter.class.st
src/PharoLauncher-Spec2/PhLImagesPresenter.class.st
@@ -14,7 +14,8 @@ Class {
'descriptionPanel',
'launchConfigurationList',
'imageFilter',
- 'rootCommandsGroup'
+ 'rootCommandsGroup',
+ 'toolbar'
],
#category : #'PharoLauncher-Spec2'
}
@@ -58,45 +59,43 @@ PhLImagesPresenter class >> buildContextualMenuGroup [
{ #category : #commands }
PhLImagesPresenter class >> buildToolbarGroup [
+
^ (CmCommandGroup named: 'Toolbar') asSpecGroup
description: 'Pharo Launcher toolbar';
+ register: ((CmCommandGroup named: 'Create') asSpecGroup
+ beDisplayedAsGroup;
register: PhLOpenNewImageWindowCommand forSpec;
+ yourself);
+ register: ((CmCommandGroup named: 'Image') asSpecGroup
+ beDisplayedAsGroup;
register: PhLLaunchImageCommand forSpec;
register: PhLLaunchImageCommand new asSpecLaunchWithoutSettingsCommand;
register: PhLLaunchImageFromDiskCommand forSpec;
register: PhLImportImageCommand forSpec;
register: PhLRefreshImageRepositoryCommand forSpec;
- register:
- (PhLShowImageInFolderCommand forSpec
+ register: (PhLShowImageInFolderCommand forSpec
name: 'Show';
yourself);
register: PhLDeleteImageCommand forSpec;
- register:
- (PhLQuitCommand forSpec
- beDisplayedOnRightSide;
yourself);
- register:
- (PhLAboutCommand forSpec
- beDisplayedOnRightSide;
+ register: ((CmCommandGroup named: 'Settings') asSpecGroup
+ register: (PhLOpenVmManagerCommand forSpec
+ name: 'VMs';
yourself);
- register:
- (PhLOpenSettingsCommand forSpec
+ register: (PhLOpenSettingsCommand forSpec
name: 'Settings';
- beDisplayedOnRightSide;
- yourself);
- register:
- (PhLOpenVmManagerCommand forSpec
- name: 'VMs';
- beDisplayedOnRightSide;
yourself);
- beDisplayedAsGroup;
- yourself
+ register: (PhLAboutCommand forSpec);
+ register: (PhLQuitCommand forSpec);
+ yourself;
+ yourself)
]
{ #category : #specs }
PhLImagesPresenter class >> defaultSpec [
^ SpBoxLayout newVertical
+ add: #toolbar expand: false;
add: #imageFilter expand: false;
add: (SpPanedLayout newVertical
positionOfSlider: 65 percent;
@@ -119,6 +118,25 @@ PhLImagesPresenter >> actionLaunch [
cmd execute
]
+{ #category : #initialization }
+PhLImagesPresenter >> buildToolbar [
+ | toolbarGroup |
+
+ toolbarGroup := self toolbarGroup.
+ ^ self newPresenter
+ layout: (SpBoxLayout newLeftToRight
+ add: (self newLaunchToolbar fillWith: toolbarGroup / 'Create') expand: false;
+ add: (SpBoxLayout newTopToBottom
+ vAlignCenter;
+ add: self newLaunchConfigurationDropList expand: false;
+ yourself);
+ add: (self newLaunchToolbar fillWith: toolbarGroup / 'Image') expand: false;
+ add: self newLabel; "to create an space"
+ addLast: (self newLaunchToolbar fillWith: toolbarGroup / 'Settings') expand: false;
+ yourself);
+ yourself
+]
+
{ #category : #initialization }
PhLImagesPresenter >> connectPresenters [
@@ -177,6 +195,7 @@ PhLImagesPresenter >> imageRepository [
{ #category : #initialization }
PhLImagesPresenter >> initializePresenters [
+ toolbar := self buildToolbar.
imageFilter := self newTextInput
placeholder: 'Enter image name filter ...';
whenTextChangedDo: [ :filterString | self filter: filterString asLowercase ];
@@ -223,12 +242,9 @@ PhLImagesPresenter >> initializeWindow: aWindowPresenter [
aWindowPresenter
title: 'Pharo Launcher';
initialExtent: 700 @ 500;
- toolbar: self toolbarGroup asToolbarPresenter;
centered;
whenClosedDo: [ self imageRepository unsubscribe: self ].
self rootCommandsGroup installShortcutsIn: aWindowPresenter.
- aWindowPresenter toolbar
- addItem: self newLaunchConfigurationDropList.
aWindowPresenter
bindKeyCombination: $f meta
toAction: [ self actionFilter ]
@@ -256,27 +272,34 @@ PhLImagesPresenter >> refresh [
{ #category : #updating }
PhLImagesPresenter >> refreshLaunchConfigurationList [
| image items |
+
[ image := self singleImage ]
on: PhLCommandError
- do: [ self resetLaunchConfigurationList.
+ do: [
+ self resetLaunchConfigurationList.
^ self ].
- items := image launchConfigurations collect: [ :each |
+ items := image launchConfigurations
+ collect: [ :each |
SpDropListItem new
model: each;
display: [ :config | config name ];
- icon: (self iconNamed: #configuration);
+ icon: (self application iconNamed: #configuration);
yourself ].
+
items addFirst: (SpDropListItem new
model: 'Edit configurations ...';
- action: [ self
+ action: [
+ self
editLaunchConfigurations;
refreshLaunchConfigurationList ];
- icon: (self iconNamed: #edit);
+ icon: (self application iconNamed: #edit);
yourself ).
+
launchConfigurationList
resetSelection;
dropListItems: items.
+
[ launchConfigurationList selectItem: image defaultLaunchConfiguration ]
on: NotFound "Default configuration has been deleted but there are still other configurations"
do: [ launchConfigurationList selectIndex: 2 ]
@@ -284,6 +307,7 @@ PhLImagesPresenter >> refreshLaunchConfigurationList [
{ #category : #updating }
PhLImagesPresenter >> resetLaunchConfigurationList [
+
launchConfigurationList
resetSelection;
items: #() "no image selected".
@@ -296,7 +320,8 @@ PhLImagesPresenter >> rootCommandsGroup [
{ #category : #'api - selection' }
PhLImagesPresenter >> selectConfiguration: aPhLLaunchConfiguration [
- launchConfigurationList selectItem: aPhLLaunchConfiguration.
+
+ launchConfigurationList selectItem: aPhLLaunchConfiguration
]
{ #category : #'api - selection' }
@@ -318,6 +343,7 @@ PhLImagesPresenter >> selectedImages [
{ #category : #'api - accessing' }
PhLImagesPresenter >> selectedLaunchConfiguration [
+
^ launchConfigurationList selectedItem
]

MODIFY
src/PharoLauncher-Spec2/PhLVMPresenter.class.st
src/PharoLauncher-Spec2/PhLVMPresenter.class.st
@@ -105,12 +105,15 @@ PhLVMPresenter >> initializePresenters [
{ #category : #initialization }
PhLVMPresenter >> initializeWindow: aWindowPresenter [
+
aWindowPresenter
title: 'Locally available Virtual Machines';
initialExtent: 720 @ 300;
- toolbar: (self rootCommandsGroup / 'Toolbar') asToolbarPresenter;
+ toolbar: (self newLaunchToolbar fillWith: (self rootCommandsGroup / 'Toolbar'));
centered.
+
self rootCommandsGroup installShortcutsIn: aWindowPresenter.
+
self privateVmsTogglePresenter
whenUnselectedDo: [ self privateVmsTogglePresenter
label: 'public';

MODIFY
src/PharoLauncher-Spec2/PharoLauncherApplication.class.st
src/PharoLauncher-Spec2/PharoLauncherApplication.class.st
@@ -27,6 +27,12 @@ Class {
#category : #'PharoLauncher-Spec2'
}
+{ #category : #accessing }
+PharoLauncherApplication class >> applicationName [
+
+ ^ 'pharo-launcher'
+]
+
{ #category : #testing }
PharoLauncherApplication class >> beDeployed [
IsDeployed := true
@@ -130,7 +136,8 @@ PharoLauncherApplication class >> open [
{ #category : #opening }
PharoLauncherApplication class >> openFull [
<script>
- ^ self default
+
+ ^ (Default := self new)
beOpenedAsWorld;
run
]
@@ -235,8 +242,7 @@ PharoLauncherApplication >> initialize [
imageRepository := PhLDirectoryBasedImageRepository default.
self templatesClearedOnStartup
ifTrue: [ self class resetTemplateRepository ].
- self resetTemplateRepository.
- self useBackend: #Gtk.
+ self resetTemplateRepository
]
{ #category : #private }

ADD
src/PharoLauncher-Spec2/SpPresenter.extension.st
+Extension { #name : #SpPresenter }
+
+{ #category : #'*PharoLauncher-Spec2' }
+SpPresenter >> newLaunchToolbar [
+
+ ^ self newToolbar
+ addStyle: 'compact';
+ yourself
+]

adapted, added a configuration