예제 #1
0
def load_widgets():
    """Load built-in and user widgets.

    Scans the built-in and user widget directories to find the installed widgets and loads it.

    returns OrderedDict

    see: plugins.load_widgets_from_dir() for more details e.g. the structure of the dictionary."""
    # load the "built-in" and "user" widgets
    core_buttons = plugins.load_widgets_from_dir(
        config.widgets_path, default_section=_('Core widgets'))
    local_buttons = plugins.load_widgets_from_dir(
        config.preferences.local_widget_path,
        default_section=_('Custom widgets'))

    # load (remaining) widget code generators
    # Python, C++ and XRC are often loaded via plugins.load_widgets_from_dir() above
    for path in [config.widgets_path, config.preferences.local_widget_path]:
        for lang in ['perl', 'lisp']:
            if lang not in code_writers:
                continue
            codegen_name = '%s_codegen' % code_writers[lang].lang_prefix
            plugins.load_widgets_from_dir(path, submodule=codegen_name)

    all_widgets = OrderedDict()
    all_widgets.update(core_buttons)

    for section in local_buttons:
        if section not in all_widgets:
            all_widgets[section] = local_buttons[section]
        else:
            all_widgets[section].extend(local_buttons[section])

    return all_widgets
예제 #2
0
파일: common.py 프로젝트: ewalshe/wxGlade
def load_config():
    "Load widget configuration;  see: plugins.load_widgets_from_dir()"
    # load the "built-in" and "user" widgets
    plugins.load_widgets_from_dir( config.widgets_path,                  'wconfig' )
    plugins.load_widgets_from_dir( config.preferences.local_widget_path, 'wconfig' )

    return
예제 #3
0
def load_widgets():
    """\
    Load core and user widgets.

    Scans the application 'widgets/' directory as well as the user widgets
    directory to find the installed widgets.

    It loads built-in widgets and "user" widgets. The build-in widgets are
    load from path in L{config.widgets_path}. The user widget path is stored
    in C{config.preferences.local_widget_path}.

    If wxGlade has been started in GUI mode, the function returns two lists
    of wxBitmapButton objects to handle them. The first contains the
    built-in widgets and the second one the user widgets.

    Both lists are empty in the batch mode.

    If widget ZIP files are found, they will be process first and the default
    Python imports will be the second.

    @see: L{plugins.load_widgets_from_dir()}
    """
    # load the "built-in" widgets
    core_buttons = plugins.load_widgets_from_dir(
        config.widgets_path,
    )

    # load the "user" widgets
    local_buttons = plugins.load_widgets_from_dir(
        config.preferences.local_widget_path,
    )

    # load (remaining) widget code generators
    # Python, C++ and XRC are often loaded via
    # plugins.load_widgets_from_dir() above
    for path in [config.widgets_path,
                 config.preferences.local_widget_path]:
        for lang in ['perl', 'lisp']:
            if lang not in code_writers:
                continue
            codegen_name = '%s_codegen' % code_writers[lang].lang_prefix
            plugins.load_widgets_from_dir(
                path,
                submodule=codegen_name,
            )
    return core_buttons, local_buttons
예제 #4
0
def load_config():
    """\
    Load widget configuration.

    @see: L{plugins.load_widgets_from_dir()}
    """
    # load the "built-in" widgets
    plugins.load_widgets_from_dir(
        config.widgets_path,
        'wconfig'
    )

    # load the "user" widgets
    plugins.load_widgets_from_dir(
        config.preferences.local_widget_path,
        'wconfig'
    )

    return