#* #* Moonlight|3D #* Copyright (C) 2005 The Moonlight|3D team #* #* This library is free software; you can redistribute it and/or #* modify it under the terms of the GNU Lesser General Public #* License as published by the Free Software Foundation; either #* version 2.1 of the License, or (at your option) any later version. #* #* This library is distributed in the hope that it will be useful, #* but WITHOUT ANY WARRANTY; without even the implied warranty of #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #* Lesser General Public License for more details. #* #* You should have received a copy of the GNU Lesser General Public #* License along with this library; if not, write to the Free Software #* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #* Created on Jan 7, 2005 import eu.moonlight3d class TestAction(eu.moonlight3d.framework.ui.Action): def __init__(self): eu.moonlight3d.framework.ui.Action.__init__(self,"TestAction","Test tool",None) self.triggered.connect(self,"run()") def run(self): eu.moonlight3d.framework.State.getInstance().logger().info("TestTool.run") state=eu.moonlight3d.framework.State.getInstance() ogManager=state.getDocumentManager().getMainDocument().getOGManager() createPlane=ogManager.createNodeByName("CreatePlane"); createPlane.getProperty("size").setValue(0.5) createBox=ogManager.createNodeByName("CreateBox") createBox.getProperty("size").setValue(0.25) ogManager.update() state=eu.moonlight3d.framework.State.getInstance() if not state.getBatchMode(): uiManager=state.getUIManager() uiManager.registerAction(TestAction()) contribution=eu.moonlight3d.framework.ui.MenuNode(eu.moonlight3d.framework.ui.MenuNode.Type.Contribution,"TestActionContribution","testExtensionPoint") contribution.add(eu.moonlight3d.framework.ui.MenuNode(eu.moonlight3d.framework.ui.MenuNode.Type.Separator,"","")) contribution.add(eu.moonlight3d.framework.ui.MenuNode(eu.moonlight3d.framework.ui.MenuNode.Type.Entry,"Test setup","TestAction")) state.getUIManager().getLayout("mainwindow").addMenuContribution(contribution) state.logger().info("Test tools registered") else: state.logger().info("test.py: headless mode - not registering action")