On 12/09/2009 03:50 PM, Guenter Milde wrote:
On 2009-12-09, rgheck wrote:

What happens if you click on a *.rtf file in Konqueror?
(Maybe you did not set a valid default application?)

It opens in OpenOffice.

Look, I know how file associations work, OK? The problem will become clear below. I hope.

We can simply default to "auto", then, if people prefer to do that. But
"%s" is wrong.
"%s" is a placeholder. If a Python file (like configure.py) contains the
code

   auto = "Auto"
   str = "this is my %s" % auto

the string str will have the value "this is my Auto".

I know about this, thanks.

Here's what we have now. Please note the rtf, sxw, etc, lines that Uwe added.

addToRC(r'''\Format date "" "date command" "" "" "" ""
\Format csv        csv    "Table (CSV)"  "" ""  ""      "document"
\Format fax        ""      Fax                    "" "" ""      "document"
\Format lyx        lyx     LyX                    "" "" ""      ""
\Format lyx13x     lyx13  "LyX 1.3.x"             "" "" ""      "document"
\Format lyx14x     lyx14  "LyX 1.4.x"             "" "" ""      "document"
\Format lyx15x     lyx15  "LyX 1.5.x"             "" "" ""      "document"
\Format lyx16x     lyx16  "LyX 1.6.x"             "" "" ""      "document"
\Format clyx       cjklyx "CJK LyX 1.4.x (big5)"  "" "" ""      "document"
\Format jlyx cjklyx "CJK LyX 1.4.x (euc-jp)" "" "" "" "document" \Format klyx cjklyx "CJK LyX 1.4.x (euc-kr)" "" "" "" "document"
\Format lyxpreview lyxpreview "LyX Preview"       "" "" ""      ""
\Format lyxpreview-platex lyxpreview-platex "LyX Preview (pLaTeX)" "" "" "" ""
\Format pdftex     pdftex_t PDFTEX                "" "" ""      ""
\Format program    ""      Program                "" "" ""      ""
\Format pstex      pstex_t PSTEX                  "" "" ""      ""
\Format rtf rtf "Rich Text Format" "" "%s" "" "document,vector" \Format sxw sxw "OpenOffice.Org (sxw)" "" "%s" "" "document,vector" \Format wmf wmf "Windows Metafile" "" "%s" "%s" "vector" \Format emf emf "Enhanced Metafile" "" "%s" "%s" "vector" \Format word doc "MS Word" W "%s" "" "document,vector"
\Format wordhtml   html   "HTML (MS Word)"        "" "" ""      "document"
''')

Unsurprisingly, this code writes this:

\Format rtf rtf "Rich Text Format" "" "%s" "" "document,vector" \Format sxw sxw "OpenOffice.Org (sxw)" "" "%s" "" "document,vector" \Format wmf wmf "Windows Metafile" "" "%s" "%s" "vector" \Format emf emf "Enhanced Metafile" "" "%s" "%s" "vector"

to lyxrc.defaults, which leads to this when you try to view an rtf:

Format.cpp(314): Executing command: %s "/tmp/lyx_tmpdir.T12857/lyx_tmpbuf1/r.rtf"

As always, LyX just adds the filename to the "command" given, since it doesn't find "$$i". So it's trying to run "%s". Interesting command.

If I manually replace "%s" with "auto", then absolutely nothing happens, for the simple reason that support::os::autoOpenFile() does nothing but return false on Linux. Perhaps someone should fix that.

If I replace "%s" with "$$i", which I suppose is what was intended, then I get this (with -dbg files):

Format.cpp(314): Executing command: "/tmp/lyx_tmpdir.T12882/lyx_tmpbuf0/r.rtf" Systemcall.cpp(111): QProcess "/tmp/lyx_tmpdir.T12882/lyx_tmpbuf0/r.rtf" did not start! Systemcall.cpp(112): error The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.
Error: Cannot view file
----------------------------------------
An error occurred whilst running "/tmp/lyx_tmpdir.T12882/lyx_tmpbuf0/r.rtf"

Which is what you would expect when you try to execute an rtf. Which is what LyX is trying to do. Which is what I've been saying all along.

So far as I know, whether I am running under KDE or Gnome or XFCE or whatever has nothing to do with this. LyX is just trying to run a command.

rh

Reply via email to