Skip to content

Rescue Screenshot #19011

@Ducasse

Description

@Ducasse

makeAScreenshot is now in morphic but we could have it at the level of Spec.

makeAScreenshot

	| filePrefix |
	filePrefix := 'PharoScreenshot'.
	(MorphicUIManager new
		 chooseFrom: {
				 'The entire world' translated.
				 'A selected area' translated }
		 values: #( #world #area )
		 message:
			 'What do you want to shoot? (File will be saved in image directory)'
				 translated
		 title: 'Make a screenshot') ifNotNil: [ :choice |
		| form name |
		form := choice = #world
			        ifTrue: [ self currentWorld imageForm ]
			        ifFalse: [ Screenshot new formScreenshotFromUserSelection ].
		name := (FileSystem workingDirectory / filePrefix , 'png')
			        nextVersion.
		PNGReadWriter
			putForm: form
			onFileNamed:
			(FileSystem workingDirectory / filePrefix , 'png') nextVersion.
		MorphicUIManager new
			inform: (String streamContents: [ :s |
					 s
						 nextPutAll: 'Screenshot saved under ';
						 nextPutAll: name fullName;
						 cr;
						 nextPutAll: 'Click to open location' ])
			actionOnClick: [ name openInOSFileBrowser ] ]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions