#* #* 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 ml class TestAction(ml.ui.core.Action): def __init__(self): ml.ui.core.Action.__init__(self,"TestAction","Test tool",None) self.setDefaultMenuLocation("Test/Test setup") self.triggered.connect(self,"run()") def run(self): ml.core.State.getInstance().logger().info("TestTool.run") state=ml.core.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=ml.core.State.getInstance() uiManager=state.getUIManager() uiManager.registerAction(TestAction()) contribution=ml.ui.core.MenuNode(ml.ui.core.MenuNode.Type.Contribution,"TestActionContribution","testExtensionPoint") contribution.add(ml.ui.core.MenuNode(ml.ui.core.MenuNode.Type.Separator,"","")) contribution.add(ml.ui.core.MenuNode(ml.ui.core.MenuNode.Type.Entry,"Test setup","TestAction")) state.getUIManager().getLayout("mainwindow").addMenuContribution(contribution) state.logger().info("Test tools registered")