diff browser_side/dialog.py @ 210:3092f6b1710c

browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...) fix bug 15 fix bug 33
author souliane <souliane@mailoo.org>
date Fri, 06 Sep 2013 15:40:33 +0200
parents 4564c7bc06a7
children 49920d76aa6a
line wrap: on
line diff
--- a/browser_side/dialog.py	Fri Jun 28 00:06:31 2013 +0200
+++ b/browser_side/dialog.py	Fri Sep 06 15:40:33 2013 +0200
@@ -65,8 +65,8 @@
         button_panel.add(Button("Cancel", self.onCancel))
         content.add(button_panel)
         self.setHTML(text)
-        self.setWidget(content)	
-    
+        self.setWidget(content)
+
     def onChange(self, sender):
         if self.nb_contact:
             if len(self.contacts_list.getSelectedValues()) == self.nb_contact:
@@ -111,8 +111,8 @@
         button_panel.add(Button("Cancel", self.onCancel))
         content.add(button_panel)
         self.setHTML(title)
-        self.setWidget(content)	
-    
+        self.setWidget(content)
+
     def onConfirm(self, sender):
         self.hide()
         self.callback(True)
@@ -121,15 +121,17 @@
         self.hide()
         self.callback(False)
 
+
 class ConfirmDialog(GenericConfirmDialog):
 
     def __init__(self, callback, text='Are you sure ?', title='Confirmation'):
-        GenericConfirmDialog.__init__(self,[HTML(text)], callback, title)
+        GenericConfirmDialog.__init__(self, [HTML(text)], callback, title)
+
 
 class GenericDialog(DialogBox):
     """Dialog which just show a widget and a close button"""
 
-    def __init__(self, title, main_widget, callback = None, options = None):
+    def __init__(self, title, main_widget, callback=None, options=None):
         """Simple notice dialog box
         @param title: HTML put in the header
         @param main_widget: widget put in the body
@@ -199,7 +201,8 @@
 
 class GroupSelector(DialogBox):
     
-    def __init__(self, top_widgets, initial_groups, selected_groups, ok_cb = None, cancel_cb = None):
+    def __init__(self, top_widgets, initial_groups, selected_groups,
+                 ok_title, ok_cb = None, cancel_cb = None):
         DialogBox.__init__(self, centered = True)
         main_panel = VerticalPanel()
         self.ok_cb = ok_cb
@@ -226,7 +229,7 @@
         main_panel.add(add_group_panel)
         
         button_panel = HorizontalPanel()
-        button_panel.add(Button("Add", self.onOK))
+        button_panel.add(Button(ok_title, self.onOK))
         button_panel.add(Button("Cancel", self.onCancel))
         main_panel.add(button_panel)
         
@@ -261,12 +264,12 @@
         sender.setText('')
         self.list_box.setItemSelected(self.list_box.getItemCount()-1, "selected")
 
+
 class WheelTextBox(TextBox, MouseWheelHandler):
 
     def __init__(self, *args, **kwargs):
         TextBox.__init__(self, *args, **kwargs)
         MouseWheelHandler.__init__(self)
-    
 
 
 class IntSetter(HorizontalPanel):