Mercurial > libervia-backend
changeset 21:633c5ed65701
parameters: new button type (not finished)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 08 Nov 2009 01:49:08 +0100 |
parents | fc8c202cda87 |
children | bb72c29f3432 |
files | frontends/wix/param.py plugins/plugin_xep_0065.py tools/memory.py |
diffstat | 3 files changed, 20 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/wix/param.py Sun Nov 08 00:11:00 2009 +0100 +++ b/frontends/wix/param.py Sun Nov 08 01:49:08 2009 +0100 @@ -62,20 +62,28 @@ type = param.getAttribute("type") value = param.getAttribute("value") sizer = wx.BoxSizer(wx.HORIZONTAL) - label=wx.StaticText(panel, -1, name+" ") if type=="string": + label=wx.StaticText(panel, -1, name+" ") ctrl = wx.TextCtrl(panel, -1, value) + sizer.Add(label) elif type=="password": + label=wx.StaticText(panel, -1, name+" ") ctrl = wx.TextCtrl(panel, -1, value, style=wx.TE_PASSWORD) + sizer.Add(label) + elif type=="button": + ctrl = wx.Button(panel, -1, value) else: error("FIXME FIXME FIXME") #FIXME ! raise NotImplementedError ctrl.param_id=(name, category) - sizer.Add(label) sizer.Add(ctrl, 1, flag=wx.EXPAND) panel.sizer.Add(sizer, flag=wx.EXPAND) - panel.Bind(wx.EVT_TEXT, self.onTextChanged, ctrl) + if type=="string" or type=="password": + panel.Bind(wx.EVT_TEXT, self.onTextChanged, ctrl) + elif type=="button": + panel.Bind(wx.EVT_BUTTON, self.onButtonClicked, ctrl) + panel.SetSizer(panel.sizer) panel.SetAutoLayout(True) self.notebook.AddPage(panel, category) @@ -86,6 +94,11 @@ self.modified[event.GetEventObject().param_id]=event.GetString() event.Skip() + def onButtonClicked(self, event): + """Called when a paramated is modified""" + print "Button Clicked (%s/%s)" % event.GetEventObject().param_id#TODO: gof: appeler callback + #self.modified[event.GetEventObject().param_id]=event.GetString() + event.Skip() def onClose(self, event): """Close event: we have to save the params."""
--- a/plugins/plugin_xep_0065.py Sun Nov 08 00:11:00 2009 +0100 +++ b/plugins/plugin_xep_0065.py Sun Nov 08 01:49:08 2009 +0100 @@ -468,8 +468,11 @@ self.server_factory = Socks5ServerFactory() self.server_factory.protocol.host = self.host #needed for progress CB self.client_factory = Socks5ClientFactory() + + #parameters host.memory.importParams(self, XEP_0065.params) host.memory.setDefault("IP", "File Transfert", self.getExternalIP) + port = int(self.host.memory.getParamV("Port", "File Transfert")) info("Launching Socks5 Stream server on port %d", port) reactor.listenTCP(port, self.server_factory)
--- a/tools/memory.py Sun Nov 08 00:11:00 2009 +0100 +++ b/tools/memory.py Sun Nov 08 01:49:08 2009 +0100 @@ -43,6 +43,7 @@ <param name="JabberID" value="goffi@necton2.int/TestScript" type="string" /> <param name="Password" value="toto" type="password" /> <param name="Server" value="necton2.int" type="string" /> + <param name="NewAccount" value="Register new account" type="button" callback="registerNewAccount"/> </category> <category name="Misc"> <param name="Watched" value="test@Jabber.goffi.int" type="string" />