23
23
VipsOperation* vips_cache_operation_build (VipsOperation* operation);
24
24
void vips_object_unref_outputs (VipsOperation *operation);
25
25
26
- int vips_object_set_from_string (VipsObject* object, const char* options);
27
-
28
26
''' )
29
27
30
28
# values for VipsOperationFlags
@@ -55,7 +53,7 @@ class Operation(VipsObject):
55
53
56
54
def __init__ (self , pointer ):
57
55
log ('Operation.__init__: pointer = {0}' .format (pointer ))
58
- VipsObject . __init__ ( self , pointer )
56
+ super ( Operation , self ). __init__ ( pointer )
59
57
60
58
def set (self , name , flags , match_image , value ):
61
59
# if the object wants an image and we have a constant, imageize it
@@ -76,7 +74,7 @@ def set(self, name, flags, match_image, value):
76
74
# make sure we have a unique copy
77
75
value = value .copy ().copy_memory ()
78
76
79
- return self .set (name , value )
77
+ super ( Operation , self ) .set (name , value )
80
78
81
79
# this is slow ... call as little as possible
82
80
def getargs (self ):
@@ -147,7 +145,7 @@ def call(name, *args, **kwargs):
147
145
148
146
# set any string options before any args so they can't be
149
147
# overridden
150
- if vips_lib . vips_object_set_from_string ( op .pointer , string_options ) != 0 :
148
+ if not op .set_string ( string_options ):
151
149
error ('unable to call {0}\n {1}' .format (name , vips_get_error ()))
152
150
153
151
# set required and optional args
@@ -156,22 +154,16 @@ def call(name, *args, **kwargs):
156
154
if ((flags & INPUT ) != 0 and
157
155
(flags & REQUIRED ) != 0 and
158
156
(flags & DEPRECATED ) == 0 ):
159
- if not op .set (name , flags , match_image , args [n ]):
160
- error ('unable to call {0}\n {1]' .
161
- format (name , vips_get_error ()))
162
-
157
+ op .set (name , flags , match_image , args [n ])
163
158
n += 1
164
159
165
160
for name , value in kwargs :
166
- flags = flags_from_name [name ]
167
-
168
- if not op .set (name , flags , match_image , value ):
169
- error ('unable to call {0}\n {1]' .format (name , vips_get_error ()))
161
+ op .set (name , flags_from_name [name ], match_image , value )
170
162
171
163
# build operation
172
164
vop2 = vips_lib .vips_cache_operation_build (op .pointer )
173
165
if vop2 == ffi .NULL :
174
- error ('unable to call {0}\n {1] ' .format (name , vips_get_error ()))
166
+ error ('unable to call {0}\n {1} ' .format (name , vips_get_error ()))
175
167
op2 = Operation (vop2 )
176
168
op = op2
177
169
op2 = None
0 commit comments