changeset 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 b99bd02ea643
children aff318d4a786
files frontends/src/quick_frontend/quick_widgets.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_widgets.py	Sun Aug 28 18:20:55 2016 +0200
+++ b/frontends/src/quick_frontend/quick_widgets.py	Sun Aug 28 18:22:46 2016 +0200
@@ -250,13 +250,18 @@
 
         return widget
 
-    def deleteWidget(self, widget_to_delete):
+    def deleteWidget(self, widget_to_delete, *args, **kwargs):
         """Delete a widget
 
         this method must be called by frontends when a widget is deleted
         widget's onDelete method will be called before deletion
+        @param widget_to_delete(QuickWidget): widget which need to deleted
+        @param *args: extra arguments to pass to onDelete
+        @param *kwargs: extra keywords arguments to pass to onDelete
+            the extra arguments are not use by QuickFrontend, it's is up to
+            the frontend to use them or not
         """
-        if widget_to_delete.onDelete() == False:
+        if widget_to_delete.onDelete(*args, **kwargs) == False:
             return
 
         if self.host.selected_widget == widget_to_delete:
@@ -339,7 +344,7 @@
         """
         return unicode(target) # by defaut, there is one hash for one target
 
-    def onDelete(self):
+    def onDelete(self, *args, **kwargs):
         """Called when a widget is being deleted
 
         @return (boot, None): False to cancel deletion