コード例 #1
0
ファイル: win32.py プロジェクト: B4rtD4ft/nuxeo-drive
def register_protocol_handlers(controller):
    """Register ndrive as a protocol handler in the Registry"""
    import _winreg

    exe_path = find_exe_path()
    if exe_path is None:
        log.warning("Not a frozen windows exe: " "skipping protocol handler registration")
        return

    log.debug("Registering 'nxdrive' protocol handler to: %s", exe_path)
    reg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)

    # Register Nuxeo Drive as a software as a protocol command provider
    command = '"' + exe_path + '" "%1"'
    update_win32_reg_key(reg, "Software\\Nuxeo Drive", [("", _winreg.REG_SZ, "Nuxeo Drive")])
    # TODO: add an icon for Nuxeo Drive too
    update_win32_reg_key(reg, "Software\\Nuxeo Drive\\Protocols\\nxdrive", [("URL Protocol", _winreg.REG_SZ, "")])
    # TODO: add an icon for the nxdrive protocol too
    update_win32_reg_key(
        reg, "Software\\Nuxeo Drive\\Protocols\\nxdrive\\shell\\open\\command", [("", _winreg.REG_SZ, command)]
    )
    # Create the nxdrive protocol key
    nxdrive_class_path = "Software\\Classes\\nxdrive"
    update_win32_reg_key(
        reg,
        nxdrive_class_path,
        [
            ("EditFlags", _winreg.REG_DWORD, 2),
            ("", _winreg.REG_SZ, "URL:nxdrive Protocol"),
            ("URL Protocol", _winreg.REG_SZ, ""),
        ],
    )
    # Create the nxdrive command key
    command_path = nxdrive_class_path + "\\shell\\open\\command"
    update_win32_reg_key(reg, command_path, [("", _winreg.REG_SZ, command)])
コード例 #2
0
ファイル: win32.py プロジェクト: mzly84/nuxeo-drive
def register_protocol_handlers(controller):
    """Register ndrive as a protocol handler in the Registry"""
    import _winreg

    exe_path = find_exe_path()
    if exe_path is None:
        log.warning('Not a frozen windows exe: '
                    'skipping protocol handler registration')
        return

    log.debug("Registering 'nxdrive' protocol handler to: %s", exe_path)
    reg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)

    # Register Nuxeo Drive as a software as a protocol command provider
    command = '"' + exe_path + '" "%1"'
    update_win32_reg_key(
        reg,
        'Software\\Nuxeo Drive',
        [('', _winreg.REG_SZ, 'Nuxeo Drive')],
    )
    # TODO: add an icon for Nuxeo Drive too
    update_win32_reg_key(
        reg,
        'Software\\Nuxeo Drive\\Protocols\\nxdrive',
        [('URL Protocol', _winreg.REG_SZ, '')],
    )
    # TODO: add an icon for the nxdrive protocol too
    update_win32_reg_key(
        reg,
        'Software\\Nuxeo Drive\\Protocols\\nxdrive\\shell\\open\\command',
        [('', _winreg.REG_SZ, command)],
    )
    # Create the nxdrive protocol key
    nxdrive_class_path = 'Software\\Classes\\nxdrive'
    update_win32_reg_key(
        reg,
        nxdrive_class_path,
        [
            ('EditFlags', _winreg.REG_DWORD, 2),
            ('', _winreg.REG_SZ, 'URL:nxdrive Protocol'),
            ('URL Protocol', _winreg.REG_SZ, ''),
        ],
    )
    # Create the nxdrive command key
    command_path = nxdrive_class_path + '\\shell\\open\\command'
    update_win32_reg_key(
        reg,
        command_path,
        [('', _winreg.REG_SZ, command)],
    )
コード例 #3
0
def register_startup_win32():
    """Register ndrive as a startup application in the Registry"""
    import _winreg

    reg_key = 'Software\\Microsoft\\Windows\\CurrentVersion\\Run'
    app_name = 'Nuxeo Drive'
    exe_path = find_exe_path()
    if exe_path is None:
        log.warning('Not a frozen windows exe: '
                 'skipping startup application registration')
        return

    log.debug("Registering '%s' application %s to registry key %s",
        app_name, exe_path, reg_key)
    reg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
    update_win32_reg_key(
        reg, reg_key,
        [(app_name, _winreg.REG_SZ, exe_path)],
    )
コード例 #4
0
ファイル: __init__.py プロジェクト: jowensla/nuxeo-drive
def register_contextual_menu_win32():
    """Register ndrive as a Windows explorer contextual menu entry"""
    import _winreg

    # TODO: better understand why / how this works.
    # See https://jira.nuxeo.com/browse/NXDRIVE-120
    app_name = "None"
    args = " metadata --file \"%1\""
    exe_path = find_exe_path() + args
    if exe_path is None:
        log.warning('Not a frozen windows exe: '
                    'skipping startup application registration')
        return

    log.debug("Registering '%s' application %s to registry key %s",
              app_name, exe_path, REG_KEY)
    reg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
    update_win32_reg_key(
        reg, REG_KEY,
        [(app_name, _winreg.REG_SZ, exe_path)],
    )
コード例 #5
0
def register_contextual_menu_win32():
    """Register ndrive as a Windows explorer contextual menu entry"""
    import _winreg

    # TODO: better understand why / how this works.
    # See https://jira.nuxeo.com/browse/NXDRIVE-120
    app_name = "None"
    args = " metadata --file \"%1\""
    exe_path = find_exe_path() + args
    if exe_path is None:
        log.warning('Not a frozen windows exe: '
                    'skipping startup application registration')
        return

    log.debug("Registering '%s' application %s to registry key %s", app_name,
              exe_path, REG_KEY)
    reg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
    update_win32_reg_key(
        reg,
        REG_KEY,
        [(app_name, _winreg.REG_SZ, exe_path)],
    )