import glob
import logging
import argparse
import re
import codecs
from bs4 import BeautifulSoup

# Import common scripts
CWD = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, CWD)
sys.path.insert(0, os.path.normpath(os.path.join(CWD, '..', '..')))

# Import common shortcut mapper library
import shmaplib

log = shmaplib.setuplog(os.path.join(CWD, 'output.log'))


class RawDocsParser(object):
    """This parser scrapes shortcuts and contexts from the maya documentation html file, such as:
    http://download.autodesk.com/global/docs/maya2014/en_us/index.html?url=files/Keyboard_Shortcuts.htm

    It assumes the main relevant data is contained in a wrapper div: <div class="body_content">...</div>
    From the contents of this div, it can extract shortcut contexts, shortcut names and keys for Windows and MacOS
    """
    def __init__(self):
        super(RawDocsParser, self).__init__()
        self.idata = shmaplib.IntermediateShortcutData("Autodesk Maya")

    def _clean_text(self, text):
        text = text.replace(u'\n', u' ').strip(u' ').replace(u'\xa0', u' ')
Пример #2
0
# 运行这个脚本之前,请确保本脚本所在文件夹中有 intermediate.json
"""

import os
import sys
import logging

# 将资料库根目录加到 sys.path (这会使 import shmaplib 正常工作)
CWD = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, CWD)
sys.path.insert(0, os.path.normpath(os.path.join(CWD, '..', '..')))

# 导入 shmaplib 库
import shmaplib


def export_intermediate_file(file_path, explicit_numpad_mode):
    """
    将中间文件添加
    """
    log.info("Exporting from file: %s", file_path)
    exporter = shmaplib.IntermediateDataExporter(file_path,
                                                 explicit_numpad_mode)
    exporter.parse()
    exporter.export()


log = shmaplib.setuplog()
log.setLevel(logging.INFO)
export_intermediate_file('intermediate.json', True)
Пример #3
0
import sys
import os
import logging

CWD = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, CWD)
sys.path.insert(0, os.path.normpath(os.path.join(CWD, '..', '..')))

# Import common shortcut mapper library
import shmaplib
log = shmaplib.setuplog(os.path.join(CWD, 'output.log'))

# Import blender related stuff
import bpy
import exporter_utils as util


def parse_main_keyconfig(app):
    """The beef, this gets all keyconfigs from blender and converts blender data into
    our specific format."""

    keyconfig = bpy.context.window_manager.keyconfigs[0]

    # Find all keymaps
    for keymap in keyconfig.keymaps:
        if keymap.name in util.KEYMAPS_IGNORE:
            continue

        # Apply keymap name overrides
        keymap_name = keymap.name
        if keymap.name in util.KEYMAP_NAME_OVERRIDES.keys():
Пример #4
0
import os
import sys

# Add root dir to PATH env var
CWD = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, CWD)
sys.path.insert(0, os.path.normpath(os.path.join(CWD, '..')))

import tests
import shmaplib

shmaplib.setuplog()

if __name__ == '__main__':
    tests.main()
"""
# 脚本功能:将中间文件 intermediate.json 中的快捷键更新到 ShortcutMapper 的数据中(content 文件夹中)

# 运行这个脚本之前,请确保本脚本所在文件夹中有 intermediate.json
"""

import os
import sys
import csv
import logging

# 将资料库根目录加到 sys.path (这会使 import shmaplib 正常工作)
CWD = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, CWD)
sys.path.insert(0, os.path.normpath(os.path.join(CWD, '..', '..')))

# 导入 shmaplib 库
import shmaplib


def export_intermediate_file(file_path, explicit_numpad_mode):
    log.info("Exporting from file: %s", file_path)
    exporter = shmaplib.IntermediateDataExporter(file_path,
                                                 explicit_numpad_mode)
    exporter.parse()
    exporter.export()


log = shmaplib.setuplog(None)
log.setLevel(logging.INFO)
export_intermediate_file('intermediate.json', True)