133 class ConfigurableBindings(configurable.Configurable): |
133 class ConfigurableBindings(configurable.Configurable): |
134 |
134 |
135 def __init__(self): |
135 def __init__(self): |
136 configurable.Configurable.__init__(self, None) |
136 configurable.Configurable.__init__(self, None) |
137 self.bindingsNames = [] |
137 self.bindingsNames = [] |
|
138 self.infostringcount = 0 |
138 |
139 |
139 def getBindingNames(self, ctx): |
140 def getBindingNames(self, ctx): |
140 return self.bindingsNames |
141 return self.bindingsNames |
141 |
142 |
142 def addExtension(self, name, desc, fields, btnlabel, callback): |
143 def addInfoString(self, label, value, name=None): |
|
144 if type(value) is str: |
|
145 def default(*k): |
|
146 return value |
|
147 else: |
|
148 def default(*k): |
|
149 return value() |
|
150 |
|
151 if name is None: |
|
152 name = "_infostring_" + str(self.infostringcount) |
|
153 self.infostringcount = self.infostringcount + 1 |
|
154 |
|
155 def _bind(ctx): |
|
156 return annotate.Property( |
|
157 name, |
|
158 annotate.String( |
|
159 label=label, |
|
160 default=default, |
|
161 immutable=True)) |
|
162 setattr(self, 'bind_' + name, _bind) |
|
163 self.bindingsNames.append(name) |
|
164 |
|
165 def addSettings(self, name, desc, fields, btnlabel, callback): |
143 def _bind(ctx): |
166 def _bind(ctx): |
144 return annotate.MethodBinding( |
167 return annotate.MethodBinding( |
145 'action_' + name, |
168 'action_' + name, |
146 annotate.Method( |
169 annotate.Method( |
147 arguments=[ |
170 arguments=[ |