Mercurial > libervia-backend
changeset 157:13888bdb72b6
primitivus: button are now working with XMLUI
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 04 Aug 2010 12:01:07 +0800 |
parents | a216dfbb0d50 |
children | 74aaf230a7c3 |
files | frontends/primitivus/primitivus frontends/primitivus/xmlui.py |
diffstat | 2 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/primitivus/primitivus Wed Aug 04 12:00:25 2010 +0800 +++ b/frontends/primitivus/primitivus Wed Aug 04 12:01:07 2010 +0800 @@ -30,11 +30,6 @@ from chat import Chat import custom_widgets import pdb -"""from window import Window -from editbox import EditBox -from statusbar import StatusBar -from chat import Chat -from tools.jid import JID""" import logging from logging import debug, info, error import sys, os @@ -103,9 +98,8 @@ def write_log(self, log, file_name='/tmp/primitivus_log'): """method to write log in a temporary file, useful for debugging""" - f=open(file_name, 'a') - f.write(log+"\n") - f.close() + with open(file_name, 'a') as f: + f.write(log+"\n") def redraw(self): """redraw the screen"""
--- a/frontends/primitivus/xmlui.py Wed Aug 04 12:00:25 2010 +0800 +++ b/frontends/primitivus/xmlui.py Wed Aug 04 12:01:07 2010 +0800 @@ -175,7 +175,17 @@ ##EVENTS## def onButtonPress(self, button): - self.host.debug() + callback_id, fields = button.param_id + data = {"callback_id":callback_id} + for field in fields: + ctrl = self.ctrl_list[field] + if isinstance(ctrl['control'],custom_widgets.List): + data[field] = '\t'.join(ctrl['control'].getSelectedValues()) + else: + data[field] = ctrl['control'].getValue() + + id = self.host.bridge.launchAction("button", data, profile_key = self.host.profile) + self.host.current_action_ids.add(id) def onFormSubmitted(self, button): data = []