Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_widgets.py @ 2047:7f5e344938c1
quick_frontend(quick_widgets): deleteWidget can use additional arguments which will be passed to onDelete
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Aug 2016 18:22:46 +0200 |
parents | f3940f6a3222 |
children | e22ab34c68f6 |
comparison
equal
deleted
inserted
replaced
2046:b99bd02ea643 | 2047:7f5e344938c1 |
---|---|
248 else: | 248 else: |
249 raise exceptions.InternalError("Unexpected on_existing_widget value ({})".format(on_existing_widget)) | 249 raise exceptions.InternalError("Unexpected on_existing_widget value ({})".format(on_existing_widget)) |
250 | 250 |
251 return widget | 251 return widget |
252 | 252 |
253 def deleteWidget(self, widget_to_delete): | 253 def deleteWidget(self, widget_to_delete, *args, **kwargs): |
254 """Delete a widget | 254 """Delete a widget |
255 | 255 |
256 this method must be called by frontends when a widget is deleted | 256 this method must be called by frontends when a widget is deleted |
257 widget's onDelete method will be called before deletion | 257 widget's onDelete method will be called before deletion |
258 """ | 258 @param widget_to_delete(QuickWidget): widget which need to deleted |
259 if widget_to_delete.onDelete() == False: | 259 @param *args: extra arguments to pass to onDelete |
260 @param *kwargs: extra keywords arguments to pass to onDelete | |
261 the extra arguments are not use by QuickFrontend, it's is up to | |
262 the frontend to use them or not | |
263 """ | |
264 if widget_to_delete.onDelete(*args, **kwargs) == False: | |
260 return | 265 return |
261 | 266 |
262 if self.host.selected_widget == widget_to_delete: | 267 if self.host.selected_widget == widget_to_delete: |
263 self.host.selected_widget = None | 268 self.host.selected_widget = None |
264 | 269 |
337 @param profiles: profile(s) associated to target, see __init__ docstring | 342 @param profiles: profile(s) associated to target, see __init__ docstring |
338 @return: a hash (can correspond to one or many targets or profiles, depending of widget class) | 343 @return: a hash (can correspond to one or many targets or profiles, depending of widget class) |
339 """ | 344 """ |
340 return unicode(target) # by defaut, there is one hash for one target | 345 return unicode(target) # by defaut, there is one hash for one target |
341 | 346 |
342 def onDelete(self): | 347 def onDelete(self, *args, **kwargs): |
343 """Called when a widget is being deleted | 348 """Called when a widget is being deleted |
344 | 349 |
345 @return (boot, None): False to cancel deletion | 350 @return (boot, None): False to cancel deletion |
346 all other value continue deletion | 351 all other value continue deletion |
347 """ | 352 """ |