diff browser_side/panels.py @ 48:153de5d461a4

added Social Contract \o. (in French only so far) - new infoDialog, to show widget, it's used here to show an external webpage - some CSS tuning
author Goffi <goffi@goffi.org>
date Thu, 26 May 2011 18:44:31 +0200
parents a7ff1e6f1229
children f1d2eb9b2523
line wrap: on
line diff
--- a/browser_side/panels.py	Thu May 26 17:17:48 2011 +0200
+++ b/browser_side/panels.py	Thu May 26 18:44:31 2011 +0200
@@ -34,9 +34,9 @@
 from pyjamas.ui.MenuItem import MenuItem
 from pyjamas.ui.Label import Label
 from pyjamas.ui.HTML import HTML
+from pyjamas.ui.Frame import Frame
 from pyjamas.ui.DropWidget import DropWidget
 from pyjamas.ui.ClickListener import ClickHandler
-from pyjamas.ui import HasAlignment
 from pyjamas.ui.KeyboardListener import KEY_ENTER
 from pyjamas.Timer import Timer
 from pyjamas import Window
@@ -50,7 +50,7 @@
 from tools import html_sanitize
 from datetime import datetime
 from time import time
-from dialog import ContactsChooser, PopupPanelWrapper
+import dialog
 
 class MenuCmd:
 
@@ -69,7 +69,8 @@
         SimplePanel.__init__(self)
 
         menu_general = MenuBar(vertical=True)
-        menu_general.addItem("Properties", MenuCmd(self, "onProperties"))
+        menu_general.addItem("Social contract", MenuCmd(self, "onSocialContract"))
+        menu_general.addItem("About", MenuCmd(self, "onAbout"))
 
         menu_games = MenuBar(vertical=True)
         menu_games.addItem("Tarot", MenuCmd(self, "onTarotGame"))
@@ -80,18 +81,28 @@
         menubar.addItem(MenuItem("Games", True, menu_games))
         self.add(menubar)
 
-    def onProperties(self):
-        Window.alert("Properties selected")
+    #General menu
+    def onSocialContract(self):
+        _frame = Frame('contrat_social.html')
+        _frame.setStyleName('infoFrame')
+        _dialog = dialog.InfoDialog("Contrat Social", _frame)
+        _dialog.setSize('80%', '80%')
+        _dialog.show()
+
+    def onAbout(self):
+        dialog.SimpleDialog("About", "Libervia, a Salut à Toi project").show() 
+    
+    #Game menu
 
     def onTarotGame(self):
         #Window.alert("Tarot selected")
         #self.host.tab_panel.add(EmptyPanel(self.host), "Tarot")
         def onPlayersSelected(other_players):
             self.host.bridge.call('launchTarotGame', None, other_players)
-        ContactsChooser(self.host, onPlayersSelected, 3, text="Please select 3 other players").getContacts() 
+        dialog.ContactsChooser(self.host, onPlayersSelected, 3, text="Please select 3 other players").getContacts() 
 
     def onXiangqiGame(self):
-        Window.alert("Xiangqi selected")
+        Window.alert("A Xiangqi is planed, but not available yet")
 
 class DropCell(DropWidget):
     """Cell in the middle grid which replace itself with the dropped widget on DnD"""
@@ -245,7 +256,7 @@
             return
         contents = HTML(msg)
 
-        self._popup = PopupPanelWrapper(autoHide=False, modal=False)
+        self._popup = dialog.PopupPanelWrapper(autoHide=False, modal=False)
         self._popup.target_data = target_data
         self._popup.add(contents)
         self._popup.setStyleName("warningPopup")