Commit Graph

483 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
e7f9554f39 Preview: do not overwrite fg/bg color names that beamer uses
Rename them to lyxfg/lyxbg

Fixes bug #12563.

(cherry picked from commit a20477993b)
2022-11-22 21:26:18 -05:00
Enrico Forestieri
877d296b78 Amend bd6d09fc
Was forgetting this.

(cherry picked from commit 92c4bb4682)
2020-05-18 22:27:56 +02:00
Enrico Forestieri
51b8778c73 Fix Python 3 issues when generating preview snippets
The log file generated by latex can contain strings encoded in
whatever supported encoding. Instead of guessing the encoding,
it is better to open it in binary mode and then performing the
necessary comparisons as "bytes". In order to do this, the
strings are encoded in utf8, so that, for example, b"pythön" is
encoded as "pyth\xc3\xb6n" (7 bytes). Of course, this means that
we can only successfully perform comparisons with ascii strings.
However, this is what we actually do, as we only search for
ascii strings in the log file.

(cherry picked from commit bd6d09fc98)
2020-05-18 20:44:33 +02:00
Juergen Spitzmueller
3df1e0d70e Amend 74f831e06d
Forgot this part.

(cherry picked from commit bd89a273bc)
2020-05-18 13:20:57 +02:00
Juergen Spitzmueller
733389677f Add support for inkscape 1.0
Command line syntax has changed. We now check for the version and use
the appropriate cl options.

Fixes #11742

(cherry picked from commit 74f831e06d)
2020-05-18 13:19:30 +02:00
José Matos
20996d46fc Remove code that is redudant.
Both for python2 and python3 output is always a string.

(cherry picked from commit 4268a9e812)
2020-02-25 18:24:41 -05:00
Richard Kimberly Heck
fb9bc1a3f7 Fix bug #11750.
Unfortunately, stat.st_ino returns 0 on Windows, at least on Python 2.7, so we can't use that way of telling when we're seeing the same directory again. Surely the real pathname should work.

(cherry picked from commit 9d8dfe934b)
2020-02-24 19:09:31 -05:00
José Matos
b1860e301a Attempt to fix #11457
In python 3 the colors need to be strings and not bytes:

This was the equivalent of

>> print("%s" % b"1")
"b'1'"

since the colors were bytes the call to dvipng was something like

dvipng -Ttight -depth -height -D 115 -fg "b'rgb 0.937255 0.941176 0.945098'" -bg "b'rgb 0.137255 0.149020 0.160784'"  "lyxpreviewxBJEqm.dvi"

Note the "b'rgb after both -fg and -bg that wrecked havoc and thus dvipng failed. That was the difference between python2 and python3 calls.

(cherry picked from commit 8dd31803b1)
2019-10-30 19:27:50 -04:00
Jean-Marc Lasgouttes
b89749ae1d Let TeXFiles.py handle symbolic links.
Nix (https://nixos.org) is a Unix package manager, which can be used to
install LaTeX on macOS. A peculiarity of Nix is that all packages are
installed into separate directories and the actual directory tree is
then constructed via symlinks.

This interacts badly with the way LyX currently detects files in the
TeX setup, because TeXFiles.py does not follow symlinks. Therefore,
almost nothing is found when using LyX together with Nix’ LaTeX.

Patch from Michael Roitzsch.

(cherry picked from commit 642b4acca1)
2019-06-27 23:53:03 +02:00
Juergen Spitzmueller
bdbdd28756 Fix command line output of convertDefault.py for ImageMagick
Part of #11186

(cherry picked from commit 1e5acc5656)
2018-07-13 17:26:34 +02:00
José Matos
f7b9d57a45 Update scripts to support simultaneously python 2 and 3
The fixes are simple and on line with the changes made during
the 2.3 development. It was an oversight to leave them out.

With this commit all the python scripts should be supported by
python 2 and 3.

(cherry picked from 5b160e82be)
2018-04-28 11:24:28 +01:00
Juergen Spitzmueller
12bd7352fd Implement auto-nesting.
Now layouts can specify other layouts that should be nested in and
after the current one (if the layout is switched from the current one
and if it follows a paragraph in the current one).

This is particularly useful for things such as the beamer frames, where
particular layouts are practically always nested.

This is a backport from master, including all fixes.
2018-01-01 12:30:34 +01:00
Juergen Spitzmueller
67fc95d8cd Assure print function compatibility in python 2.x
(cherry picked from commit eb2dbb8b09)
2017-11-24 11:58:27 +01:00
Juergen Spitzmueller
8994d89266 Use python3 print syntax
(cherry picked from commit 4f10c0a14b)
2017-11-23 08:17:45 +01:00
Uwe Stöhr
21380b9012 svg2pdftex.py: make print work with Python 2 and 3
(cherry picked from commit 913619c80a)
2017-11-23 08:17:10 +01:00
Juergen Spitzmueller
fadb93ae68 Collapsable -> Collapsible (part 5)
Preferences update and prefs2prefs routine.

This was forgotten in the process.
2017-11-02 16:51:23 +01:00
Juergen Spitzmueller
a59301eaff Collapsable -> Collapsible (part 2)
The current spelling is not strictly wrong, but flagged as unusual or
historical by some authorities. It is also found fault with many
spell checkers. Thus we decided to move to the more standard "-ible"
form once and for all.

See #10678 for discussion

This part covers the most tricky part: the internal naming.
Translations and layouts will follow.

This will all also all be backported to 2.3.x, for the sake of backwards
compatibility (cherry-picking).

(cherry picked from commit c466baaa5b)
2017-10-16 11:24:41 +02:00
Juergen Spitzmueller
bbac6b7037 Fix literal string in binary context
In 1a26f9b26c, all strings in the context of regexes and
comparisons have been converted to byte-like objects for python2/3
compatibility reasons. This has not been considered in the later
commit 5c54557350, which makes layout2layout break with
TypeError: can't concat str to bytes.

(cherry picked from commit 8fecdfc473)
2017-10-13 18:38:01 +02:00
Stephan Witt
c75d9bf7c4 Add Qt-based fallback-converter for Mac to compensate missing ImageMagick convert utility
(cherry picked from commit f93ec4a1f4)
2017-10-03 20:10:29 +02:00
Juergen Spitzmueller
e8dd6702fd svg2*tex.py: final fixes for Windows
Fixes: #10679
2017-09-12 07:57:29 +02:00
Juergen Spitzmueller
0b6207d771 svg2*tex.py: use subprocess in order to handle path with spaces.
See #10679
2017-09-10 17:02:58 +02:00
Juergen Spitzmueller
242f543e01 Add default output format for pLaTeX
Fixes: #10747
2017-09-09 08:53:08 +02:00
Jean-Marc Lasgouttes
b92ceba9a1 Honor trailing spaces in LabelString and friends
Remove the trimming operation on LabelString, LabelStringAppendix,
EndLabelString and LabelCounter. This trimming meant that quotes
strings were not preserved, which is wrong.

To preserve layouts, the Layout format has been updated to 64, so that
layout2layout can remove extra spaces on existing strings, which
ensures that behavior is unchanged for old layouts (courtesy of rgheck).

It is now possible to re-add spaces in label strings where it makes
sense.

Fixes bug #10723.

(cherry picked from commit 5c54557350)
2017-09-02 16:08:56 +02:00
Juergen Spitzmueller
b3d67c8139 Improve the svg2*tex.py scripts.
The inkscape command was hardcoded, but it seems that we need the full
patch on Windows. Therefore we check in configure.py if inkscape is
installed and pass the proper name (and possibly path) to the scripts.

Should address problems mentioned in #10679
2017-08-28 08:00:56 +02:00
Juergen Spitzmueller
21615fe6ba Add proper author info and license header to the inkscape.xtemplate related files 2017-08-26 16:13:11 +02:00
José Matos
6b092c8400 scripts/ext_copy.py: add option to copy directly to the document directory
When this option is not given, as it happened before, the copier will create/use
a subdirectory in the target final directory
2017-08-08 15:23:03 +01:00
Juergen Spitzmueller
7945ba0cb0 Load color before polyglossia also in preview snippets
This fixes an error in the preview generation with polyglossia
and bidi that prevents snippet generation (and consequently also
"math as image" xhtml output).

Fixes: #10716.
2017-07-11 10:03:03 +02:00
Enrico Forestieri
7c14ff94e3 Fix bug #10718
Due to the peculiarities of Windows, it may happen that
pdftocairo is built without png support when compiled on this
platform. Unless explicitly requested (maybe for some peculiar
application and certainly not for usual distros), this is
highly improbable to occur on other platforms.
2017-07-09 22:27:06 +02:00
Kornel Benko
87ccd23047 Cmake export tests: Missed second parameter for writeConverters()
Unfortunatelly the prototype checking in perl is not very
sophisticated.
2017-06-21 00:09:50 +02:00
Kornel Benko
c5e53637c2 Cmake export tests: Modularisation of prefTest.pl
Also added a parameter to easier switch between standard settings in
preferences and settings to use in export tests.
2017-06-18 12:13:57 +02:00
Kornel Benko
195e55d3f4 Cmake export tests: Adapt to minted listings
1.) Handle also 'LatexCommand inputminted' in lyxStatus.pm
2.) Add '-shell-escape' to the appropriate converters.
  This applies only to the ctest-environment iff calling
  the script 'prefTest.pl' in the build directory.
2017-06-16 11:39:26 +02:00
Enrico Forestieri
ae56167718 Use a combo box instead of a check box for selecting the listings package 2017-06-12 17:24:26 +02:00
Kornel Benko
3b05cf2851 make tests: Disable sessions handling
We use prefTest.pl to allow use of external programs
while testing exports.
The change here affects only the keytests though.
2017-06-01 09:19:29 +02:00
Kornel Benko
ab956a50a6 Cmake tests: remove handling of bindings in user.bind.
It is done now by keytest.py
2017-05-22 08:56:42 +02:00
José Matos
cc7ca138da Fix call of layout2layout as a module.
If we call parser.parse_args(), thus with no arguments, the parser uses
sys.argv (because that is the default). We should pass argv since that was
the purpose of handling argv in the main function.

We pass argv[1:] since when parsing the arguments we always ignore the name
of the program.

Use the full power of argparse to declare the default value of the end_format.
2017-05-13 15:25:44 +01:00
José Matos
99cf71f8eb Fix call os lyx2lyx as a module.
If we call parser.parse_args(), thus with no arguments, the parser uses
sys.argv (because that is the default). We should pass argv since that was
the purpose of handling argv in the main function.
2017-05-13 13:39:02 +01:00
José Matos
6138880c08 cleanup: remove unneeded whitespaces 2017-05-13 13:38:01 +01:00
José Matos
430869a1bd prefs2prefs.py: whitespace changes
Bring this file in line with the other python scripts:
  * use four spaces for indentation instead of a tab

Remove empty whitespace at the end of lines.
2017-05-12 15:29:29 +01:00
José Matos
376cb6763f python3: fix the preview framework to work with both python 2 and 3 (part 4)
Remove support for python 1.x (really)

This code has not been used for a long time, probably never, since some code
above requires at least python 2.4 to work.

I got to this code by running futurize from python-future. There are no
significant warnings, mostly are related with the division but since
we are dividing floats there is no change between python 2 and 3.
2017-05-12 10:01:48 +01:00
José Matos
1f5241f747 python3: fix the preview framework to work with both python 2 and 3 (part 3)
trivial fix: xrange -> range
2017-05-11 20:56:56 +01:00
José Matos
c546977c6e python3: fix the preview framework to work with both python 2 and 3 (part 2) 2017-05-11 15:50:08 +01:00
Günter Milde
2488bf6eaa Fix the fix for python 2 and 3 compatibility.
Really remove the "r" prefix.
2017-05-11 16:30:10 +02:00
José Matos
6495cd135f make python string compliant with python 2 and 3
python 2 does not allow to declare a string as raw byte so we double
the backslashes and remove the r preffix

python 3 accepts rb"..." meaning a byte string that is raw. In this context
raw means that the backslash does not has any special meaning and thus it
is not escaped. This is usefull together with regular expressions where the
backslashes are special.

In the worst possible case, like this one, we must use 4 backslashes to represent
one in the regular expression...
2017-05-09 16:53:32 +01:00
José Matos
11f2a59ce9 python3: fix the preview framework to work with both python 2 and 3 2017-05-09 11:20:34 +01:00
Tommaso Cucinotta
066edd3c30 Enable graphics generation from external gnuplot scripts. 2017-05-04 00:44:00 +02:00
Kornel Benko
6e9e7f2b94 keytests: Allow definition of shortcuts for the test.
Since no extra shortcuts are defined, this is essentially a noop ATM.
2017-04-24 17:50:49 +02:00
Scott Kostyshak
e9deea03db Update the formats of lyxrc.dist.in to 21
In the end, no changes were needed. This was decided by prefs2prefs
for MacOSX and cygwin, and by manual inspection for Win32.
2017-04-23 23:23:03 -04:00
Enrico Forestieri
217696d34b lyxpak.py: Python 3 compatibility 2017-04-15 00:05:40 +02:00
Enrico Forestieri
1a26f9b26c layout2layout.py: Python 3 compatibility
The layout2layout.py script already reads and writes files in
binary format. However, all regexes and comparisons assume strings,
so that python3 chokes on them. This commit converts all involved
strings into bytes-like objects. In this way both python 2 and 3
behave the same.
2017-04-13 16:25:59 +02:00
Enrico Forestieri
db494452dc TeXFiles.py: Python 3 compatibility 2017-04-13 10:49:38 +02:00