コード例 #1
0
ファイル: main.py プロジェクト: gbaty/openalea
def launch_lab(plugin_class):
    from openalea.oalab.widget.splittablewindow import OALabMainWin
    from openalea.core.settings import get_openalea_home_dir
    from openalea.core.path import path as Path
    from openalea.core.service.introspection import label
    from openalea.oalab.utils import qicon

    plugin = plugin_class()
    lab_class = plugin()
    layout_path = Path(get_openalea_home_dir()) / '%s.oaui' % lab_class.name
    OALabMainWin.DEFAULT_LAYOUT_PATH = layout_path
    OALabMainWin.DEFAULT_LAYOUT = lab_class.layout
    OALabMainWin.DEFAULT_MENU_NAMES = lab_class.menu_names
    OALabMainWin.LAB = lab_class
    if hasattr(lab_class, "start"):
        lab_class.start()
    win = OALabMainWin(lab=lab_class, autosave=True)
    win.setWindowIcon(qicon(lab_class.icon))
    if hasattr(lab_class, 'connect_applet'):
        win.appletSet.connect(lab_class.connect_applet)
    win.emit_applet_set()
    win.initialize()
    if hasattr(lab_class, "initialize"):
        lab_class.initialize()

    win.setWindowTitle('OpenAleaLab "%s"' % label(plugin))
    win.showMaximized()
    win.raise_()

    return win
コード例 #2
0
ファイル: main.py プロジェクト: rjcmarkelz/openalea
def launch_lab(plugin_class):
    from openalea.oalab.widget.splittablewindow import OALabMainWin
    from openalea.core.settings import get_openalea_home_dir
    from openalea.core.path import path as Path
    from openalea.core.service.introspection import label
    from openalea.oalab.utils import qicon

    plugin = plugin_class()
    lab_class = plugin()
    layout_path = Path(get_openalea_home_dir()) / '%s.oaui' % lab_class.name
    OALabMainWin.DEFAULT_LAYOUT_PATH = layout_path
    OALabMainWin.DEFAULT_LAYOUT = lab_class.layout
    OALabMainWin.DEFAULT_MENU_NAMES = lab_class.menu_names
    OALabMainWin.LAB = lab_class
    if hasattr(lab_class, "start"):
        lab_class.start()
    win = OALabMainWin(lab=lab_class, autosave=True)
    win.setWindowIcon(qicon(lab_class.icon))
    if hasattr(lab_class, 'connect_applet'):
        win.appletSet.connect(lab_class.connect_applet)
    win.emit_applet_set()
    win.initialize()
    if hasattr(lab_class, "initialize"):
        lab_class.initialize()

    win.setWindowTitle('OpenAleaLab "%s"' % label(plugin))
    win.showMaximized()
    win.raise_()

    return win