Skip to content

hernanmd/file-dialog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CIMatrix

A simple replacement for Pharo's native file/folder selection dialog.

Screenshots

Basic file preview

Select File To Open

Bookmark groups

Select File To Open 2

Save As

Save As

Filters

Select File To Open3

Add bookmarks

Screen Shot 2022-08-26 at 04 30 25

Features

  • ContextMenu to add/remove bookmark
  • Toggle hidden files (right-click on file listing)
  • Preset file name
  • Filtering files by subclass FDAbstractSelect
  • TextInputField like window path text input
  • Preview system
  • Change the column of the table presenter

Installation

Metacello new
	baseline: 'FileDialog';
	repository: 'github://hernanmd/file-dialog/repository';
	load.

Replacing native dialogs

If you feel brave, you can replace the native dialogs everywhere in the system by running:

FDMorphicUIManager new beDefault

Of course you can switch back anytime you want.

MorphicUIManager new beDefault

Classes

  • FDSaveFileDialog - saving a file
  • FDOpenFileDialog - selecting a file
  • FDOpenDirectoryDialog - selecting a directory

API

The user-facing API is in the api-customization protocol of FDFileDialogPresenter

  • defaultFolder: aPath — where should the dialog open, the default is the imageDirectory
  • filtersCustomization: aCollectionOfFDAbstractPredicate — a collection of FDAbstractPredicate
  • bookmarks: aCollectionOfBookmark _ see bookmark example class side of FileDialog
  • okActionBlock: aBlock — a one arg block executed when a file was selected
  • previewer: aPreviewer _ a son of FDAbstractPreviewer that returning a Spec widget
  • columns: aCollectionOfColumns _ you have to give a collection of subclass of FDAbstractFileReferenceColumn

Examples

Open a file with previewer:

FDOpenFileDialog new
	previewer: FDInspectPreviewer new;
	openDialog.

Save a file

FDSaveFileDialog new openDialog 

Adding bookmarks

FDOpenFileDialog new
	bookmarks: {
		FDBookmark home.
		FDBookmark root.
		FDBookmark tmp.
		(FDBookmark
			name: 'Image location'
			location: FileLocator imageDirectory
			icon: nil) .
		(FDGroupBookMark
				name: 'exampleGroup'
				collection:
					{FDBookmark image.
					FDBookmark home}
				iconName: 'group') };
		openDialog

Multiple options

FDOpenFileDialog new	
	previewer: FDContentPreviewer new;
	"with this when you select a png file it will display it"
	filtersCustomization: { FDJPGOrPNGFilter new };
	"with you add filter and there always the 'no filter'"
	defaultFolder: FileLocator home asFileReference;
	"it's open the FileDialog on this file"
	okActionBlock: [ :selectedFileReference | selectedFileReference inspect ];
	openDialog