Ejemplo n.º 1
0
bool reload() {
    if (reloadTables()) {
        activateTables();
        reloadScripts();
        return true;
    }

    return false;

}
Ejemplo n.º 2
0
void ScriptingSystem::initialise()
{
	// The finalize_interpreter() function is not available in older versions
#ifdef DR_PYBIND_HAS_EMBED_H
	py::initialize_interpreter();
#else
	Py_Initialize();
#endif

	{
		try
		{
			// Import the darkradiant module
			py::module::import(PythonModule::NAME());

			// Construct the console writer interface
			PythonConsoleWriterClass consoleWriter(PythonModule::GetModule(), "PythonConsoleWriter");
			consoleWriter.def(py::init<bool, std::string&>());
			consoleWriter.def("write", &PythonConsoleWriter::write);

			// Redirect stdio output to our local ConsoleWriter instances
			py::module::import("sys").attr("stderr") = &_errorWriter;
			py::module::import("sys").attr("stdout") = &_outputWriter;

			// String vector is used in multiple places
			py::bind_vector< std::vector<std::string> >(PythonModule::GetModule(), "StringVector");
		}
		catch (const py::error_already_set& ex)
		{
			rError() << ex.what() << std::endl;
		}
	}

	_initialised = true;

	// Start the init script
	executeScriptFile("init.py");

	// Search script folder for commands
	reloadScripts();

	// Add the scripting widget to the groupdialog
	IGroupDialog::PagePtr page(new IGroupDialog::Page);

	page->name = "ScriptWindow";
	page->windowLabel = _("Script");
	page->page = new ScriptWindow(GlobalMainFrame().getWxTopLevelWindow());
	page->tabIcon = "icon_script.png";
	page->tabLabel = _("Script");
	page->position = IGroupDialog::Page::Position::Console - 10; // insert before console

	GlobalGroupDialog().addPage(page);
}
Ejemplo n.º 3
0
void ScriptingSystem::reloadScriptsCmd(const cmd::ArgumentList& args) 
{
	reloadScripts();
}
Ejemplo n.º 4
0
TWScriptManager::TWScriptManager()
{
	loadPlugins();
	reloadScripts();
}