コード例 #1
0
def install():
    from openalea.deploy.shortcut import create_win_shortcut
    from openalea.deploy import get_base_dir
    import sys
    from os.path import join as pj

    from openalea.oalab.project.symlink import create_project_shortcut

    create_project_shortcut()

    # Get the location of the installed egg
    base_dir = get_base_dir('openalea.oalab')
    share_dir = pj(base_dir, 'share')

    winexe = sys.executable
    winexe = winexe.replace('python.exe', 'pythonw.exe')

    prefix = base_dir.lower().split("lib")[0]

    create_win_shortcut(name='OALab',
                        target=winexe,
                        arguments='"' +
                        pj(sys.prefix, 'Scripts', 'oalab-script.pyw') + '"',
                        startin="",
                        icon=pj(share_dir, 'openalea_icon.ico'),
                        description="OpenAleaLab",
                        menugroup="OpenAlea")
コード例 #2
0
ファイル: oalab_postinstall.py プロジェクト: gbaty/openalea
def install():
    from openalea.deploy.shortcut import create_win_shortcut
    from openalea.deploy import get_base_dir
    import sys
    from os.path import join as pj

    from openalea.oalab.project.symlink import create_project_shortcut

    create_project_shortcut()

    # Get the location of the installed egg
    base_dir = get_base_dir("openalea.oalab")
    share_dir = pj(base_dir, "share")

    winexe = sys.executable
    winexe = winexe.replace("python.exe", "pythonw.exe")

    prefix = base_dir.lower().split("lib")[0]

    create_win_shortcut(
        name="OALab",
        target=winexe,
        arguments='"' + pj(sys.prefix, "Scripts", "oalab-script.pyw") + '"',
        startin="",
        icon=pj(share_dir, "openalea_icon.ico"),
        description="OpenAleaLab",
        menugroup="OpenAlea",
    )
コード例 #3
0
def main():
    """
    1. Parse command line arguments.
    2. If GUI enabled (session.gui), launch QApplication
    3. Search an extension in "oalab.extension" plugins.
        - If found, launch extension
        - If not found, quit application and shows available extensions
    """

    create_project_shortcut()
    session = Session()
    cli = CommandLineParser(session=session)
    cli.parse()

    if session.gui:
        from openalea.vpltk.qt import QtGui
        from openalea.oalab.gui.mainwindow import MainWindow

        app = QtGui.QApplication(sys.argv)

        win = None
        # Run all extension matching session.extension
        available_extensions = []

        if session.extension == '':
            session.extension = 'plant'
        for plugin_class in plugins('oalab.lab'):
            try:
                ext = plugin_class.name
            except AttributeError:
                continue
            else:
                # register plugin info for user.
                args = dict(EXT=ext, MODULE=plugin_class.__module__, CLASS=plugin_class.__name__)
                text = '  - \033[94m%(EXT)s\033[0m (provided by class %(CLASS)s defined in %(MODULE)s)' % args
                available_extensions.append(text)

            if session.extension == ext:
                plugin = plugin_class()
                win = MainWindow(session)
                debug_plugin('oalab.lab', func=plugin, func_args=[win])
                win.show()
                win.raise_()
                break

        if win:
            app.exec_()
        else:
            print 'Extension %r not found' % session.extension
            print 'Please choose a valid \033[94mextension\033[0m:'
            print '\n'.join(available_extensions)