Commit Graph

31 Commits

Author SHA1 Message Date
Thibaut Cuvelier
1991d0ed24 Converters: always set version to something.
Otherwise, it's common to compare "None >= (6,2,6)", which makes no sense. Set it to (0,0,0) so that any comparison fails (without an error message).
2020-09-19 20:43:41 +02:00
Thibaut Cuvelier
e4065cc1b1 Converters: slightly more pythonic code. 2020-09-19 20:43:41 +02:00
José Matos
4268a9e812 Remove code that is redudant.
Both for python2 and python3 output is always a string.
2019-06-04 18:26:13 +01:00
José Matos
639b5da1af Fix the remaing issues with comparisons with objects of different types.
In python it is possible to compare tuples with a lexicographic order.

Take advantage of that since there is no need to resort to the C-trick of converting a version in hex format.

We need to set a dummy version in case we are using ImageMagick to ensure that version is always an integer 3-tuple.
2019-06-03 19:07:20 +01:00
José Matos
a8937b53ec Fix bug in python comparison.
It worked in python2 but not the way the authors imagined. Because hex always returns a string.

From python2:
>>> 1 > "2"
False
>>> "2" > 1
True
>>> "1" > 2
True

The rational is that an integer is always smaller than a string.

In python 3 this because it does not make sense to compare objects of different types.
2019-06-03 17:15:09 +01:00
Uwe Stöhr
01c5d528fe convertDefault.py: remove ancient restriction
there is no longer the need to restrict the image depth (on Windows since years the 16 bit depth version of ImageMagick is bundled)
2019-03-21 02:35:51 +01:00
Günter Milde
9abd46b4d5 Fix AttributeError with Python 3.
At least since Python 3.5, `output` is already a
(unicode) string and does not have a "decode" method.
2019-02-28 22:59:30 +01:00
Juergen Spitzmueller
1e5acc5656 Fix command line output of convertDefault.py for ImageMagick
Part of #11186
2018-07-13 10:20:26 +02:00
José Matos
5b160e82be 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.
2018-04-28 10:51:35 +01:00
Stephan Witt
f93ec4a1f4 Add Qt-based fallback-converter for Mac to compensate missing ImageMagick convert utility 2017-09-30 18:13:37 +02:00
Georg Baum
8da5d01ff7 Detect ImageMagick 7
Imagemagick 7 does not have a convert command anymore, it is now called magick.
Joint work by Uwe and me.
2016-05-10 21:27:57 +02:00
Georg Baum
88c274eee7 Let imagemagick detect file format (bug #2332)
Imagemagick detects the inut file format based on contents. Therefore it does
not make sense that we prefix the to be converted file name with the extension
(assuming that the file extension matches the imagemagick format name). This
breaks formats where the extension used by LyX does not match the imagemagick
format name.
2015-03-22 10:22:31 +01:00
Richard Heck
f9de88c53c Remove the shebang line from our python scripts, per Jose's suggestion.
Fedora ships these chmod 644 and has never seen a problem. The advantage
to doing this is that it better controls what version of python we are
using to launch the script, and it will reveal if we're somehow somewhere
not controlling that properly.
2014-01-28 12:52:16 -05:00
Richard Heck
620cd90aa3 Very minor cleanup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37555 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-07 23:48:29 +00:00
Pavel Sanda
fe1e5203c0 Fix bug #6056. Recognize Graphicsmagick too.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30935 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-09 14:38:49 +00:00
Enrico Forestieri
bc1b6917c0 According to Pavel:
http://studio.imagemagick.org/pipermail/magick-developers/2008-July/002997.html
the -flatten option is necessary starting from IM 6.3.5


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25762 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-21 10:54:12 +00:00
Enrico Forestieri
37bc93583e Also take into account version number components >= 10 (but less than 256).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25761 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-21 10:31:26 +00:00
Enrico Forestieri
9c87e40ace Correct check for IM version
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25760 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-21 09:55:40 +00:00
Enrico Forestieri
ca34131b4b Tailor version numbers according to IM ChangeLogs:
2006-03-31  6.2.6-8 Chris Madison  <madisonblu@hotma...>
   * 'convert existing-image.png -background' no longer generates a fault.
   * -define pdf:use-cropbox=true actually works now.
   * Slight mods to magick/xwindow.c to compile under BEOS (path provided by
     henrimoi@hotma...).
   * #000000 improperly set the opacity channel (bug report and patch from
     digipete@shaw....).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25759 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-21 09:33:59 +00:00
Enrico Forestieri
b706a1ade5 As ImageMagick output is different for different versions, and different (even
incompatible) options are to be used to obtain the same result, it is better
to query the version and accordingly use the needed options (bug 4749).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25758 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-21 08:53:06 +00:00
Pavel Sanda
b8f7bc90c6 Fix bug http://bugzilla.lyx.org/show_bug.cgi?id=4749 .
New versions of Imagemagick do not antialias ppm images used for 
screen presentation of pictures.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25475 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-07 15:09:44 +00:00
Enrico Forestieri
b343446bd4 Fix bug 3400
* lib/scripts/convertDefault.py: Use the cropbox option when the
	source format is pdf and convert supports it.

	* lib/configure.py: Don't define a PDF->PNG converter in order to
	avoid the EPS->PDF->PNG route when converting EPS to a loadable
	format.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17668 a592a061-630c-0410-9148-cb99ea01b6c8
2007-03-31 18:21:54 +00:00
Enrico Forestieri
f44bc0a0d1 Remove uncompatible option from convertDefault.py as it makes unusable
the figure inset on Solaris.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17021 a592a061-630c-0410-9148-cb99ea01b6c8
2007-02-02 01:39:52 +00:00
Uwe Stöhr
31ea73d0d7 fix bug 2418
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16741 a592a061-630c-0410-9148-cb99ea01b6c8
2007-01-18 01:03:23 +00:00
José Matox
37dc5aeabe Convert python scripts to utf-8.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14565 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-08 10:42:59 +00:00
Bo Peng
2ae2c0db71 Remove hardcoded option -tt from python scripts
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14478 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-17 19:41:32 +00:00
Bo Peng
da915923fd Change the encoding of some python scripts from ISO-8859-15 to ISO-8859-1
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14477 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-17 19:37:24 +00:00
Georg Baum
4ae87a3bb8 Call python with the -tt switch to make mixed tab/space indentation an error
* src/support/os.[Ch]
	(python): new function, return the python command

	* lib/lyx2lyx/lyx_1_5.py
	(revert_font_settings): replace tabs with spaces

The rest is simply s/python/python -tt/ and
s/"python"/lyx::support::os::python()/ where appropriate.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14270 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-30 13:54:01 +00:00
Bo Peng
a5a508bdaa Change the indent level of python code from two to four
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14250 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-27 21:08:54 +00:00
Bo Peng
f58609c765 Replace TeXFiles.sh by TeXFiles.py
* src/frontends/controllers/tex_helpers.C: call TeXFiles.py
	* lib/scripts/TeXFiles.py: add
	* lib/scripts/TeXFiles.sh: remove
	* lib/scripts/convertDefault.py: add encoding line
	* lib/Makefile.am


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14238 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-27 02:39:03 +00:00
Bo Peng
5ea7194a60 Generate python code in GraphicsConverter.C, replace convertDefault.sh by convertDefault.py
* src/graphics/GraphicsConverter.C: generate python instead of shell scripts
	* src/converter.C: use convertDefault.py
	* lib/scripts/convertDefault.sh: translated to convertDefault.py


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14223 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-26 14:17:12 +00:00