def create_editor( context=None, object_name="object", name="user_value", factory=None, is_event=False, ): if context is None: user_object = UserObject() context = {"object": user_object} elif "." in object_name: context_name, xname = object_name.split(".", 1) context_object = context[context_name] user_object = xgetattr(context_object, xname) else: user_object = context[object_name] ui = UI(context=context, handler=default_handler()) if factory is None: factory = StubEditorFactory() factory.is_event = is_event editor = StubEditor( parent=None, ui=ui, object_name=object_name, name=name, factory=factory, object=user_object, ) return editor
def create_editor(self, context=None, object_name='object', name='user_value', factory=None, is_event=False): if context is None: user_object = UserObject() context = {'object': user_object} elif '.' in object_name: context_name, xname = object_name.split('.', 1) context_object = context[context_name] user_object = xgetattr(context_object, xname) else: user_object = context[object_name] ui = UI( context=context, handler=default_handler(), ) if factory is None: factory = StubEditorFactory() factory.is_event = is_event editor = StubEditor( parent=None, ui=ui, object_name=object_name, name=name, factory=factory, object=user_object, ) return editor