|
GnuCash 2.4.99
|
Public Member Functions | |
| def | __new__ |
| def | __init__ |
| def | get_instance |
| def | add_method |
| def | ya_add_classmethod |
| def | ya_add_method |
| def | add_methods_with_prefix |
| def | add_constructor_and_methods_with_prefix |
| def | decorate_functions |
Properties | |
| instance = property(get_instance) | |
Inherit this class to give yourself a python class that wraps a set of functions that together constitute the methods of the class. The method functions must all have as a first argument an object holding the instance data. There must also be a function that returns a new instance of the class, the constructor. Your subclass must define _module - The module where the method functions, including the constructor can be found _new_instance - The name of a function that serves as a constructor, returning the instance data. To access the instance data, use the read-only property instance. To add some functions from _module as methods, call classmethods like add_method and add_methods_with_prefix.
Definition at line 31 of file function_class.py.
| def python-bindings::function_class::ClassFromFunctions::__init__ | ( | self, | |
| args, | |||
| kargs | |||
| ) |
Construct a new instance, using either the function self._module[self._new_instance] or using existing instance data. (specified with the keyword argument, instance) Pass the arguments that should be passed on to self._module[self._new_instance] . Any arguments of that are instances of ClassFromFunctions will be switched with the instance data. (by calling the .instance property)
Definition at line 57 of file function_class.py.
00058 : 00059 """Construct a new instance, using either the function 00060 self._module[self._new_instance] or using existing instance 00061 data. (specified with the keyword argument, instance) 00062 00063 Pass the arguments that should be passed on to 00064 self._module[self._new_instance] . Any arguments of that 00065 are instances of ClassFromFunctions will be switched with the instance 00066 data. (by calling the .instance property) 00067 """ 00068 if INSTANCE_ARGUMENT in kargs: 00069 self.__instance = kargs[INSTANCE_ARGUMENT] 00070 else: 00071 self.__instance = getattr(self._module, self._new_instance)( 00072 *process_list_convert_to_instance(args) )
| def python-bindings::function_class::ClassFromFunctions::add_constructor_and_methods_with_prefix | ( | cls, | |
| prefix, | |||
| constructor | |||
| ) |
Add a group of functions with the same prefix, and set the _new_instance attribute to prefix + constructor
Definition at line 136 of file function_class.py.
| def python-bindings::function_class::ClassFromFunctions::add_method | ( | cls, | |
| function_name, | |||
| method_name | |||
| ) |
Add the function, method_name to this class as a method named name
Definition at line 85 of file function_class.py.
00086 : 00087 """Add the function, method_name to this class as a method named name 00088 """ 00089 def method_function(self, *meth_func_args): 00090 return getattr(self._module, function_name)( 00091 self.instance, 00092 *process_list_convert_to_instance(meth_func_args) ) 00093 00094 setattr(cls, method_name, method_function) 00095 setattr(method_function, "__name__", method_name) 00096 return method_function
| def python-bindings::function_class::ClassFromFunctions::add_methods_with_prefix | ( | cls, | |
| prefix | |||
| ) |
Add a group of functions with the same prefix
Definition at line 128 of file function_class.py.
| def python-bindings::function_class::ClassFromFunctions::get_instance | ( | self | ) |
Get the instance data. You can also call the instance property
Definition at line 73 of file function_class.py.
| def python-bindings::function_class::ClassFromFunctions::ya_add_classmethod | ( | cls, | |
| function_name, | |||
| method_name | |||
| ) |
Add the function, method_name to this class as a classmethod named name Taken from function_class and slightly modified.
Definition at line 98 of file function_class.py.
00099 : 00100 """Add the function, method_name to this class as a classmethod named name 00101 00102 Taken from function_class and slightly modified. 00103 """ 00104 def method_function(self, *meth_func_args): 00105 return getattr(self._module, function_name)( 00106 self, 00107 *process_list_convert_to_instance(meth_func_args) ) 00108 00109 setattr(cls, method_name, classmethod(method_function)) 00110 setattr(method_function, "__name__", method_name) 00111 return method_function
| def python-bindings::function_class::ClassFromFunctions::ya_add_method | ( | cls, | |
| function_name, | |||
| method_name | |||
| ) |
Add the function, method_name to this class as a method named name Taken from function_class and slightly modified.
Definition at line 113 of file function_class.py.
00114 : 00115 """Add the function, method_name to this class as a method named name 00116 00117 Taken from function_class and slightly modified. 00118 """ 00119 def method_function(self, *meth_func_args): 00120 return getattr(self._module, function_name)( 00121 self, 00122 *process_list_convert_to_instance(meth_func_args) ) 00123 00124 setattr(cls, method_name, method_function) 00125 setattr(method_function, "__name__", method_name) 00126 return method_function
1.7.4