Python matplotlib.checkdep_inkscape() Examples

The following are 9 code examples of matplotlib.checkdep_inkscape(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module matplotlib , or try the search function .
Example #1
Source File: compare.py    From neural-network-animation with MIT License 6 votes vote down vote up
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        cmd = lambda old, new: \
            [gs, '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
             '-sOutputFile=' + new, old]
        converter['pdf'] = make_external_conversion_command(cmd)
        converter['eps'] = make_external_conversion_command(cmd)

    if matplotlib.checkdep_inkscape() is not None:
        cmd = lambda old, new: \
            ['inkscape', '-z', old, '--export-png', new]
        converter['svg'] = make_external_conversion_command(cmd)


#: A dictionary that maps filename extensions to functions which
#: themselves map arguments `old` and `new` (filenames) to a list of strings.
#: The list can then be passed to Popen to convert files with that
#: extension to png format. 
Example #2
Source File: compare.py    From GraphicDesignPatternByPython with MIT License 6 votes vote down vote up
def get_file_hash(path, block_size=2 ** 20):
    md5 = hashlib.md5()
    with open(path, 'rb') as fd:
        while True:
            data = fd.read(block_size)
            if not data:
                break
            md5.update(data)

    if path.endswith('.pdf'):
        from matplotlib import checkdep_ghostscript
        md5.update(checkdep_ghostscript()[1].encode('utf-8'))
    elif path.endswith('.svg'):
        from matplotlib import checkdep_inkscape
        md5.update(checkdep_inkscape().encode('utf-8'))

    return md5.hexdigest() 
Example #3
Source File: compare.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def get_file_hash(path, block_size=2 ** 20):
    md5 = hashlib.md5()
    with open(path, 'rb') as fd:
        while True:
            data = fd.read(block_size)
            if not data:
                break
            md5.update(data)

    if path.endswith('.pdf'):
        from matplotlib import checkdep_ghostscript
        md5.update(checkdep_ghostscript()[1].encode('utf-8'))
    elif path.endswith('.svg'):
        from matplotlib import checkdep_inkscape
        md5.update(checkdep_inkscape().encode('utf-8'))

    return md5.hexdigest() 
Example #4
Source File: compare.py    From coffeegrindsize with MIT License 6 votes vote down vote up
def get_file_hash(path, block_size=2 ** 20):
    md5 = hashlib.md5()
    with open(path, 'rb') as fd:
        while True:
            data = fd.read(block_size)
            if not data:
                break
            md5.update(data)

    if path.endswith('.pdf'):
        from matplotlib import checkdep_ghostscript
        md5.update(checkdep_ghostscript()[1].encode('utf-8'))
    elif path.endswith('.svg'):
        from matplotlib import checkdep_inkscape
        md5.update(checkdep_inkscape().encode('utf-8'))

    return md5.hexdigest() 
Example #5
Source File: compare.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
def get_file_hash(path, block_size=2 ** 20):
    md5 = hashlib.md5()
    with open(path, 'rb') as fd:
        while True:
            data = fd.read(block_size)
            if not data:
                break
            md5.update(data)

    if path.endswith('.pdf'):
        from matplotlib import checkdep_ghostscript
        md5.update(checkdep_ghostscript()[1].encode('utf-8'))
    elif path.endswith('.svg'):
        from matplotlib import checkdep_inkscape
        md5.update(checkdep_inkscape().encode('utf-8'))

    return md5.hexdigest() 
Example #6
Source File: compare.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        def cmd(old, new):
            return [str(gs), '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
             '-sOutputFile=' + new, old]
        converter['pdf'] = make_external_conversion_command(cmd)
        converter['eps'] = make_external_conversion_command(cmd)

    if matplotlib.checkdep_inkscape() is not None:
        converter['svg'] = _SVGConverter()


#: A dictionary that maps filename extensions to functions which
#: themselves map arguments `old` and `new` (filenames) to a list of strings.
#: The list can then be passed to Popen to convert files with that
#: extension to png format. 
Example #7
Source File: compare.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        converter['pdf'] = converter['eps'] = _GSConverter()
    if matplotlib.checkdep_inkscape() is not None:
        converter['svg'] = _SVGConverter()


#: A dictionary that maps filename extensions to functions which
#: themselves map arguments `old` and `new` (filenames) to a list of strings.
#: The list can then be passed to Popen to convert files with that
#: extension to png format. 
Example #8
Source File: compare.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        converter['pdf'] = converter['eps'] = _GSConverter()
    if matplotlib.checkdep_inkscape() is not None:
        converter['svg'] = _SVGConverter()


#: A dictionary that maps filename extensions to functions which
#: themselves map arguments `old` and `new` (filenames) to a list of strings.
#: The list can then be passed to Popen to convert files with that
#: extension to png format. 
Example #9
Source File: compare.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        converter['pdf'] = converter['eps'] = _GSConverter()
    if matplotlib.checkdep_inkscape() is not None:
        converter['svg'] = _SVGConverter()


#: A dictionary that maps filename extensions to functions which
#: themselves map arguments `old` and `new` (filenames) to a list of strings.
#: The list can then be passed to Popen to convert files with that
#: extension to png format.