Raise only Add Files GUI

Hello Everyone,

I want to create a simple button in a scripted (python) module,such that on clicked ideally that should raise the “Add Data” widget. Ideally I want it be preselected as the file loader only i.e the “Choose File(s) to Add” option. I research, but could not find a suitable solution for the Load. Would it be possible to do this using python?

Currently I could use the hot key combination as a work around, but “Choose File(s) to Add” option directly was not possible with that. Could anyone please suggest a better way to get this done?

Thanks a lot,
Best regards,

Can you tell a bit more about your workflow? What kind of files do your users load? How many at a time? Do they use drag-and-drop to load files? Do you want to entirely skip the “Add data” dialog (always want to load files with the default options)?

Thank you, the workflow mainly involves replay recorded video. The users would upload .mkv (description: IGISO) format video or sequences. Ideally one/two files to replay the recorded videos. Keeping the default options and removing the “Add Data” dialog option would be great.

Best Regards,

You can use openDialog method to show a file selector dialog and directly load the chosen file. See examples in the script repository.

For direct loading by drag-and-drop, you can register a drag-and-drop handler that can detect this specific file format and load the file directly (without opening the Add data window). See the DICOM module as an example, which does this for DICOM files.

1 Like

Thanks a lot, the openDialog method to show a file selector dialog works great. It’s even better because it restricts the user to only view supported file formats. However the file format as I mentioned are .mkv and those didn’t get loaded finally even after selecting and opening them (I tried both ‘SequenceFile’ and ‘VolumeFile’ as filetype).

The file type is “IGSIO Sequence” - see here:

1 Like

That’s great, thank you so much! Now it works perfectly

1 Like