changeset 392:f539f6f8ee9c

browser_side: standardize the dialogs size and buttons display: - do not set a default width/height for the XMLUI dialogs - do not display an extra "Close" button when XMLUI form is showed - the buttons order is OK/Save on the left, Cancel/Close on the right - horizontally center the dialog buttons
author souliane <souliane@mailoo.org>
date Mon, 03 Mar 2014 16:24:00 +0100
parents c86d7a8d2c1e
children a3d58514a4d0
files browser_side/contact_group.py browser_side/file_tools.py browser_side/menu.py browser_side/xmlui.py libervia.py
diffstat 5 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/contact_group.py	Mon Mar 03 15:44:54 2014 +0100
+++ b/browser_side/contact_group.py	Mon Mar 03 16:24:00 2014 +0100
@@ -145,8 +145,8 @@
         """Add the buttons to close the dialog / save the groups"""
         buttons = HorizontalPanel()
         buttons.addStyleName("marginAuto")
+        buttons.add(Button("Save", listener=self.closeAndSave))
         buttons.add(Button("Cancel", listener=self.cancelWithoutSaving))
-        buttons.add(Button("Save", listener=self.closeAndSave))
         return buttons
 
     def getContactList(self):
--- a/browser_side/file_tools.py	Mon Mar 03 15:44:54 2014 +0100
+++ b/browser_side/file_tools.py	Mon Mar 03 16:24:00 2014 +0100
@@ -97,12 +97,13 @@
 
         hPanel = HorizontalPanel()
         hPanel.setSpacing(5)
+        hPanel.setStyleName('marginAuto')
         self.file_upload = FilterFileUpload(input_id, max_size)
         self.vPanel.add(self.file_upload)
 
-        hPanel.add(Button(self.texts['cancel_button'], getattr(self, "onCloseBtnClick")))
         self.upload_btn = Button(self.texts['ok_button'], getattr(self, "onSubmitBtnClick"))
         hPanel.add(self.upload_btn)
+        hPanel.add(Button(self.texts['cancel_button'], getattr(self, "onCloseBtnClick")))
 
         self.status = Label()
         hPanel.add(self.status)
--- a/browser_side/menu.py	Mon Mar 03 15:44:54 2014 +0100
+++ b/browser_side/menu.py	Mon Mar 03 16:24:00 2014 +0100
@@ -331,5 +331,5 @@
         body = AvatarUpload()
         _dialog = dialog.GenericDialog("Avatar upload", body, options=['NO_CLOSE'])
         body.setCloseCb(_dialog.close)
-        _dialog.setSize('40%', '40%')
+        _dialog.setWidth('40%')
         _dialog.show()
--- a/browser_side/xmlui.py	Mon Mar 03 15:44:54 2014 +0100
+++ b/browser_side/xmlui.py	Mon Mar 03 16:24:00 2014 +0100
@@ -364,6 +364,7 @@
         self.setCellHeight(self.main_cont, '100%')
         if self.type == 'form':
             hpanel = HorizontalPanel()
+            hpanel.setStyleName('marginAuto')
             hpanel.add(Button('Submit',self.onFormSubmitted))
             if not 'NO_CANCEL' in self.flags:
                 hpanel.add(Button('Cancel',self.onFormCancelled))
@@ -371,6 +372,6 @@
         elif self.type == 'param':
             assert(isinstance(self.children[0][0],TabPanel))
             hpanel = HorizontalPanel()
+            hpanel.add(Button('Save', self.onSaveParams))
             hpanel.add(Button('Cancel', lambda ignore: self._xmluiClose()))
-            hpanel.add(Button('Save', self.onSaveParams))
             self.add(hpanel)
--- a/libervia.py	Mon Mar 03 15:44:54 2014 +0100
+++ b/libervia.py	Mon Mar 03 16:24:00 2014 +0100
@@ -378,9 +378,9 @@
             pass
         elif "xmlui" in data:
             ui = XMLUI(self, xml_data = data['xmlui'])
-            _dialog = dialog.GenericDialog(ui.title, ui)
+            options = ['NO_CLOSE'] if ui.type == 'form' else []
+            _dialog = dialog.GenericDialog(ui.title, ui, options=options)
             ui.setCloseCb(_dialog.close)
-            _dialog.setSize('80%', '80%')
             _dialog.show()
         else:
             dialog.InfoDialog("Error",