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
This commit is contained in:
parent
a103e8b41b
commit
84cd3c6ea2
3 changed files with 27 additions and 3 deletions
|
|
@ -306,6 +306,7 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
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 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
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
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import wx
|
|||
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 @@ class Param(wx.Frame):
|
|||
|
||||
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 @@ class Param(wx.Frame):
|
|||
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 @@ class Param(wx.Frame):
|
|||
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 @@ class Param(wx.Frame):
|
|||
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()
|
||||
|
|
|
|||
7
sat.tac
7
sat.tac
|
|
@ -384,8 +384,15 @@ class SAT(service.Service):
|
|||
|
||||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue