aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Carroll <thecarrolls@jiminger.com>2012-09-10 15:36:03 -0400
committerJim Carroll <thecarrolls@jiminger.com>2012-09-10 15:36:03 -0400
commit98ef39eaae2c8893647fe0afd0f0ef91135728f3 (patch)
tree6e8649b49ee9ff9da8817b7a07f25ee7717ef48a
parent9b98b2bcf9b27a0ee457d0084a21315fc789ab8b (diff)
[fix] Made it possible to disable keyword parsing and disabled it for every constructor that didn't use it in the old python impl.
-rw-r--r--xbmc/interfaces/python/PythonSwig.cpp.template15
-rw-r--r--xbmc/interfaces/swig/AddonModuleXbmc.i4
-rw-r--r--xbmc/interfaces/swig/AddonModuleXbmcgui.i8
3 files changed, 21 insertions, 6 deletions
diff --git a/xbmc/interfaces/python/PythonSwig.cpp.template b/xbmc/interfaces/python/PythonSwig.cpp.template
index 905d3e5a6e..cc085edb4c 100644
--- a/xbmc/interfaces/python/PythonSwig.cpp.template
+++ b/xbmc/interfaces/python/PythonSwig.cpp.template
@@ -98,6 +98,7 @@ void doMethod(method, MethodType methodType)
String returns = constructor ? 'p.' + clazz : (destructor ? 'void' : Helper.getReturnSwigType(method))
Node classnode = Helper.findClassNode(method)
String classNameAsVariable = clazz == null ? null : PythonTools.getClassNameAsVariable(classnode)
+ boolean useKeywordParsing = !('true' == classnode?.@feature_python_nokwds || 'true' == method?.@feature_python_nokwds)
// do the docs
if (!constructor && !destructor)
@@ -116,13 +117,15 @@ void doMethod(method, MethodType methodType)
{
CLog::Log(LOGDEBUG, "NEWADDON Entering the Python method \\"${PythonTools.getPyMethodName(method,methodType)}\\"");
<% if (numParams > 0)
- { %>
+ {
+ if (useKeywordParsing)
+ { %>
static const char *keywords[] = {<%
params.each { %>
"${it.@name}",<% } %>
NULL};
-
-<% params.each {
+<% }
+ params.each {
%>
${SwigTypeParser.SwigType_str(SwigTypeParser.convertTypeToLTypeForParam(it.@type))} ${it.@name} ${it.@value != null ? ' = ' + it.@value : ''};<%
if (!PythonTools.parameterCanBeUsedDirectly(it))
@@ -130,11 +133,11 @@ void doMethod(method, MethodType methodType)
PyObject* py${it.@name} = NULL;<%
}
} %>
- if (!PyArg_ParseTupleAndKeywords(
+ if (!${useKeywordParsing ? 'PyArg_ParseTupleAndKeywords' : 'PyArg_ParseTuple'}(
args,
- kwds,
+ <% if (useKeywordParsing) { %>kwds,<% } %>
(char*)"<%= PythonTools.makeFormatStringFromParameters(method) %>",
- (char**)keywords,<% params.eachWithIndex { param,i -> %>
+ <% if (useKeywordParsing) { %>(char**)keywords,<% } %><% params.eachWithIndex { param,i -> %>
&${PythonTools.parameterCanBeUsedDirectly(param) ? '' : 'py'}${param.@name}${i < params.size() - 1 ? "," : ""}<% } %>
))
{
diff --git a/xbmc/interfaces/swig/AddonModuleXbmc.i b/xbmc/interfaces/swig/AddonModuleXbmc.i
index ff36f38efd..2e04ef89ce 100644
--- a/xbmc/interfaces/swig/AddonModuleXbmc.i
+++ b/xbmc/interfaces/swig/AddonModuleXbmc.i
@@ -109,6 +109,10 @@ using namespace xbmc;
return Py_None;
}
+%feature("python:nokwds") XBMCAddon::xbmc::Keyboard::Keyboard "true"
+%feature("python:nokwds") XBMCAddon::xbmc::Player::Player "true"
+%feature("python:nokwds") XBMCAddon::xbmc::PlayList::PlayList "true"
+
%include "interfaces/legacy/Player.h"
// TODO: This needs to be done with a class that holds the Image
diff --git a/xbmc/interfaces/swig/AddonModuleXbmcgui.i b/xbmc/interfaces/swig/AddonModuleXbmcgui.i
index 6f7cd05272..4d33575424 100644
--- a/xbmc/interfaces/swig/AddonModuleXbmcgui.i
+++ b/xbmc/interfaces/swig/AddonModuleXbmcgui.i
@@ -117,12 +117,20 @@ using namespace xbmcgui;
return result;
}
+%feature("ref") Control "${ths}->Acquire();"
+%feature("unref") Control "${ths}->Release();"
%feature("python:coerceToUnicode") XBMCAddon::xbmcgui::ControlButton::getLabel "true"
%feature("python:coerceToUnicode") XBMCAddon::xbmcgui::ControlButton::getLabel2 "true"
%include "interfaces/legacy/Control.h"
%include "interfaces/legacy/Dialog.h"
+%feature("python:nokwds") XBMCAddon::xbmcgui::Dialog::Dialog "true"
+%feature("python:nokwds") XBMCAddon::xbmcgui::Window::Window "true"
+%feature("python:nokwds") XBMCAddon::xbmcgui::WindowXML::WindowXML "true"
+%feature("python:nokwds") XBMCAddon::xbmcgui::WindowXMLDialog::WindowXMLDialog "true"
+%feature("python:nokwds") XBMCAddon::xbmcgui::WindowDialog::WindowDialog "true"
+
%feature("director") Window;
%feature("ref") Window "${ths}->Acquire();"
%feature("unref") Window "${ths}->Release();"