Commit 7cee0569 authored by Sven Brauch's avatar Sven Brauch
Browse files

Documentation files for PyKDE and the missing PyQt modules.

BUG:309469
This probably needs a bit more work, especially support for
class c(): class d(): pass
a = c.d()
parent fc4d30bc
This diff is collapsed.
class pyqtSignal():
def connect(self, targetSignal): pass
def emit(self, *args): pass
from QtCore import *
class DNSSD():
""""""
class ServiceModel(QAbstractItemModel):
""""""
# Enum DNSSD.ServiceModel.ModelColumns
ServiceName = 0
Host = 0
Port = 0
# Enum DNSSD.ServiceModel.AdditionalRoles
ServicePtrRole = 0
def __init__(self, browser, parent = None):
'''void DNSSD.ServiceModel.__init__(DNSSD.ServiceBrowser browser, QObject parent = None)'''
def hasIndex(self, row, column, parent):
'''bool DNSSD.ServiceModel.hasIndex(int row, int column, QModelIndex parent)'''
return bool()
def headerData(self, section, orientation, role = None):
'''QVariant DNSSD.ServiceModel.headerData(int section, Qt.Orientation orientation, int role = Qt.DisplayRole)'''
return QVariant()
def data(self, index, role = None):
'''QVariant DNSSD.ServiceModel.data(QModelIndex index, int role = Qt.DisplayRole)'''
return QVariant()
def index(self, row, column, parent = QModelIndex()):
'''QModelIndex DNSSD.ServiceModel.index(int row, int column, QModelIndex parent = QModelIndex())'''
return QModelIndex()
def parent(self, index):
'''QModelIndex DNSSD.ServiceModel.parent(QModelIndex index)'''
return QModelIndex()
def rowCount(self, parent = QModelIndex()):
'''int DNSSD.ServiceModel.rowCount(QModelIndex parent = QModelIndex())'''
return int()
def columnCount(self, parent = QModelIndex()):
'''int DNSSD.ServiceModel.columnCount(QModelIndex parent = QModelIndex())'''
return int()
class RemoteService(QObject, DNSSD.ServiceBase):
""""""
def __init__(self, name, type, domain):
'''void DNSSD.RemoteService.__init__(QString name, QString type, QString domain)'''
def virtual_hook(self, id, data):
'''void DNSSD.RemoteService.virtual_hook(int id, sip.voidptr data)'''
resolved = pyqtSignal() # void resolved(bool) - signal
def isResolved(self):
'''bool DNSSD.RemoteService.isResolved()'''
return bool()
def resolve(self):
'''bool DNSSD.RemoteService.resolve()'''
return bool()
def resolveAsync(self):
'''void DNSSD.RemoteService.resolveAsync()'''
class DomainBrowser(QObject):
""""""
# Enum DNSSD.DomainBrowser.DomainType
Browsing = 0
Publishing = 0
def __init__(self, type, parent = None):
'''void DNSSD.DomainBrowser.__init__(DNSSD.DomainBrowser.DomainType type, QObject parent = None)'''
domainAdded = pyqtSignal() # void domainAdded(const QStringamp;) - signal
domainRemoved = pyqtSignal() # void domainRemoved(const QStringamp;) - signal
def isRunning(self):
'''bool DNSSD.DomainBrowser.isRunning()'''
return bool()
def startBrowse(self):
'''void DNSSD.DomainBrowser.startBrowse()'''
def domains(self):
'''QStringList DNSSD.DomainBrowser.domains()'''
return QStringList()
class DomainModel(QAbstractItemModel):
""""""
def __init__(self, browser, parent = None):
'''void DNSSD.DomainModel.__init__(DNSSD.DomainBrowser browser, QObject parent = None)'''
def hasIndex(self, row, column, parent):
'''bool DNSSD.DomainModel.hasIndex(int row, int column, QModelIndex parent)'''
return bool()
def data(self, index, role = None):
'''QVariant DNSSD.DomainModel.data(QModelIndex index, int role = Qt.DisplayRole)'''
return QVariant()
def index(self, row, column, parent = QModelIndex()):
'''QModelIndex DNSSD.DomainModel.index(int row, int column, QModelIndex parent = QModelIndex())'''
return QModelIndex()
def parent(self, index):
'''QModelIndex DNSSD.DomainModel.parent(QModelIndex index)'''
return QModelIndex()
def rowCount(self, parent = QModelIndex()):
'''int DNSSD.DomainModel.rowCount(QModelIndex parent = QModelIndex())'''
return int()
def columnCount(self, parent = QModelIndex()):
'''int DNSSD.DomainModel.columnCount(QModelIndex parent = QModelIndex())'''
return int()
class ServiceTypeBrowser(QObject):
""""""
def __init__(self, domain = QString(), parent = None):
'''void DNSSD.ServiceTypeBrowser.__init__(QString domain = QString(), QObject parent = None)'''
finished = pyqtSignal() # void finished() - signal
serviceTypeAdded = pyqtSignal() # void serviceTypeAdded(const QStringamp;) - signal
serviceTypeRemoved = pyqtSignal() # void serviceTypeRemoved(const QStringamp;) - signal
def isRunning(self):
'''bool DNSSD.ServiceTypeBrowser.isRunning()'''
return bool()
def startBrowse(self):
'''void DNSSD.ServiceTypeBrowser.startBrowse()'''
def serviceTypes(self):
'''QStringList DNSSD.ServiceTypeBrowser.serviceTypes()'''
return QStringList()
class ServiceBrowser(QObject):
""""""
# Enum DNSSD.ServiceBrowser.State
Working = 0
Stopped = 0
Unsupported = 0
def __init__(self, type, autoResolve = False, domain = QString(), subtype = QString()):
'''void DNSSD.ServiceBrowser.__init__(QString type, bool autoResolve = False, QString domain = QString(), QString subtype = QString())'''
def virtual_hook(self):
'''sip.voidptr DNSSD.ServiceBrowser.virtual_hook()'''
return sip.voidptr()
finished = pyqtSignal() # void finished() - signal
serviceRemoved = pyqtSignal() # void serviceRemoved(DNSSD::RemoteService::Ptr) - signal
serviceAdded = pyqtSignal() # void serviceAdded(DNSSD::RemoteService::Ptr) - signal
def getLocalHostName(self):
'''static QString DNSSD.ServiceBrowser.getLocalHostName()'''
return QString()
def resolveHostName(self, hostname):
'''static QHostAddress DNSSD.ServiceBrowser.resolveHostName(QString hostname)'''
return QHostAddress()
def isAutoResolving(self):
'''bool DNSSD.ServiceBrowser.isAutoResolving()'''
return bool()
def isAvailable(self):
'''static DNSSD.ServiceBrowser.State DNSSD.ServiceBrowser.isAvailable()'''
return DNSSD.ServiceBrowser.State()
def startBrowse(self):
'''void DNSSD.ServiceBrowser.startBrowse()'''
def services(self):
'''unknown-type DNSSD.ServiceBrowser.services()'''
return unknown-type()
class PublicService(QObject, DNSSD.ServiceBase):
""""""
def __init__(self, name = QString(), type = QString(), port = 0, domain = QString(), subtypes = QStringList()):
'''void DNSSD.PublicService.__init__(QString name = QString(), QString type = QString(), int port = 0, QString domain = QString(), QStringList subtypes = QStringList())'''
def virtual_hook(self):
'''sip.voidptr DNSSD.PublicService.virtual_hook()'''
return sip.voidptr()
published = pyqtSignal() # void published(bool) - signal
def subtypes(self):
'''QStringList DNSSD.PublicService.subtypes()'''
return QStringList()
def setDomain(self, domain):
'''void DNSSD.PublicService.setDomain(QString domain)'''
def setPort(self, port):
'''void DNSSD.PublicService.setPort(int port)'''
def setSubTypes(self, subtypes):
'''void DNSSD.PublicService.setSubTypes(QStringList subtypes)'''
def setType(self, type):
'''void DNSSD.PublicService.setType(QString type)'''
def setServiceName(self, serviceName):
'''void DNSSD.PublicService.setServiceName(QString serviceName)'''
def setTextData(self, textData):
'''void DNSSD.PublicService.setTextData(dict-of-QString-QByteArray textData)'''
def publishAsync(self):
'''void DNSSD.PublicService.publishAsync()'''
def isPublished(self):
'''bool DNSSD.PublicService.isPublished()'''
return bool()
def publish(self):
'''bool DNSSD.PublicService.publish()'''
return bool()
def stop(self):
'''void DNSSD.PublicService.stop()'''
class ServiceBase(KShared):
""""""
def __init__(self, name = QString(), type = QString(), domain = QString(), host = QString(), port = 0):
'''void DNSSD.ServiceBase.__init__(QString name = QString(), QString type = QString(), QString domain = QString(), QString host = QString(), int port = 0)'''
def __ne__(self, o):
'''bool DNSSD.ServiceBase.__ne__(DNSSD.ServiceBase o)'''
return bool()
def __eq__(self, o):
'''bool DNSSD.ServiceBase.__eq__(DNSSD.ServiceBase o)'''
return bool()
def textData(self):
'''dict-of-QString-QByteArray DNSSD.ServiceBase.textData()'''
return dict-of-QString-QByteArray()
def port(self):
'''int DNSSD.ServiceBase.port()'''
return int()
def hostName(self):
'''QString DNSSD.ServiceBase.hostName()'''
return QString()
def domain(self):
'''QString DNSSD.ServiceBase.domain()'''
return QString()
def type(self):
'''QString DNSSD.ServiceBase.type()'''
return QString()
def serviceName(self):
'''QString DNSSD.ServiceBase.serviceName()'''
return QString()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
class pyqtSignal():
def connect(self, targetSignal): pass
def emit(self, *args): pass
from QtCore import *
class TerminalInterface():
""""""
def __init__(self):
'''void TerminalInterface.__init__()'''
def __init__(self):
'''TerminalInterface TerminalInterface.__init__()'''
return TerminalInterface()
def sendInput(self, text):
'''abstract void TerminalInterface.sendInput(QString text)'''
def showShellInDir(self, dir):
'''abstract void TerminalInterface.showShellInDir(QString dir)'''
def startProgram(self, program, args):
'''abstract void TerminalInterface.startProgram(QString program, QStringList args)'''
class TerminalInterfaceV2(TerminalInterface):
""""""
def __init__(self):
'''void TerminalInterfaceV2.__init__()'''
def __init__(self):
'''TerminalInterfaceV2 TerminalInterfaceV2.__init__()'''
return TerminalInterfaceV2()
def foregroundProcessName(self):
'''abstract QString TerminalInterfaceV2.foregroundProcessName()'''
return QString()
def foregroundProcessId(self):
'''abstract int TerminalInterfaceV2.foregroundProcessId()'''
return int()
def terminalProcessId(self):
'''abstract int TerminalInterfaceV2.terminalProcessId()'''
return int()
class KTerminal():
""""""
def __init__(self, part):
'''void KTerminal.__init__(KParts.Part part)'''
def __init__(self):
'''KTerminal KTerminal.__init__()'''
return KTerminal()
def terminalInterfaceV2(self):
'''TerminalInterfaceV2 KTerminal.terminalInterfaceV2()'''
return TerminalInterfaceV2()
def terminalInterface(self):
'''TerminalInterface KTerminal.terminalInterface()'''
return TerminalInterface()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/env python2.7
# This file is part of KDevelop
# Copyright 2011 by Victor Varvariuc <victor.varvariuc@gmail.com>
from xml.dom import minidom
def indentCode(code, level):
return '\n'.join(' ' * level + line for line in code.splitlines())
def parseEnum(enumNode, enumName, className = ''):
'''Parse Enum node and return its string representation.'''
enumMembers = []
for node in enumNode.childNodes:
if node.nodeType == node.ELEMENT_NODE:
if node.nodeName == 'EnumMember':
enumMember = node.attributes['name'].value
if enumMember.startswith(className + '.'):
enumMember = enumMember[len(className) + 1:]
if enumMember == 'None':
enumMember = '__kdevpythondocumentation_builtin_None'
enumMembers.append(enumMember)
else:
print 'Unknown node in Enum %s.%s: %s' % (className, enumName, node.nodeName)
text = ''
for enumMember in enumMembers:
text += '%s = int() # %s.%s enum\n' % (enumMember, className, enumName)
return text
def parseFunction(functionNode, funcName, className = ''):
'''Parse Function node and return its string representation.'''
params = [] if className == '' else [("None", "self")]
retType = 'None'
namesUsed = []
for node in functionNode.childNodes:
if node.nodeType == node.ELEMENT_NODE:
if node.nodeName == 'Argument':
argType = node.attributes['typename'].value
try:
argName = '*args' if argType == '...' else '_' + node.attributes['name'].value
except KeyError:
retType = argType
else:
if argName not in namesUsed:
params.append((argType, argName))
else:
print "adjusting arg name:", argName
argName = argName + '_'
params.append((argType, argName))
namesUsed.append(argName)
else:
print 'Unknown node in function %s.%s: %s' % (className, funcName, node.nodeName)
descr = 'abstract ' if 'abstract' in functionNode.attributes.keys() else ''
descr += '%s %s.%s(%s)' % (retType, className, funcName,
', '.join('%s %s' % p for p in params))
if retType == 'None':
pass # leave it like this
elif retType.startswith('list-of-'):
retType = '[' + retType[8:] + '()]'
else:
retType += '()'
# prefix function arguments with '_' to deal with reserved Python keywords
text = 'def %s(%s):\n """%s"""\n return %s' % (funcName, ', '.join(param[1] for param in params), descr, retType)
return text
def parseClass(classNode):
'''Parse Class node.'''
try:
parentClasses = classNode.attributes['inherits'].value.split()
except KeyError:
parentClasses = []
className = classNode.attributes['name'].value
text = 'class %s(%s):\n """"""\n' % (className, ', '.join(parentClasses))
for node in classNode.childNodes:
if node.nodeType == node.ELEMENT_NODE:
name = node.attributes['name'].value
if name.startswith(className + '.'):
name = name[len(className) + 1 :]
if node.nodeName == 'Member':
text += ' %s = None # %s member\n' % (name, node.attributes['typename'].value)
elif node.nodeName == 'Function':
if name not in ('exec', 'print'): # skip this invalid for Python name
text += indentCode(parseFunction(node, name, className), 1) + '\n'
elif node.nodeName == 'Enum':
text += indentCode(parseEnum(node, name, className), 1) + '\n\n'
else:
print 'Unknown node in class %s: %s' % (className, node.nodeName)
return text
files = ['QtGuimod.xml', 'QtCoremod.xml']
for filename in files:
dom = minidom.parse(filename)
module = dom.firstChild
assert module.nodeName == 'Module'
moduleName = module.attributes['name'].value
print 'Module name:', moduleName
stats = {}
with open(moduleName + '.py', 'w') as file:
for node in module.childNodes:
if node.nodeType != node.ELEMENT_NODE:
continue # skip non element nodes
nodeName = node.nodeName
stats[nodeName] = stats.setdefault(nodeName, 0) + 1 # stats
if nodeName == 'Class':
file.write(parseClass(node) + '\n\n')
elif nodeName == 'Function':
file.write(parseFunction(node, node.attributes['name'].value) + '\n\n')
elif nodeName == 'Member':
file.write('%s = None # %s member\n\n' % (node.attributes['name'].value, node.attributes['typename'].value))
else:
print 'Unknown node:', nodeName
print 'Stats:', stats
This diff is collapsed.
This diff is collapsed.
class pyqtSignal():
def connect(self, targetSignal): pass
def emit(self, *args): pass
from QtCore import *
class PolkitQt():
""""""
class ActionButton(PolkitQt.Action):
""""""
def __init__(self, button, actionId = QString(), parent = None):
'''void PolkitQt.ActionButton.__init__(QAbstractButton button, QString actionId = QString(), QObject parent = None)'''
clicked = pyqtSignal() # void clicked(QAbstractButton *,bool = 0) - signal
def activate(self):
'''bool PolkitQt.ActionButton.activate()'''
return bool()
def button(self):
'''QAbstractButton PolkitQt.ActionButton.button()'''
return QAbstractButton()
def setButton(self, button):
'''void PolkitQt.ActionButton.setButton(QAbstractButton button)'''
class Context(QObject):
""""""
def __init__(self):
'''void PolkitQt.Context.__init__()'''
consoleKitDBChanged = pyqtSignal() # void consoleKitDBChanged() - signal
configChanged = pyqtSignal() # void configChanged() - signal
def lastError(self):
'''QString PolkitQt.Context.lastError()'''
return QString()
def hasError(self):
'''bool PolkitQt.Context.hasError()'''
return bool()
class Auth():
""""""
# Enum PolkitQt.Auth.Result
Unknown = 0
Yes = 0
AdminAuthOneShot = 0
AdminAuth = 0
AdminAuthKeepSession = 0
AdminAuthKeepAlways = 0
SelfAuthOneShot = 0
SelfAuth = 0
SelfAuthKeepSession = 0
SelfAuthKeepAlways = 0
No = 0
def isCallerAuthorized(self, actionId, pid, revokeIfOneShot):
'''static PolkitQt.Auth.Result PolkitQt.Auth.isCallerAuthorized(QString actionId, int pid, bool revokeIfOneShot)'''
return PolkitQt.Auth.Result()
def isCallerAuthorized(self, actionId, dbusName, revokeIfOneShot):
'''static PolkitQt.Auth.Result PolkitQt.Auth.isCallerAuthorized(QString actionId, QString dbusName, bool revokeIfOneShot)'''
return PolkitQt.Auth.Result()
def obtainAuth(self, actionId, winId = 0, pid = None):
'''static bool PolkitQt.Auth.obtainAuth(QString actionId, int winId = 0, int pid = QCoreApplication.applicationPid())'''
return bool()
def computeAndObtainAuth(self, actionId, winId = 0, pid = None):
'''static bool PolkitQt.Auth.computeAndObtainAuth(QString actionId, int winId = 0, int pid = QCoreApplication.applicationPid())'''
return bool()
class ActionButtons(PolkitQt.ActionButton):
""""""
def __init__(self, buttons, actionId = QString(), parent = None):
'''void PolkitQt.ActionButtons.__init__(list-of-QAbstractButton buttons, QString actionId = QString(), QObject parent = None)'''
def removeButton(self, button):
'''void PolkitQt.ActionButtons.removeButton(QAbstractButton button)'''
def addButton(self, button):
'''void PolkitQt.ActionButtons.addButton(QAbstractButton button)'''
def buttons(self):
'''list-of-QAbstractButton PolkitQt.ActionButtons.buttons()'''
return [QAbstractButton()]
def setButtons(self, buttons):
'''void PolkitQt.ActionButtons.setButtons(list-of-QAbstractButton buttons)'''
class Action(QAction):
""""""
def __init__(self, actionId = QString(), parent = None):
'''void PolkitQt.Action.__init__(QString actionId = QString(), QObject parent = None)'''
def is_(self, actionId):
'''bool PolkitQt.Action.is_(QString actionId)'''
return bool()
def isAllowed(self):
'''bool PolkitQt.Action.isAllowed()'''
return bool()
def targetPID(self):
'''int PolkitQt.Action.targetPID()'''
return int()
def setTargetPID(self, pid):
'''void PolkitQt.Action.setTargetPID(int pid)'''
def yesIcon(self):
'''QIcon PolkitQt.Action.yesIcon()'''
return QIcon()
def setYesIcon(self, icon):
'''void PolkitQt.Action.setYesIcon(QIcon icon)'''
def yesWhatsThis(self):
'''QString PolkitQt.Action.yesWhatsThis()'''
return QString()
def setYesWhatsThis(self, whatsThis):
'''void PolkitQt.Action.setYesWhatsThis(QString whatsThis)'''
def yesToolTip(self):
'''QString PolkitQt.Action.yesToolTip()'''
return QString()
def setYesToolTip(self, toolTip):
'''void PolkitQt.Action.setYesToolTip(QString toolTip)'''
def yesText(self):
'''QString PolkitQt.Action.yesText()'''
return QString()
def setYesText(self, text):
'''void PolkitQt.Action.setYesText(QString text)'''
def yesEnabled(self):
'''bool PolkitQt.Action.yesEnabled()'''
return bool()
def setYesEnabled(self, value):
'''void PolkitQt.Action.setYesEnabled(bool value)'''
def yesVisible(self):
'''bool PolkitQt.Action.yesVisible()'''
return bool()
def setYesVisible(self, value):
'''void PolkitQt.Action.setYesVisible(bool value)'''
def authIcon(self):
'''QIcon PolkitQt.Action.authIcon()'''
return QIcon()
def setAuthIcon(self, icon):
'''void PolkitQt.Action.setAuthIcon(QIcon icon)'''
def authWhatsThis(self):
'''QString PolkitQt.Action.authWhatsThis()'''
return QString()
def setAuthWhatsThis(self, whatsThis):
'''void PolkitQt.Action.setAuthWhatsThis(QString whatsThis)'''
def authToolTip(self):
'''QString PolkitQt.Action.authToolTip()'''
return QString()
def setAuthToolTip(self, toolTip):
'''void PolkitQt.Action.setAuthToolTip(QString toolTip)'''
def authText(self):
'''QString PolkitQt.Action.authText()'''
return QString()
def setAuthText(self, text):
'''void PolkitQt.Action.setAuthText(QString text)'''
def authEnabled(self):
'''bool PolkitQt.Action.authEnabled()'''
return bool()
def setAuthEnabled(self, value):
'''void PolkitQt.Action.setAuthEnabled(bool value)'''
def authVisible(self):
'''bool PolkitQt.Action.authVisible()'''
return bool()
def setAuthVisible(self, value):
'''void PolkitQt.Action.setAuthVisible(bool value)'''
def noIcon(self):
'''QIcon PolkitQt.Action.noIcon()'''
return QIcon()
def setNoIcon(self, icon):
'''void PolkitQt.Action.setNoIcon(QIcon icon)'''
def noWhatsThis(self):
'''QString PolkitQt.Action.noWhatsThis()'''
return QString()
def setNoWhatsThis(self, whatsThis):
'''void PolkitQt.Action.setNoWhatsThis(QString whatsThis)'''
def noToolTip(self):
'''QString PolkitQt.Action.noToolTip()'''
return QString()
def setNoToolTip(self, toolTip):
'''void PolkitQt.Action.setNoToolTip(QString toolTip)'''
def noText(self):
'''QString PolkitQt.Action.noText()'''
return QString()
def setNoText(self, text):
'''void PolkitQt.Action.setNoText(QString text)'''
def noEnabled(self):
'''bool PolkitQt.Action.noEnabled()'''
return bool()
def setNoEnabled(self, value):
'''void PolkitQt.Action.setNoEnabled(bool value)'''
def noVisible(self):
'''bool PolkitQt.Action.noVisible()'''
return bool()
def setNoVisible(self, value):
'''void PolkitQt.Action.setNoVisible(bool value)'''
def selfBlockedIcon(self):
'''QIcon PolkitQt.Action.selfBlockedIcon()'''
return QIcon()
def setSelfBlockedIcon(self, icon):
'''void PolkitQt.Action.setSelfBlockedIcon(QIcon icon)'''
def selfBlockedWhatsThis(self):
'''QString PolkitQt.Action.selfBlockedWhatsThis()'''
return QString()
def setSelfBlockedWhatsThis(self, whatsThis):
'''void PolkitQt.Action.setSelfBlockedWhatsThis(QString whatsThis)'''