Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Linux windows file dir picking #112

Merged
merged 9 commits into from
May 19, 2017

Conversation

maxvonhippel
Copy link
Contributor

@maxvonhippel maxvonhippel commented May 18, 2017

In response to issue 107.

Functionality remains the same on mac os:

  1. ------------------------

macos_1

  1. ------------------------

macos_2

  1. ------------------------

macos_3

However, Linux and Windows users should now have the ability to choose to either select a file or a directory. Previously they could only select directories, since on both OS's file choosers must be one or the other and default to directory when both options are passed. Demo on the latest Ubuntu in VirtualBox:

First, the user clicks Import. A dialog occurs asking if they would like to select a directory or a file (or cancel altogether).
linux_1
The user selects File.
linux_2
The file is successfully imported.
linux_3
Next, the user clicks Import again, and this time chooses directory. They navigate to the same directory as before, but this time they can't click on the file, only the directory, as below:
virtualbox_test machine_18_05_2017_15_05_06
(Notice that the titles on the choose windows change to say Choose Artifact Directory or Choose Artifact File contextually). The user clicks on the directory, fills in the parameters and clicks Go!. Success:
linux_4

Untested on Windows, but it should work according to all the available documentation. (We don't yet support windows so this shouldn't matter too much for now anyway).

@ebolyen ebolyen self-assigned this May 18, 2017
@maxvonhippel
Copy link
Contributor Author

Also, I just tested both x-ing out of the dialog window and clicking cancel, and both appear to work.

Copy link
Member

@ebolyen ebolyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some stylistic comments, I haven't pulled this down yet to test, but the structure of the code looks great.

Ready for merge after comments are addressed and I've finished testing.

if (fps) {
dispatch(setArtifactDir(fps[0]));
let curProps = ['openFile', 'openDirectory'];
let curTitle = 'Choose Artifact Directory or File';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it was already like this, but let's change it to: Choose Directory or File to Import (I've also added comments to make the other titles consistent with this new title-scheme)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, will do!

message: 'What would you like to select?',
calcelId: 2
});
if (callback === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I would want to use a callback, but since remote.dialog.showMessageBox blocks the process there's not much point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I tried using a callback at first but came to the same conclusion after reading the messageBox documentation.

};
if (process.platform !== 'darwin') {
// linux or windows
const callback = remote.dialog.showMessageBox({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callback -> response since this isn't a function.

});
if (callback === 0) {
curProps = ['openFile'];
curTitle = 'Choose Artifact File';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose File to Import

dispatch(openSelectArtifactDirectoryDialog());
} else if (callback === 1) {
curProps = ['openDirectory'];
curTitle = 'Choose Artifact Directory';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose Directory to Import

@ebolyen
Copy link
Member

ebolyen commented May 19, 2017

Just tested locally, I really like using the message box to select the file-open widget!

type: 'question',
buttons: ['File', 'Directory', 'Cancel'],
title: 'Artifact Selection',
message: 'What would you like to select?',
Copy link
Member

@ebolyen ebolyen May 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry one last comment. Change the message to: Are you importing a single file or directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great on all fronts, thanks, will do!

@ebolyen ebolyen merged commit 2aece99 into qiime2:master May 19, 2017
@maxvonhippel maxvonhippel deleted the linux-windows-file-dir-picking branch May 19, 2017 19:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants