Mercurial > libervia-web
annotate browser_side/menu.py @ 441:63017904c4d4
server_side: static blog retrieve page's title, meta description and keywords from the parameters
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 13 May 2014 17:09:41 +0200 |
parents | d52f529a6d42 |
children |
rev | line source |
---|---|
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
4 # Libervia: a Salut à Toi frontend |
340 | 5 # Copyright (C) 2011, 2012, 2013, 2014 Jérôme Poisson <goffi@goffi.org> |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
10 # (at your option) any later version. |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
15 # GNU Affero General Public License for more details. |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
387
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
20 import pyjd # this is dummy in pyjs |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
432
diff
changeset
|
21 from sat.core.log import getLogger |
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
432
diff
changeset
|
22 log = getLogger(__name__) |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from pyjamas.ui.SimplePanel import SimplePanel |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from pyjamas.ui.MenuBar import MenuBar |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 from pyjamas.ui.MenuItem import MenuItem |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from pyjamas.ui.HTML import HTML |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 from pyjamas.ui.Frame import Frame |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 from pyjamas import Window |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 from jid import JID |
387
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
30 from file_tools import FileUploadPanel |
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
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
31 from xmlui import XMLUI |
432
8ecc5a7062e4
browser and server sides: fixes module import + use enumerate instead of xrange
souliane <souliane@mailoo.org>
parents:
431
diff
changeset
|
32 from browser_side import panels |
8ecc5a7062e4
browser and server sides: fixes module import + use enumerate instead of xrange
souliane <souliane@mailoo.org>
parents:
431
diff
changeset
|
33 from browser_side import dialog |
256
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
34 from contact_group import ContactGroupEditor |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
35 from sat.core.i18n import _ |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
37 |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 class MenuCmd: |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
40 def __init__(self, object_, handler): |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
41 self._object = object_ |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 self._handler = handler |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 def execute(self): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 handler = getattr(self._object, self._handler) |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 handler() |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
48 |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
49 class PluginMenuCmd: |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
50 |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
51 def __init__(self, host, action_id): |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
52 self.host = host |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
53 self.action_id = action_id |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
54 |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
55 def execute(self): |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
56 self.host.launchAction(self.action_id, None) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
57 |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
58 |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 class LiberviaMenuBar(MenuBar): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 def __init__(self): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 MenuBar.__init__(self, vertical=False) |
220
09e4de9df5b7
browser side: enforced "gwt-MenuBar-horizontal" style in LiberviaMenuBar to workaround a class name fix in Pyjamas' MenuBar which was causing troubles with CSS.
Goffi <goffi@goffi.org>
parents:
218
diff
changeset
|
63 self.setStyleName('gwt-MenuBar-horizontal') # XXX: workaround for the Pyjamas' class name fix (it's now "gwt-MenuBar gwt-MenuBar-horizontal") |
09e4de9df5b7
browser side: enforced "gwt-MenuBar-horizontal" style in LiberviaMenuBar to workaround a class name fix in Pyjamas' MenuBar which was causing troubles with CSS.
Goffi <goffi@goffi.org>
parents:
218
diff
changeset
|
64 # TODO: properly adapt CSS to the new class name |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
65 |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 def doItemAction(self, item, fireCommand): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 MenuBar.doItemAction(self, item, fireCommand) |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 if item == self.items[-1] and self.popup: |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 self.popup.setPopupPosition(Window.getClientWidth() - |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
70 self.popup.getOffsetWidth() - 22, |
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
71 self.getAbsoluteTop() + |
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
72 self.getOffsetHeight() - 1) |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 self.popup.addStyleName('menuLastPopup') |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
75 |
387
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
76 class AvatarUpload(FileUploadPanel): |
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
77 def __init__(self): |
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
78 texts = {'ok_button': 'Upload avatar', |
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
79 'body': 'Please select an image to show as your avatar...<br>Your picture must be a square and will be resized to 64x64 pixels if necessary.', |
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
80 'errback': "Can't open image... did you actually submit an image?", |
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
81 'body_errback': 'Please select another image file.', |
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
82 'callback': "Your new profile picture has been set!"} |
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
83 FileUploadPanel.__init__(self, 'upload_avatar', 'avatar_path', 2, texts) |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
85 |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 class Menu(SimplePanel): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 def __init__(self, host): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 self.host = host |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 SimplePanel.__init__(self) |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 self.setStyleName('menuContainer') |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
92 |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
93 def createMenus(self, add_menus): |
79
d57e0d6b1ced
browser side: inclusion of Adrien's icons
Goffi <goffi@goffi.org>
parents:
78
diff
changeset
|
94 _item_tpl = "<img src='media/icons/menu/%s_menu_red.png' />%s" |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
95 menus_dict = {} |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
96 menus_order = [] |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
98 def addMenu(menu_name, menu_name_i18n, item_name_i18n, icon, menu_cmd): |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
99 """ add a menu to menu_dict """ |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
432
diff
changeset
|
100 log.info("addMenu: %s %s %s %s %s" % (menu_name, menu_name_i18n, item_name_i18n, icon, menu_cmd)) |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
101 try: |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
102 menu_bar = menus_dict[menu_name] |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
103 except KeyError: |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
104 menu_bar = menus_dict[menu_name] = MenuBar(vertical=True) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
105 menus_order.append((menu_name, menu_name_i18n, icon)) |
431
4fcf9bac109c
browser_side: roster management menus are now imported from the backend
souliane <souliane@mailoo.org>
parents:
392
diff
changeset
|
106 if item_name_i18n and menu_cmd: |
4fcf9bac109c
browser_side: roster management menus are now imported from the backend
souliane <souliane@mailoo.org>
parents:
392
diff
changeset
|
107 menu_bar.addItem(item_name_i18n, menu_cmd) |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
109 addMenu("General", _("General"), _("Web widget"), 'home', MenuCmd(self, "onWebWidget")) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
110 addMenu("General", _("General"), _("Disconnect"), 'home', MenuCmd(self, "onDisconnect")) |
431
4fcf9bac109c
browser_side: roster management menus are now imported from the backend
souliane <souliane@mailoo.org>
parents:
392
diff
changeset
|
111 addMenu("Contacts", _("Contacts"), None, 'social', None) |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
112 addMenu("Groups", _("Groups"), _("Discussion"), 'social', MenuCmd(self, "onJoinRoom")) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
113 addMenu("Groups", _("Groups"), _("Collective radio"), 'social', MenuCmd(self, "onCollectiveRadio")) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
114 addMenu("Games", _("Games"), _("Tarot"), 'games', MenuCmd(self, "onTarotGame")) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
115 addMenu("Games", _("Games"), _("Xiangqi"), 'games', MenuCmd(self, "onXiangqiGame")) |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
117 # additional menus |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
118 for action_id, type_, path, path_i18n in add_menus: |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
119 if not path: |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
432
diff
changeset
|
120 log.warning("skipping menu without path") |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
121 continue |
377
603fa314880e
browser side: fixed bad variable reference in menus management
Goffi <goffi@goffi.org>
parents:
370
diff
changeset
|
122 if len(path) != len(path_i18n): |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
432
diff
changeset
|
123 log.error("inconsistency between menu paths") |
377
603fa314880e
browser side: fixed bad variable reference in menus management
Goffi <goffi@goffi.org>
parents:
370
diff
changeset
|
124 continue |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
125 menu_name = path[0] |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
126 menu_name_i18n = path_i18n[0] |
377
603fa314880e
browser side: fixed bad variable reference in menus management
Goffi <goffi@goffi.org>
parents:
370
diff
changeset
|
127 item_name = path[1:] |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
128 if not item_name: |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
432
diff
changeset
|
129 log.warning("skipping menu with a path of lenght 1 [%s]" % path[0]) |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
130 continue |
377
603fa314880e
browser side: fixed bad variable reference in menus management
Goffi <goffi@goffi.org>
parents:
370
diff
changeset
|
131 item_name_i18n = ' | '.join(path_i18n[1:]) |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
132 addMenu(menu_name, menu_name_i18n, item_name_i18n, 'plugins', PluginMenuCmd(self.host, action_id)) |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
133 |
431
4fcf9bac109c
browser_side: roster management menus are now imported from the backend
souliane <souliane@mailoo.org>
parents:
392
diff
changeset
|
134 # menu items that should be displayed after the automatically added ones |
4fcf9bac109c
browser_side: roster management menus are now imported from the backend
souliane <souliane@mailoo.org>
parents:
392
diff
changeset
|
135 addMenu("Contacts", _("Contacts"), _("Manage groups"), 'social', MenuCmd(self, "onManageContactGroups")) |
4fcf9bac109c
browser_side: roster management menus are now imported from the backend
souliane <souliane@mailoo.org>
parents:
392
diff
changeset
|
136 |
387
933bce4cb816
browser_side: factorize the code from AvatarUpload to a new class FileUploadPanel
souliane <souliane@mailoo.org>
parents:
377
diff
changeset
|
137 menus_order.append(None) # we add separator |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
138 |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
139 addMenu("Help", _("Help"), _("Social contract"), 'help', MenuCmd(self, "onSocialContract")) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
140 addMenu("Help", _("Help"), _("About"), 'help', MenuCmd(self, "onAbout")) |
391
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
141 addMenu("Settings", _("Settings"), _("Account"), 'settings', MenuCmd(self, "onAccount")) |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
142 addMenu("Settings", _("Settings"), _("Parameters"), 'settings', MenuCmd(self, "onParameters")) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
143 |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
144 # XXX: temporary, will change when a full profile will be managed in SàT |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
145 addMenu("Settings", _("Settings"), _("Upload avatar"), 'settings', MenuCmd(self, "onAvatarUpload")) |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
146 |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
147 menubar = LiberviaMenuBar() |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
148 |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
149 for menu_data in menus_order: |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
150 if menu_data is None: |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
151 _separator = MenuItem('', None) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
152 _separator.setStyleName('menuSeparator') |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
153 menubar.addItem(_separator, None) |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
154 else: |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
155 menu_name, menu_name_i18n, icon = menu_data |
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
156 menubar.addItem(MenuItem(_item_tpl % (icon, menu_name_i18n), True, menus_dict[menu_name])) |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
157 |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
158 self.add(menubar) |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
159 |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
160 #General menu |
181
c0b78a3af06d
browser side: web widget first draft
Goffi <goffi@goffi.org>
parents:
165
diff
changeset
|
161 def onWebWidget(self): |
c0b78a3af06d
browser side: web widget first draft
Goffi <goffi@goffi.org>
parents:
165
diff
changeset
|
162 web_panel = panels.WebPanel(self.host, "http://www.goffi.org") |
257
377de26d5bc2
browser_side: open the web widget in the current tab
souliane <souliane@mailoo.org>
parents:
256
diff
changeset
|
163 self.host.addWidget(web_panel) |
377de26d5bc2
browser_side: open the web widget in the current tab
souliane <souliane@mailoo.org>
parents:
256
diff
changeset
|
164 self.host.setSelected(web_panel) |
181
c0b78a3af06d
browser side: web widget first draft
Goffi <goffi@goffi.org>
parents:
165
diff
changeset
|
165 |
158
58442ed28f2b
browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents:
152
diff
changeset
|
166 def onDisconnect(self): |
58442ed28f2b
browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents:
152
diff
changeset
|
167 def confirm_cb(answer): |
58442ed28f2b
browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents:
152
diff
changeset
|
168 if answer: |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
432
diff
changeset
|
169 log.info("disconnection") |
158
58442ed28f2b
browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents:
152
diff
changeset
|
170 self.host.bridge.call('disconnect', None) |
58442ed28f2b
browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents:
152
diff
changeset
|
171 _dialog = dialog.ConfirmDialog(confirm_cb, text="Do you really want to disconnect ?") |
58442ed28f2b
browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents:
152
diff
changeset
|
172 _dialog.show() |
58442ed28f2b
browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents:
152
diff
changeset
|
173 |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
174 def onSocialContract(self): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
175 _frame = Frame('contrat_social.html') |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
176 _frame.setStyleName('infoFrame') |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
177 _dialog = dialog.GenericDialog("Contrat Social", _frame) |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
178 _dialog.setSize('80%', '80%') |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
179 _dialog.show() |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
180 |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
181 def onAbout(self): |
147
60ea800b7237
browser side: fixed about menu + updated website URL
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
182 _about = HTML("""<b>Libervia</b>, a Salut à Toi project<br /> |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
183 <br /> |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
184 You can contact the author at <a href="mailto:goffi@goffi.org">goffi@goffi.org</a><br /> |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
185 Blog available (mainly in french) at <a href="http://www.goffi.org" target="_blank">http://www.goffi.org</a><br /> |
147
60ea800b7237
browser side: fixed about menu + updated website URL
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
186 Project page: <a href="http://sat.goffi.org"target="_blank">http://sat.goffi.org</a><br /> |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
187 <br /> |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
188 Any help welcome :) |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
189 <p style='font-size:small;text-align:center'>This project is dedicated to Roger Poisson</p> |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
190 """) |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
191 _dialog = dialog.GenericDialog("About", _about) |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
192 _dialog.show() |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
193 |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
194 #Contact menu |
256
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
195 def onManageContactGroups(self): |
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
196 """Open the contact groups manager.""" |
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
197 |
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
198 def onCloseCallback(): |
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
199 pass |
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
200 |
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
201 ContactGroupEditor(self.host, None, onCloseCallback) |
0e7f3944bd27
browser_side: added contact group manager based on ListManager
souliane <souliane@mailoo.org>
parents:
242
diff
changeset
|
202 |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
203 #Group menu |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
204 def onJoinRoom(self): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
205 |
268
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
206 def invite(room_jid, contacts): |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
207 for contact in contacts: |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
208 self.host.bridge.call('inviteMUC', None, contact, room_jid) |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
209 |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
210 def join(room_jid, contacts): |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
211 if self.host.whoami: |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
212 nick = self.host.whoami.node |
268
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
213 if room_jid not in [room.bare for room in self.host.room_list]: |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
214 self.host.bridge.call('joinMUC', lambda room_jid: invite(room_jid, contacts), room_jid, nick) |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
215 else: |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
216 self.host.getOrCreateLiberviaWidget(panels.ChatPanel, (room_jid, "group"), True, JID(room_jid).bare) |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
217 invite(room_jid, contacts) |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
218 |
268
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
219 dialog.RoomAndContactsChooser(self.host, join, ok_button="Join", visible=(True, False)) |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
220 |
125
f9d63624699f
radio collective integration, first draft
Goffi <goffi@goffi.org>
parents:
103
diff
changeset
|
221 def onCollectiveRadio(self): |
268
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
222 def callback(room_jid, contacts): |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
223 self.host.bridge.call('launchRadioCollective', None, contacts, room_jid) |
272
0cb9869b42b6
browser_side: bug fix for RoomAndContactsChooser (do not display the MUCs in the list)
souliane <souliane@mailoo.org>
parents:
268
diff
changeset
|
224 dialog.RoomAndContactsChooser(self.host, callback, ok_button="Choose", title="Collective Radio", visible=(False, True)) |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
225 |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
226 #Game menu |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
227 def onTarotGame(self): |
268
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
228 def onPlayersSelected(room_jid, other_players): |
79970bf6af93
browser_side: added class RoomAndContactsChooser:
souliane <souliane@mailoo.org>
parents:
257
diff
changeset
|
229 self.host.bridge.call('launchTarotGame', None, other_players, room_jid) |
272
0cb9869b42b6
browser_side: bug fix for RoomAndContactsChooser (do not display the MUCs in the list)
souliane <souliane@mailoo.org>
parents:
268
diff
changeset
|
230 dialog.RoomAndContactsChooser(self.host, onPlayersSelected, 3, title="Tarot", title_invite="Please select 3 other players", visible=(False, True)) |
78
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
231 |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
232 def onXiangqiGame(self): |
12680e220b35
browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
233 Window.alert("A Xiangqi game is planed, but not available yet") |
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
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
234 |
8635bc9db9bf
added parameter management to test XMLUI, but it's currently deactivated for security reasons (need some configuration options) + separated mainTabPanel CSS from LiberviaTabPanel
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
235 #Settings menu |
8635bc9db9bf
added parameter management to test XMLUI, but it's currently deactivated for security reasons (need some configuration options) + separated mainTabPanel CSS from LiberviaTabPanel
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
236 |
391
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
237 def onAccount(self): |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
238 def gotUI(xmlui): |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
239 if not xmlui: |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
240 return |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
241 body = XMLUI(self.host, xmlui) |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
242 _dialog = dialog.GenericDialog("Manage your XMPP account", body, options=['NO_CLOSE']) |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
243 body.setCloseCb(_dialog.close) |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
244 _dialog.show() |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
245 self.host.bridge.call('getAccountDialogUI', gotUI) |
c86d7a8d2c1e
browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents:
387
diff
changeset
|
246 |
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
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
247 def onParameters(self): |
8635bc9db9bf
added parameter management to test XMLUI, but it's currently deactivated for security reasons (need some configuration options) + separated mainTabPanel CSS from LiberviaTabPanel
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
248 def gotParams(xmlui): |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
249 if not xmlui: |
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
250 return |
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
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
251 body = XMLUI(self.host, xmlui) |
8635bc9db9bf
added parameter management to test XMLUI, but it's currently deactivated for security reasons (need some configuration options) + separated mainTabPanel CSS from LiberviaTabPanel
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
252 _dialog = dialog.GenericDialog("Parameters", body, options=['NO_CLOSE']) |
336
629c99bbd031
browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
253 body.setCloseCb(_dialog.close) |
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
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
254 _dialog.setSize('80%', '80%') |
8635bc9db9bf
added parameter management to test XMLUI, but it's currently deactivated for security reasons (need some configuration options) + separated mainTabPanel CSS from LiberviaTabPanel
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
255 _dialog.show() |
8635bc9db9bf
added parameter management to test XMLUI, but it's currently deactivated for security reasons (need some configuration options) + separated mainTabPanel CSS from LiberviaTabPanel
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
256 self.host.bridge.call('getParamsUI', gotParams) |
8635bc9db9bf
added parameter management to test XMLUI, but it's currently deactivated for security reasons (need some configuration options) + separated mainTabPanel CSS from LiberviaTabPanel
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
257 |
218
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
258 def removeItemParams(self): |
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
259 """Remove the Parameters item from the Settings menu bar.""" |
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
260 self.menu_settings.removeItem(self.item_params) |
4e6467efd6bf
browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents:
215
diff
changeset
|
261 |
152
7e87c87b7952
browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents:
148
diff
changeset
|
262 def onAvatarUpload(self): |
7e87c87b7952
browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents:
148
diff
changeset
|
263 body = AvatarUpload() |
7e87c87b7952
browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents:
148
diff
changeset
|
264 _dialog = dialog.GenericDialog("Avatar upload", body, options=['NO_CLOSE']) |
7e87c87b7952
browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents:
148
diff
changeset
|
265 body.setCloseCb(_dialog.close) |
392
f539f6f8ee9c
browser_side: standardize the dialogs size and buttons display:
souliane <souliane@mailoo.org>
parents:
391
diff
changeset
|
266 _dialog.setWidth('40%') |
152
7e87c87b7952
browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents:
148
diff
changeset
|
267 _dialog.show() |