Mercurial > libervia-backend
changeset 23:925ab466c5ec
better presentation for register new account
- error message when no user, pass or server given
- server is now automatically updated when jid change in connection category
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Dec 2009 06:07:20 +0100 |
parents | bb72c29f3432 |
children | 61124cb82fb7 |
files | frontends/wix/main_window.py frontends/wix/param.py sat.tac |
diffstat | 3 files changed, 27 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/wix/main_window.py Tue Dec 01 04:56:08 2009 +0100 +++ b/frontends/wix/main_window.py Tue Dec 01 06:07:20 2009 +0100 @@ -306,6 +306,7 @@ if type == "SUPPRESS": self.current_action_ids.remove(id) elif type == "SUCCESS": + self.current_action_ids.remove(id) dlg = wx.MessageDialog(self, data["message"], 'Success', wx.OK | wx.ICON_INFORMATION @@ -313,6 +314,7 @@ dlg.ShowModal() dlg.Destroy() elif type == "ERROR": + self.current_action_ids.remove(id) dlg = wx.MessageDialog(self, data["message"], 'Error', wx.OK | wx.ICON_ERROR
--- a/frontends/wix/param.py Tue Dec 01 04:56:08 2009 +0100 +++ b/frontends/wix/param.py Tue Dec 01 06:07:20 2009 +0100 @@ -25,6 +25,7 @@ import pdb from xml.dom import minidom from logging import debug, info, error +from tools.jid import JID class Param(wx.Frame): @@ -33,7 +34,8 @@ self.host = host - self.modified={} # dict of modified data (i.e. what we have to save) + self.modified = {} # dict of modified data (i.e. what we have to save) + self.ctl_list = {} # usefull to access ctrl, key = (name, category) self.sizer = wx.BoxSizer(wx.VERTICAL) self.notebook=wx.Notebook(self, -1, style=wx.NB_LEFT) @@ -77,6 +79,7 @@ raise NotImplementedError ctrl.param_id=(name, category) sizer.Add(ctrl, 1, flag=wx.EXPAND) + self.ctl_list[(name, category)] = ctrl panel.sizer.Add(sizer, flag=wx.EXPAND) if type=="string" or type=="password": @@ -92,10 +95,18 @@ def onTextChanged(self, event): """Called when a paramated is modified""" self.modified[event.GetEventObject().param_id]=event.GetString() + + ### FIXME # Some hacks for better presentation, should be generic # FIXME ### + if event.GetEventObject().param_id == ('JabberID', 'Connection'): + domain = JID(event.GetString()).domain + self.ctl_list[('Server', 'Connection')].SetValue(domain) + self.modified[('Server', 'Connection')] = domain + event.Skip() def onButtonClicked(self, event): """Called when a paramated is modified""" + self.__save_parameters() print "Button Clicked (%s/%s)" % event.GetEventObject().param_id name, category = event.GetEventObject().param_id data = {"name":name, "category":category} @@ -104,12 +115,16 @@ print "action id:",id event.Skip() + def __save_parameters(self): + for param in self.modified: + self.host.bridge.setParam(param[0], self.modified[param], param[1]) + self.modified.clear() + def onClose(self, event): """Close event: we have to save the params.""" debug("close") #now we save the modifier params - for param in self.modified: - self.host.bridge.setParam(param[0], self.modified[param], param[1]) + self.__save_parameters() self.MakeModal(False) event.Skip()
--- a/sat.tac Tue Dec 01 04:56:08 2009 +0100 +++ b/sat.tac Tue Dec 01 06:07:20 2009 +0100 @@ -384,8 +384,15 @@ def registerNewAccountCB(self, id, data): user = jid.parse(self.memory.getParamA("JabberID", "Connection"))[0] + password = self.memory.getParamA("Password", "Connection") server = self.memory.getParamA("Server", "Connection") + if not user or not password or not server: + info ('No user or server given') + #TODO: a proper error message must be sent to frontend + self.actionResult(id, "ERROR", {'message':"No user, password or server given, can't register new account."}) + return + confirm_id = sat_next_id() self.__private_data[confirm_id]=id