Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
create_obj_class ... two issues
-
two issues:
-
when using on_main_thread to decorate an objc method, create_objc_class thinks there are no arguments. I think @dgelessus has pointed out the issue with wraps not being correct. Not sure if on_main_thread is needed on things that get called from the main thread anyway?
-
the methods argument does not seem to allow instance methods. (raised an exception when adding, complaining of the extra argument, which was self). I believe the code needs to toss out the first (self) argspec.arg for methods that have an
__im_func__
attribute.
-
-
also, related to objc in general, a suggestion:
please expose_get_objc_classname()
in ObjCInstance's dir method, so it will be autocompleted...I can never remember the name, and it is useful! -
@JonB When wrapping a function with a decorator, the new (wrapper) function's arguments are normally declared as
(*args, **kwargs)
. I'm not sure iffunctools.wraps
fixes (or can even fix) this. Maybe the issue is really withcreate_objc_class
not understanding varargs. -
If the method will be called on the main thread anyway, there's no need to decorate it with
on_main_thread
.