# HG changeset patch # User Goffi # Date 1306428271 -7200 # Node ID 153de5d461a40d5a88785e1bb8792c6bde9be163 # Parent 7cabe3c1a5f2116181cd66d6944108c65ac334dc 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 diff -r 7cabe3c1a5f2 -r 153de5d461a4 browser_side/dialog.py --- a/browser_side/dialog.py Thu May 26 17:17:48 2011 +0200 +++ b/browser_side/dialog.py Thu May 26 18:44:31 2011 +0200 @@ -26,6 +26,7 @@ from pyjamas.ui.ListBox import ListBox from pyjamas.ui.Button import Button from pyjamas.ui.HTML import HTML +from pyjamas.ui import HasAlignment from pyjamas.ui.KeyboardListener import KEY_ESCAPE class ContactsChooser(DialogBox): @@ -112,27 +113,36 @@ self.hide() self.callback(False) -class SimpleDialog(DialogBox): +class InfoDialog(DialogBox): + """Dialog which just show a widget and a close button""" - def __init__(self, title, body, callback = None): + def __init__(self, title, widget, callback = None): """Simple notice dialog box @param title: HTML put in the header - @param body: HTML put in the body""" + @param body: widget put in the body""" DialogBox.__init__(self, centered=True) self.callback = callback _body = VerticalPanel() + _body.setSize('100%','100%') + _body.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) _body.setSpacing(4) - _body.add(HTML(body)) + _body.add(widget) + _body.setCellWidth(widget, '100%') _body.add(Button("Close", self.onClose)) - _body.setStyleName("dialogBody") self.setHTML(title) self.setWidget(_body) + self.panel.setWidth('100%') def onClose(self): self.hide() if self.callback: self.callback() +class SimpleDialog(InfoDialog): + + def __init__(self, title, body, callback = None): + InfoDialog.__init__(self, title, HTML(body), callback) + class PopupPanelWrapper(PopupPanel): """This wrapper catch Escape event to avoid request cancellation by Firefox""" diff -r 7cabe3c1a5f2 -r 153de5d461a4 browser_side/panels.py --- 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") diff -r 7cabe3c1a5f2 -r 153de5d461a4 public/contrat_social.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/public/contrat_social.html Thu May 26 18:44:31 2011 +0200 @@ -0,0 +1,110 @@ + + + + + Salut à Toi: Contrat Social + + + +Le projet « Salut à Toi » est né d'un besoin de protection de nos +libertés, de notre vie privée et de notre indépendance. Il se veut +garant des droits et libertés qu'un utilisateur a vis à vis de ses +propres informations, des informations numériques sur sa vie ou celles +de ses connaissances, des données qu'il manipule; et se veut également +un point de contact humain, ne se substituant pas aux rapports réels, +mais au contraire les facilitant.
+ +Salut à Toi lutte et luttera toujours contre toute forme de main mise +sur les technologies par des intérêts privés. Le réseau global doit +appartenir à tous, et être un point d'expression et de liberté pour +l'Humanité.
+ +
+ +À ce titre, « Salut à Toi » et ceux qui y participent se basent sur un +contrat social, un engagement vis à vis de ceux qui l'utilisent. Ce +contrat consiste en les points suivants:
+ + + + diff -r 7cabe3c1a5f2 -r 153de5d461a4 public/libervia.css --- a/public/libervia.css Thu May 26 17:17:48 2011 +0200 +++ b/public/libervia.css Thu May 26 18:44:31 2011 +0200 @@ -133,6 +133,7 @@ margin: 2px; font-weight: bold; cursor: default; + text-align: center; } .gwt-DialogBox .Registration { @@ -150,6 +151,10 @@ text-align: center; } +.infoDialogBody { + width: 100%; + height: 100% +} /* Contact List */ .contactTitle { @@ -406,3 +411,8 @@ border: 3px dashed red; } +.infoFrame { + position: relative; + width: 100%; + height: 100%; +}