comparison browser_side/xmlui.py @ 321:bfbd9d6eb901

browser_side: info dialog to let the user know that a refresh is needed after GUI parameters have been changed
author souliane <souliane@mailoo.org>
date Fri, 03 Jan 2014 22:43:44 +0100
parents e4f586fc6101
children d07b54fdc60a
comparison
equal deleted inserted replaced
320:a0ded7df30f7 321:bfbd9d6eb901
17 17
18 You should have received a copy of the GNU Affero General Public License 18 You should have received a copy of the GNU Affero General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. 19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 """ 20 """
21 21
22 from sat.core.i18n import _
22 from pyjamas.ui.VerticalPanel import VerticalPanel 23 from pyjamas.ui.VerticalPanel import VerticalPanel
23 from pyjamas.ui.HorizontalPanel import HorizontalPanel 24 from pyjamas.ui.HorizontalPanel import HorizontalPanel
24 from pyjamas.ui.CellPanel import CellPanel 25 from pyjamas.ui.CellPanel import CellPanel
25 from pyjamas.ui.TabPanel import TabPanel 26 from pyjamas.ui.TabPanel import TabPanel
26 from pyjamas.ui.Grid import Grid 27 from pyjamas.ui.Grid import Grid
30 from pyjamas.ui.PasswordTextBox import PasswordTextBox 31 from pyjamas.ui.PasswordTextBox import PasswordTextBox
31 from pyjamas.ui.TextArea import TextArea 32 from pyjamas.ui.TextArea import TextArea
32 from pyjamas.ui.CheckBox import CheckBox 33 from pyjamas.ui.CheckBox import CheckBox
33 from pyjamas.ui.ListBox import ListBox 34 from pyjamas.ui.ListBox import ListBox
34 from pyjamas.ui.Button import Button 35 from pyjamas.ui.Button import Button
36 from dialog import InfoDialog
35 from nativedom import NativeDOM 37 from nativedom import NativeDOM
36 38
37 39
38 class InvalidXMLUI(Exception): 40 class InvalidXMLUI(Exception):
39 pass 41 pass
268 def onFormCancelled(self, button): 270 def onFormCancelled(self, button):
269 self.close() 271 self.close()
270 272
271 def onSaveParams(self, button): 273 def onSaveParams(self, button):
272 print "onSaveParams" 274 print "onSaveParams"
275 refresh = False
273 for ctrl in self.param_changed: 276 for ctrl in self.param_changed:
274 if isinstance(ctrl, CheckBox): 277 if isinstance(ctrl, CheckBox):
275 value = "true" if ctrl.isChecked() else "false" 278 value = "true" if ctrl.isChecked() else "false"
276 elif isinstance(ctrl, ListBox): 279 elif isinstance(ctrl, ListBox):
277 value = '\t'.join(ctrl.getSelectedItemText()) 280 value = '\t'.join(ctrl.getSelectedItemText())
278 else: 281 else:
279 value = ctrl.getText() 282 value = ctrl.getText()
280 self.host.bridge.call('setParam', None, ctrl._param_name, value, ctrl._param_category) 283 self.host.bridge.call('setParam', None, ctrl._param_name, value, ctrl._param_category)
284 if ctrl._param_name in self.host.ui_refresh_params:
285 refresh = True
281 self.close() 286 self.close()
287 if refresh:
288 InfoDialog(_("Refresh needed"), _("A parameter requesting a page refresh has been modified.<br/>Your changes will be fully effective only after you refresh the page with 'F5' or from your browser menu.")).show()