@dgelessus - the recent addition of ctypes may allow us to inspect the ui classes now. I have been trying to write an object dumper/lister but it is slow going for me. Here is an example code of what is possible - dumping info about the core bluetooth classes and a few others.
from cocoapy.runtime import *
def list_methods(cls, type):
count = c_uint()
method_array = objc.class_copyMethodList(cls, byref(count))
print '---', count.value, type, 'methods','---'
names = []
for i in range(count.value):
method = c_void_p(method_array[i])
sel = c_void_p(objc.method_getName(method))
name = objc.sel_getName(sel)
encoding = objc.method_getTypeEncoding(method)
return_type = objc.method_copyReturnType(method)
names.append((name, encoding, return_type))
names.sort()
for x, y, z in names:
print x, y
def list_variables(cls, type):
count = c_uint()
ivar_array = objc.class_copyIvarList(cls, byref(count))
print '---', count.value, type, 'variables','---'
names = []
for i in range(count.value):
ivar = c_void_p(ivar_array[i])
name = objc.ivar_getName(ivar)
encoding = objc.ivar_getTypeEncoding(ivar)
names.append((name, encoding))
names.sort()
for x, y in names:
print x, y
CB_Classes = [
'CBATTRequest',
'CBAttribute',
'CBCentral',
'CBCentralManager',
'CBCharacteristic',
'CBDescriptor',
'CBMutableCharacteristic',
'CBMutableDescriptor',
'CBMutableService',
'CBPairingAgent',
'CBPeer',
'CBPeripheral',
'CBPeripheralManager',
'CBScalablePipe',
'CBScalablePipeManager',
'CBService',
'CBUUID',
'CBXpcConnection',
'AVAudioSession',
'AVAudioRecorder',
'NSMutableDictionary'
]
if __name__ == '__main__':
for class_name in CB_Classes:
cls = get_class(class_name)
print '--------------------------'
print 'class:', class_name
list_methods(cls, 'instance')
list_methods(get_object_class(cls), 'class')
list_variables(cls, 'instance')
print '--------------------------'
Uses a set of wrapper classes from cocoapy which is buried in pyglet, but the ByBee wrappers should also work.
I have not yet figured out how to look at any of the Pythonista App classes, only various frameworks that are linked in.