Hello
I swear i have seen this asked before but it may have been dealing
with browsers. Is there a way to launch the default editor for a
system? I'm looking to allow a user to edit files from a menu but i
want it to open in their default editor. Thanks for any suggestions
Christopher
Christopher Regan wrote:
I swear i have seen this asked before but it may have been dealing
with browsers. Is there a way to launch the default editor for a
system? I'm looking to allow a user to edit files from a menu but i
want it to open in their default editor. Thanks for any suggestions
In *nix, there should be an environment variable: EDITOR
However, I know I use it for command line editing, but generally use a different GUI editor. You could probably equerry KDE and/or GNOME to see what file associations have been set.
On Windows (and OS-X, I suppose), there should be a way to find file associations, and use the one assigned to *.txt, or maybe *.py, depending on what you think makes sense.
In any case, you should let the user set a preference as to what editor they want to use. In fact, I'd probably just ask the user to do that the first time they try to edit a file, and be done with it, all the above ways are pretty error-prone.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
Seg, 2005-06-27 às 10:00 -0700, Chris Barker escreveu:
Christopher Regan wrote:
> I swear i have seen this asked before but it may have been dealing
> with browsers. Is there a way to launch the default editor for a
> system? I'm looking to allow a user to edit files from a menu but i
> want it to open in their default editor. Thanks for any suggestions
On Windows (and OS-X, I suppose), there should be a way to find file
associations, and use the one assigned to *.txt, or maybe *.py,
depending on what you think makes sense.
On Windows, just query the MimeTypesManager for text/plain and use the
GetOpenCommand method. See the wxpython demo(More Windows/Controls ->
MimeTypesManager). On OS-X I don't know.
On Linux, the GetOpenCommand, at least on my system, return always None.
So it's useless.
Ricardo