changeset 148:8635bc9db9bf

added parameter management to test XMLUI, but it's currently deactivated for security reasons (need some configuration options) + separated mainTabPanel CSS from LiberviaTabPanel
author Goffi <goffi@goffi.org>
date Sun, 09 Dec 2012 23:42:08 +0100
parents 60ea800b7237
children f78761e1be8e
files browser_side/menu.py browser_side/panels.py libervia.py libervia.tac public/libervia.css
diffstat 5 files changed, 52 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/menu.py	Sun Dec 09 23:38:30 2012 +0100
+++ b/browser_side/menu.py	Sun Dec 09 23:42:08 2012 +0100
@@ -35,6 +35,7 @@
 from pyjamas import Window
 from jid import JID
 from tools import html_sanitize
+from xmlui import XMLUI
 import dialog
 import re
 
@@ -93,6 +94,7 @@
         menu_help.addItem("About", MenuCmd(self, "onAbout"))
         
         menu_settings = MenuBar(vertical=True)
+        #menu_settings.addItem("Parameters", MenuCmd(self, "onParameters"))
         
         menubar = LiberviaMenuBar()
         
@@ -248,3 +250,16 @@
 
     def onXiangqiGame(self):
         Window.alert("A Xiangqi game is planed, but not available yet")
+
+    #Settings menu
+
+    def onParameters(self):
+        def gotParams(xmlui):
+            body = XMLUI(self.host, xmlui)
+            _dialog = dialog.GenericDialog("Parameters", body, options=['NO_CLOSE'])
+            body.setCloseCb(_dialog.close) 
+            _dialog.setSize('80%', '80%')
+            _dialog.show()
+
+        self.host.bridge.call('getParamsUI', gotParams)
+
--- a/browser_side/panels.py	Sun Dec 09 23:38:30 2012 +0100
+++ b/browser_side/panels.py	Sun Dec 09 23:42:08 2012 +0100
@@ -931,7 +931,8 @@
         TabPanel.__init__(self)
         self.host=host
         self.tabBar.setVisible(False)
-        self.setStyleName('mainTabPanel')
+        self.setStyleName('liberviaTabPanel')
+        self.addStyleName('mainTabPanel')
         Window.addWindowResizeListener(self)
 
     def onWindowResized(self, width, height):
--- a/libervia.py	Sun Dec 09 23:38:30 2012 +0100
+++ b/libervia.py	Sun Dec 09 23:42:08 2012 +0100
@@ -84,7 +84,10 @@
         LiberviaJsonProxy.__init__(self, "/json_api",
                         ["getContacts", "addContact", "sendMessage", "sendMblog", "getLastMblogs", "getMassiveLastMblogs", "getProfileJid", "getHistory", "getPresenceStatus",
                          "joinMUC", "getRoomsJoined", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed",
-                         "tarotGamePlayCards", "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getEntityData"])
+                         "tarotGamePlayCards", "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getEntityData", "getParamsUI",
+                         #"setParam",
+                         "launchAction",
+                        ])
 
 class BridgeSignals(LiberviaJsonProxy):
     def __init__(self, host):
@@ -119,6 +122,7 @@
         self.room_list = set() #set of rooms 
         self.mblog_cache = [] #used to keep our own blog entries in memory, to show them in new mblog panel
         self.avatars_cache = {} #keep track of jid's avatar hash (key=jid, value=file)
+        self.current_action_ids = set()
         #self.discuss_panel.addWidget(panels.EmptyPanel(self))
         self.discuss_panel.addWidget(panels.MicroblogPanel(self, []))
         #self.discuss_panel.addWidget(panels.EmptyPanel(self))
--- a/libervia.tac	Sun Dec 09 23:38:30 2012 +0100
+++ b/libervia.tac	Sun Dec 09 23:42:08 2012 +0100
@@ -315,6 +315,22 @@
         profile = ISATSession(self.session).profile
         return self.sat_host.bridge.getEntityData(jid, keys, profile)
 
+    #def jsonrpc_getParamsUI(self):
+    #    """Return the parameters XMLUI for profile"""
+    #    profile = ISATSession(self.session).profile
+    #    d = defer.Deferred()
+    #    self.sat_host.bridge.getParamsUI(profile, callback=d.callback, errback=d.errback)
+    #    #d.addCallback(lambda result: unicode(result))
+    #    return d
+
+    #def jsonrpc_setParam(self, name, value, category):
+    #    profile = ISATSession(self.session).profile
+    #    return self.sat_host.bridge.setParam(name, value, category, profile)
+
+    def jsonrpc_launchAction(self, action_type, data):
+        profile = ISATSession(self.session).profile
+        return self.sat_host.bridge.launchAction(action_type, data, profile)
+        
 class Register(jsonrpc.JSONRPC):
     """This class manage the registration procedure with SàT
     It provide an api for the browser, check password and setup the web server"""
--- a/public/libervia.css	Sun Dec 09 23:38:30 2012 +0100
+++ b/public/libervia.css	Sun Dec 09 23:42:08 2012 +0100
@@ -964,7 +964,7 @@
 
 /* Tab panel */
 
-.mainTabPanel {
+.liberviaTabPanel {
 }
 
 .gwt-TabPanel {
@@ -975,14 +975,17 @@
 }
 
 .gwt-TabBar {
-  position: fixed;
-  z-index: 10;
-  bottom: 0;
   font-weight: bold;
   text-decoration: none;
   border-bottom: 3px solid #a01c1c;  
 }
 
+.mainTabPanel .gwt-TabBar {
+  z-index: 10;
+  position: fixed;
+  bottom: 0;
+}
+
 .gwt-TabBar .gwt-TabBarFirst {
   height: 100%;
 }
@@ -990,19 +993,19 @@
 .gwt-TabBar .gwt-TabBarRest {
 }
 
-.mainTabPanel .gwt-TabBar {;
+.liberviaTabPanel .gwt-TabBar {;
 }
 
-.mainTabPanel .gwt-TabBar .gwt-TabBarItem {
+.liberviaTabPanel .gwt-TabBar .gwt-TabBarItem {
   cursor: pointer;
   margin-right: 5px;
 }
 
-.mainTabPanel .gwt-TabBarItem div {
+.liberviaTabPanel .gwt-TabBarItem div {
 	color: #fff;
 }
 
-.mainTabPanel .gwt-TabBarItem {
+.liberviaTabPanel .gwt-TabBarItem {
   color: #444 !important;
   background-color: #222;
   filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#444′, endColorstr=’#222’);
@@ -1019,7 +1022,7 @@
   text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
 }
 
-.mainTabPanel .gwt-TabBarItem-selected {
+.liberviaTabPanel .gwt-TabBarItem-selected {
   color: #fff;
   background-color: #cf2828;
   filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#cf2828′, endColorstr=’#981a1a’);
@@ -1036,7 +1039,7 @@
   text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
 }
 
-.mainTabPanel div.gwt-TabBarItem:hover {
+.liberviaTabPanel div.gwt-TabBarItem:hover {
   color: #fff;
   background-color: #cf2828;
   filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#cf2828′, endColorstr=’#981a1a’);
@@ -1053,7 +1056,7 @@
   text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); 
 }
 
-.mainTabPanel .gwt-TabBar .gwt-TabBarItem-selected {
+.liberviaTabPanel .gwt-TabBar .gwt-TabBarItem-selected {
   cursor: default;
 }