Opened 6 years ago
Last modified 6 years ago
#2714 assigned enhancement
Allow custom option on Open File dialog
Reported by: | Owned by: | Tom Goddard | |
---|---|---|---|
Priority: | moderate | Milestone: | |
Component: | Input/Output | Version: | |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
Would like to allow custom options on the Open File dialog for specific formats. Main trouble is that the native Open File dialogs on Mac and Windows can't be use (via Qt) to do this, so we would have to use a Qt Open File dialog which is considerably poorer user experience.
Begin forwarded message:
From: Anthony James Schaefer
Subject: [chimerax-users] differentiating file category
Date: December 30, 2019 at 2:30:44 PM PST
To: "chimerax-users@…" <chimerax-users@…>
Hello,
Is there any way I can get a bundle to know that I'm trying to open a file from a certain category (e.g.Molecular structure vs. Molecular trajectory) from the File -> Open... menu?
I'm trying to build a plugin that will allow me to open Gaussian log files in ChimeraX. I'd like to have it open the optimized structure when I go File -> Open... and change the file filter to "Molecular structure files". When I set the file filter to "Molecular trajectory files", I'd like it to open the log file as a trajectory with each frame being one of Gaussian's optimization steps. The file stays the same, I just want to have my 'open_file' method know that it should open the file differently.
So far, I've tried having multiple 'Open' entries in my bundle tags. Here are some relevant tags from my setup.py:
"ChimeraX :: DataFormat :: LOG :: Gaussian output file :: Molecular structure :: .log :: :: :: :: :: Gaussian output file :: utf-8",
"ChimeraX :: DataFormat :: LOG trajectory :: Gaussian output trajectory :: Molecular trajectory :: .log :: :: :: :: :: Gaussian output file :: utf-8",
"ChimeraX :: Open :: LOG :: Gaussian output file ::",
"ChimeraX :: Open :: LOG trajectory :: Gaussian output trajectory :: :: coordsets:Bool",
My 'open_file' definition line is:
def open_file(session, path, format_name, coordsets=False):
While I'm testing, I've set up my 'open_file' method to print the arguments that get passed to it. When I use File -> Open..., I can see that 'format_name' is always "Gaussian ouput file" (never "Gaussian output trajectory") and 'coordsets' is always False, regardless of the file filter. When I use the open
command (open asdf.log coordsets true
), 'coordsets' is True and 'format_name' is "Gaussian output file".
I can work with the open command because of the 'coordsets' argument, but I'd like to know if there's something I can do with the File -> Open... menu.
Thanks,
Tony
Begin forwarded message:
From: Tom Goddard
Subject: Re: [chimerax-users] differentiating file category
Date: January 2, 2020 at 12:37:38 PM PST
To: Anthony James Schaefer
Cc: "chimerax-users@…" <chimerax-users@…>
Hi Tony,