From d34ce7193a810a3b29e162805b5f5b1fc397934b Mon Sep 17 00:00:00 2001 From: Christophe Demarey Date: Fri, 21 Jun 2024 10:56:13 +0200 Subject: [PATCH 1/3] use FileRequest interaction --- .../BaselineOfPharoLauncher.class.st | 10 ++++++ .../PhLImportImageCommand.class.st | 4 +-- .../PhLLaunchImageFromDiskCommand.class.st | 6 ++-- .../PhLUIFileRequest.class.st | 36 ------------------- .../TPhLInteractionTrait.trait.st | 2 +- 5 files changed, 16 insertions(+), 42 deletions(-) delete mode 100644 src/PharoLauncher-Core/PhLUIFileRequest.class.st diff --git a/src/BaselineOfPharoLauncher/BaselineOfPharoLauncher.class.st b/src/BaselineOfPharoLauncher/BaselineOfPharoLauncher.class.st index a584d2bd..8d6cbee3 100644 --- a/src/BaselineOfPharoLauncher/BaselineOfPharoLauncher.class.st +++ b/src/BaselineOfPharoLauncher/BaselineOfPharoLauncher.class.st @@ -17,6 +17,7 @@ BaselineOfPharoLauncher >> baseline: spec [ self xmlParser: spec. self clap: spec. self objCBridge: spec. + self interactions: spec. spec package: 'PharoLauncher-100Compatibility'; @@ -26,6 +27,7 @@ BaselineOfPharoLauncher >> baseline: spec [ 'OSSubprocess' 'OSWinSubprocess' 'Ston' + 'Interactions' 'ObjCBridge' 'PharoLauncher-100Compatibility'). ]; package: 'PharoLauncher-Spec2' with: [ @@ -69,6 +71,14 @@ BaselineOfPharoLauncher >> clap: spec [ with: [ spec repository: 'github://pharo-contributions/clap-st:master/src' ] ] +{ #category : 'external projects' } +BaselineOfPharoLauncher >> interactions: spec [ + + spec + baseline: #Interactions + with: [ spec repository: 'github://pharo-contributions/interactions' ] +] + { #category : 'external projects' } BaselineOfPharoLauncher >> objCBridge: spec [ diff --git a/src/PharoLauncher-Core/PhLImportImageCommand.class.st b/src/PharoLauncher-Core/PhLImportImageCommand.class.st index d753d385..71471c35 100644 --- a/src/PharoLauncher-Core/PhLImportImageCommand.class.st +++ b/src/PharoLauncher-Core/PhLImportImageCommand.class.st @@ -81,8 +81,8 @@ PhLImportImageCommand >> importImage [ | imageFile | imageFile := self imagesPresenter newFileRequest title: 'Import a Pharo image (will move image, changes file and pharo-local folder)'; - extensionsToShow: #('image'); - path: FileLocator home; + filter: '.image'; + currentFolder: FileLocator home; chooseFile. imageFile ifNil: [ self imagesPresenter newInformation diff --git a/src/PharoLauncher-Core/PhLLaunchImageFromDiskCommand.class.st b/src/PharoLauncher-Core/PhLLaunchImageFromDiskCommand.class.st index f52d12db..3444d680 100644 --- a/src/PharoLauncher-Core/PhLLaunchImageFromDiskCommand.class.st +++ b/src/PharoLauncher-Core/PhLLaunchImageFromDiskCommand.class.st @@ -30,11 +30,11 @@ PhLLaunchImageFromDiskCommand >> execute [ | imageFile | imageFile := self imagesPresenter newFileRequest title: 'Open a Pharo image'; - extensionsToShow: #('image'); - path: FileLocator home; + filter: '.image'; + currentFolder: FileLocator home; chooseFile. imageFile ifNil: [ ^ self ]. - imageFile isFile ifFalse: [ ^self ]. + imageFile isFile ifFalse: [ ^ self ]. ^ self launchImage: (PhLImage location: imageFile). ] diff --git a/src/PharoLauncher-Core/PhLUIFileRequest.class.st b/src/PharoLauncher-Core/PhLUIFileRequest.class.st deleted file mode 100644 index 666614d2..00000000 --- a/src/PharoLauncher-Core/PhLUIFileRequest.class.st +++ /dev/null @@ -1,36 +0,0 @@ -Class { - #name : 'PhLUIFileRequest', - #superclass : 'PhLUserInteraction', - #instVars : [ - 'title', - 'extensionsToShow', - 'path' - ], - #category : 'PharoLauncher-Core-Commands', - #package : 'PharoLauncher-Core', - #tag : 'Commands' -} - -{ #category : 'action' } -PhLUIFileRequest >> chooseFile [ - ^ UIManager default - chooseExistingFileReference: title - extensions: extensionsToShow - path: path - preview: false. -] - -{ #category : 'accessing' } -PhLUIFileRequest >> extensionsToShow: anObject [ - extensionsToShow := anObject -] - -{ #category : 'accessing' } -PhLUIFileRequest >> path: anObject [ - path := anObject -] - -{ #category : 'accessing' } -PhLUIFileRequest >> title: anObject [ - title := anObject -] diff --git a/src/PharoLauncher-Spec2/TPhLInteractionTrait.trait.st b/src/PharoLauncher-Spec2/TPhLInteractionTrait.trait.st index 55f7576f..47f09b74 100644 --- a/src/PharoLauncher-Spec2/TPhLInteractionTrait.trait.st +++ b/src/PharoLauncher-Spec2/TPhLInteractionTrait.trait.st @@ -16,7 +16,7 @@ TPhLInteractionTrait >> newConfirmation [ { #category : 'user interaction' } TPhLInteractionTrait >> newFileRequest [ - ^ PhLUIFileRequest new + ^ ITFileRequest new ] { #category : 'user interaction' } From 0000eb68e27cd69822e0a88751204e2feb260271 Mon Sep 17 00:00:00 2001 From: DEMAREY Christophe Date: Fri, 21 Jun 2024 11:12:58 +0200 Subject: [PATCH 2/3] udapte the API for testing file requests --- .../PhLTestRequest.class.st | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PharoLauncher-Tests-Commands/PhLTestRequest.class.st b/src/PharoLauncher-Tests-Commands/PhLTestRequest.class.st index 82fe9d7c..c4975a9a 100644 --- a/src/PharoLauncher-Tests-Commands/PhLTestRequest.class.st +++ b/src/PharoLauncher-Tests-Commands/PhLTestRequest.class.st @@ -33,7 +33,12 @@ PhLTestRequest >> chooseFrom: aCollection [ ] { #category : 'noop' } -PhLTestRequest >> extensionsToShow: aCollection [ +PhLTestRequest >> currentFolder: aFileLocator [ + "noop" +] + +{ #category : 'noop' } +PhLTestRequest >> filter: aFilterString [ "noop" ] @@ -52,11 +57,6 @@ PhLTestRequest >> parentWindow: aWindowPresenter [ "no need to keep the parent" ] -{ #category : 'noop' } -PhLTestRequest >> path: aFileLocator [ - "noop" -] - { #category : 'accessing' } PhLTestRequest >> request [ ^ (validationBlock value: self answer) From 7f0e5d416fbb0828e61f0be6cfd32d1542f2a623 Mon Sep 17 00:00:00 2001 From: DEMAREY Christophe Date: Fri, 21 Jun 2024 11:29:56 +0200 Subject: [PATCH 3/3] ensure launched images are killed in tear down --- .../PhLLaunchImageTest.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PharoLauncher-Tests-Functional/PhLLaunchImageTest.class.st b/src/PharoLauncher-Tests-Functional/PhLLaunchImageTest.class.st index 491c14b8..dbb01011 100644 --- a/src/PharoLauncher-Tests-Functional/PhLLaunchImageTest.class.st +++ b/src/PharoLauncher-Tests-Functional/PhLLaunchImageTest.class.st @@ -99,7 +99,7 @@ PhLLaunchImageTest >> testCanLaunchImageWithNonAsciiCharacters [ | image | image := self copyCurrentImageToTestDir. - image launch. + process := image launch. 2 seconds wait. "let time to the process to be launched, else test cleanup will interfer with process launch" "ensure image determination succeeded" @@ -143,7 +143,7 @@ PhLLaunchImageTest >> testLaunchImageSetShouldRunInitilizationScriptToFalse [ image := self copyCurrentImageToTestDir. - image launch. + process := image launch. 2 seconds wait. "let time to the process to be launched, else test cleanup will interfer with process launch" image := PhLImage location: imageDir / FileLocator image basename. "read image metadata from disk"