Example #1
0
#sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) -- no longer needed
import pyklfuserscript


args = pyklfuserscript.export_type_args_parser().parse_args()

format = args.format
dvifile = args.inputfile

if args.query_default_settings:

    dvisvgm = pyklfuserscript.find_executable(['dvisvgm'], [
        "/usr/texbin/",
        "/usr/local/texbin/",
        "/Library/TeX/texbin/",
        # add more non-trivial paths here (but not necessary to include /usr/bin/
        # because we do a PATH search anyway
    ])
    if dvisvgm is not None:
        # found
        print("dvisvgm={}".format(dvisvgm))
    gzip = pyklfuserscript.find_executable(['gzip'], [
        "/usr/bin", "/bin", "/usr/local/bin"
    ])
    if gzip is not None:
        print("gzip={}".format(gzip))

    sys.exit(0)

import os
import sys
import os.path
import argparse
import subprocess

sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import pyklfuserscript

args = pyklfuserscript.export_type_args_parser().parse_args()

if args.query_default_settings:
    convert = pyklfuserscript.find_executable(
        ['convert'],
        [
            '/opt/local/bin',
            os.path.join(os.environ.get('MAGICK_HOME', ''), 'bin')
            # add more non-trivial paths here (but not necessary to include /usr/bin/
            # because we do a PATH search anyway
        ])
    if convert is not None:
        # found
        print("convert={}".format(convert))
    sys.exit(0)

format = args.format
pngfile = args.inputfile

if format != 'gif':
    print("Invalid format: ", format)
    sys.exit(1)
Example #3
0
    return int(math.floor(x) + 0.01)


args = pyklfuserscript.backend_engine_args_parser(can_query_default_settings=True).parse_args()

if args.query_default_settings:

    tex_bin_paths = [
        "/usr/texbin/",
        "/usr/local/texbin/",
        "/Library/TeX/texbin/",
        # add more non-trivial paths here (but not necessary to include /usr/bin/
        # because we do a PATH search anyway
    ]

    pdflatex = pyklfuserscript.find_executable(['pdflatex'], tex_bin_paths)
    if pdflatex is not None:
        print("pdflatex={}".format(pdflatex))
    xelatex = pyklfuserscript.find_executable(['xelatex'], tex_bin_paths)
    if xelatex is not None:
        print("xelatex={}".format(xelatex))
    lualatex = pyklfuserscript.find_executable(['lualatex'], tex_bin_paths)
    if lualatex is not None:
        print("lualatex={}".format(lualatex))

    sys.exit(0)


latexfname = args.texfile
pdffname = os.environ["KLF_FN_PDF"]
pngfname = os.environ["KLF_FN_PNG"]
Example #4
0
import sys
import os
import subprocess

import pyklfuserscript
args = pyklfuserscript.export_type_args_parser().parse_args()

#
# script is being run in "--query-default-settings" mode (since we set
# <can-provide-default-settings> in scriptinfo.xml)
#
if args.query_default_settings:
    convert = pyklfuserscript.find_executable(
        ['convert'],
        [
            '/usr/local/bin',
            '/opt/local/bin',
            # add more paths to search for here (but $PATH is searched for anyway, so it's not
            # necessary to include /usr/bin/ etc.)
        ])
    if convert is not None:  # found
        print("convert={}".format(convert))
    sys.exit()

#
# Run script
#

format = args.format
inputfile = args.inputfile

#
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import pyklfuserscript


args = pyklfuserscript.export_type_args_parser().parse_args()

format = args.format
dvifile = args.inputfile

if args.query_default_settings:

    dvisvgm = pyklfuserscript.find_executable(['dvisvgm'], [
        "/usr/texbin/",
        "/usr/local/texbin/",
        "/Library/TeX/texbin/",
        # add more non-trivial paths here (but not necessary to include /usr/bin/
        # because we do a PATH search anyway
    ])
    if dvisvgm is not None:
        # found
        print("dvisvgm={}".format(dvisvgm))
    gzip = pyklfuserscript.find_executable(['gzip'], [
        "/usr/bin", "/bin", "/usr/local/bin"
    ])
    if gzip is not None:
        print("gzip={}".format(gzip))

    sys.exit(0)

FORMATS = (
    'svg',
    'emf',
    'wmf',
)

args = pyklfuserscript.export_type_args_parser().parse_args()

if args.query_default_settings:

    inkscape = pyklfuserscript.find_executable(
        ['inkscape'],
        [
            "/Applications/Inkscape.app/Contents/Resources/bin/",
            "C:/Program Files/Inkscape/",
            "C:/Program Files (x86)/Inkscape/",
            # add more non-trivial paths here (but not necessary to include /usr/bin/
            # because we do a PATH search anyway
        ])
    if inkscape is not None:
        # found
        print("""\
<?xml version='1.0' encoding='UTF-8'?>
<klfuserscript-default-settings>
   <pair>
      <key>inkscape</key>
      <value type="QString">{}</value>
   </pair>
</klfuserscript-default-settings>
""".format(
import subprocess

sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import pyklfuserscript


FORMATS = ('svg', 'emf', 'wmf', )

args = pyklfuserscript.export_type_args_parser().parse_args()

if args.query_default_settings:

    inkscape = pyklfuserscript.find_executable(['inkscape'], [
        "/Applications/Inkscape.app/Contents/Resources/bin/",
        "C:/Program Files/Inkscape/",
        "C:/Program Files (x86)/Inkscape/",
        # add more non-trivial paths here (but not necessary to include /usr/bin/
        # because we do a PATH search anyway
    ])
    if inkscape is not None:
        # found
        print("""\
<?xml version='1.0' encoding='UTF-8'?>
<klfuserscript-default-settings>
   <pair>
      <key>inkscape</key>
      <value type="QString">{}</value>
   </pair>
</klfuserscript-default-settings>
""".format(pyklfuserscript.escapexml(pyklfuserscript.saveStringForKlfVariantText(inkscape))))
    sys.exit(0)