Exemplo n.º 1
0
def get_inkscape_path():
    """ Return the Inkscape path """
    from six.moves import winreg
    try:
        svgexepath = winreg.QueryValue(
            winreg.HKEY_LOCAL_MACHINE,
            'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
    except OSError:
        svgexepath = winreg.QueryValue(
            winreg.HKEY_LOCAL_MACHINE,
            'Software\\Classes\\inkscape.svg\\shell\\open\\command')
    svgexepath = svgexepath.replace('"%1"', '')
    return svgexepath.replace('"', '')
Exemplo n.º 2
0
    def _check_reg(self, sub_key):
        # see comments in check_httpd(), above, for why this routine exists and what it's doing.
        try:
            # Note that we HKCR is a union of HKLM and HKCR (with the latter
            # overriding the former), so reading from HKCR ensures that we get
            # the value if it is set in either place. See als comments below.
            hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, sub_key)
            args = _winreg.QueryValue(hkey, '').split()
            _winreg.CloseKey(hkey)

            # In order to keep multiple checkouts from stepping on each other, we simply check that an
            # existing entry points to a valid path and has the right command line.
            if (len(args) == 2 and self._filesystem.exists(args[0])
                    and args[0].endswith('perl.exe') and args[1] == '-wT'):
                return True
        except WindowsError as error:  # WindowsError is not defined on non-Windows platforms - pylint: disable=undefined-variable
            if error.errno != errno.ENOENT:
                raise
            # The key simply probably doesn't exist.

        # Note that we write to HKCU so that we don't need privileged access
        # to the registry, and that will get reflected in HKCR when it is read, above.
        cmdline = self._path_from_chromium_base('third_party', 'perl', 'perl',
                                                'bin', 'perl.exe') + ' -wT'
        hkey = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER,
                                   'Software\\Classes\\' + sub_key, 0,
                                   _winreg.KEY_WRITE)
        _winreg.SetValue(hkey, '', _winreg.REG_SZ, cmdline)
        _winreg.CloseKey(hkey)
        return True
Exemplo n.º 3
0
def get_inkscape_path():
    """ Return the Inkscape path """
    if wx.Platform == '__WXMSW__':
        from six.moves import winreg
        try:
            svgexepath = winreg.QueryValue(
                winreg.HKEY_LOCAL_MACHINE,
                'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
        except OSError:
            svgexepath = winreg.QueryValue(
                winreg.HKEY_LOCAL_MACHINE,
                'Software\\Classes\\inkscape.svg\\shell\\open\\command')
        svgexepath = svgexepath.replace('"%1"', '').strip()
        return svgexepath.replace('"', '')
    else:
        # TODO: search path
        return os.path.join("/usr/bin", "inkscape")
Exemplo n.º 4
0
def get_acroversion():
    " Return version of Adobe Acrobat executable or None"
    from six.moves import winreg
    adobesoft = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'Software\Adobe')
    for index in range(winreg.QueryInfoKey(adobesoft)[0]):
        key = winreg.EnumKey(adobesoft, index)
        if "acrobat" in key.lower():
            acrokey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
                                     'Software\\Adobe\\%s' % key)
            for index in range(winreg.QueryInfoKey(acrokey)[0]):
                numver = winreg.EnumKey(acrokey, index)
                try:
                    res = winreg.QueryValue(
                        winreg.HKEY_LOCAL_MACHINE,
                        'Software\\Adobe\\%s\\%s\\InstallPath' % (key, numver))
                    return res
                except Exception:
                    pass
    return None