annotate src/browser/sat_browser/menu.py @ 686:90a5a5af2550

browser_side: let the backend check for the validity of MUC JIDs that come from a user input
author souliane <souliane@mailoo.org>
date Fri, 27 Mar 2015 00:15:42 +0100
parents 9877607c719a
children 76a67d04c63e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
685
9877607c719a 2015 copyright dates update
Goffi <goffi@goffi.org>
parents: 683
diff changeset
5 # Copyright (C) 2011, 2012, 2013, 2014, 2015 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__)
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 439
diff changeset
23
78
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
24 from pyjamas.ui.HTML import HTML
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
25 from pyjamas.ui.Frame import Frame
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 439
diff changeset
26
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
27 from constants import Const as C
467
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
28 import file_tools
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
29 import xmlui
616
1c0d5a87c554 browser_side: add and use method displayWidget to harmonize widget's management in Libervia (not completely done, there are some issues)
souliane <souliane@mailoo.org>
parents: 611
diff changeset
30 import chat
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 439
diff changeset
31 import dialog
467
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
32 import contact_group
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
33 import base_menu
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
34 from sat_browser import html_tools
336
629c99bbd031 browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents: 300
diff changeset
35
629c99bbd031 browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents: 300
diff changeset
36
627
30180021f203 browser_side: fixes MUC menus
souliane <souliane@mailoo.org>
parents: 616
diff changeset
37 unicode = str # FIXME: pyjamas workaround
30180021f203 browser_side: fixes MUC menus
souliane <souliane@mailoo.org>
parents: 616
diff changeset
38
30180021f203 browser_side: fixes MUC menus
souliane <souliane@mailoo.org>
parents: 616
diff changeset
39
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
40 class MainMenuBar(base_menu.GenericMenuBar):
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
41 """The main menu bar which is displayed on top of the document"""
78
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
42
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
43 ITEM_TPL = "<img src='media/icons/menu/%s_menu_red.png' />%s"
218
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
44
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
45 def __init__(self, host):
498
60be99de3808 browser_side: menus refactorization + handle levels > 2
souliane <souliane@mailoo.org>
parents: 494
diff changeset
46 styles = {'moved_popup': 'menuLastPopup', 'menu_bar': 'mainMenuBar'}
60be99de3808 browser_side: menus refactorization + handle levels > 2
souliane <souliane@mailoo.org>
parents: 494
diff changeset
47 base_menu.GenericMenuBar.__init__(self, host, vertical=False, styles=styles)
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
48
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
49 @classmethod
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
50 def getCategoryHTML(cls, category):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
51 name = html_tools.html_sanitize(category.name)
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
52 return cls.ITEM_TPL % (category.icon, name) if category.icon is not None else name
78
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
53
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
54 ## callbacks
218
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
55
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
56 # General menu
181
c0b78a3af06d browser side: web widget first draft
Goffi <goffi@goffi.org>
parents: 165
diff changeset
57
158
58442ed28f2b browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents: 152
diff changeset
58 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
59 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
60 if answer:
665
6a8a1103ad10 browser_side: OTR uses 'profilePlugged', 'disconnect' and 'gotMenus' listeners
souliane <souliane@mailoo.org>
parents: 654
diff changeset
61 self.host.disconnect(C.PROF_KEY_NONE)
158
58442ed28f2b browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents: 152
diff changeset
62 _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
63 _dialog.show()
58442ed28f2b browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents: 152
diff changeset
64
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
65 #Contact menu
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
66
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
67 def onManageContactGroups(self):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
68 """Open the contact groups manager."""
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
69
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
70 def onCloseCallback():
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
71 pass
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
72
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
73 contact_group.ContactGroupEditor(self.host, None, onCloseCallback)
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
74
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
75 #Group menu
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
76 def onJoinRoom(self):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
77
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
78 def invite(room_jid, contacts):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
79 for contact in contacts:
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
80 self.host.bridge.call('inviteMUC', None, unicode(contact), unicode(room_jid))
686
90a5a5af2550 browser_side: let the backend check for the validity of MUC JIDs that come from a user input
souliane <souliane@mailoo.org>
parents: 685
diff changeset
81
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
82 def join(room_jid, contacts):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
83 if self.host.whoami:
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
84 nick = self.host.whoami.node
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
85 contact_list = self.host.contact_list
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
86 if room_jid is None or room_jid not in contact_list.getSpecials(C.CONTACT_SPECIAL_GROUP):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
87 room_jid_s = unicode(room_jid) if room_jid else ''
686
90a5a5af2550 browser_side: let the backend check for the validity of MUC JIDs that come from a user input
souliane <souliane@mailoo.org>
parents: 685
diff changeset
88 self.host.bridge.joinMUC(room_jid_s, nick, profile=C.PROF_KEY_NONE, callback=lambda room_jid: invite(room_jid, contacts), errback=self.host.showFailureRoomInvalid)
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
89 else:
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
90 self.host.displayWidget(chat.Chat, room_jid, type_="group", new_tab=room_jid)
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
91 invite(room_jid, contacts)
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
92
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
93 dialog.RoomAndContactsChooser(self.host, join, ok_button="Join", visible=(True, False))
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
94
686
90a5a5af2550 browser_side: let the backend check for the validity of MUC JIDs that come from a user input
souliane <souliane@mailoo.org>
parents: 685
diff changeset
95
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
96 # Help menu
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
97
78
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
98 def onSocialContract(self):
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
99 _frame = Frame('contrat_social.html')
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
100 _frame.setStyleName('infoFrame')
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
101 _dialog = dialog.GenericDialog("Contrat Social", _frame)
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
102 _dialog.setSize('80%', '80%')
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
103 _dialog.show()
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
104
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
105 def onAbout(self):
683
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
106 def gotVersions():
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
107 _about = HTML("""<b>Libervia</b>, a Salut &agrave; Toi project<br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
108 <br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
109 Libervia is a web frontend for Salut &agrave; Toi<br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
110 <span style='font-style: italic;'>S&agrave;T version:</span> {sat_version}<br/>
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
111 <span style='font-style: italic;'>Libervia version:</span> {libervia_version}<br/>
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
112 <br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
113 You can contact the authors at <a href="mailto:contact@salut-a-toi.org">contact@salut-a-toi.org</a><br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
114 Blog available (mainly in french) at <a href="http://www.goffi.org" target="_blank">http://www.goffi.org</a><br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
115 Project page: <a href="http://salut-a-toi.org"target="_blank">http://salut-a-toi.org</a><br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
116 <br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
117 Any help welcome :)
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
118 <p style='font-size:small;text-align:center'>This project is dedicated to Roger Poisson</p>
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
119 """.format(sat_version=self.host.sat_version, libervia_version=self.host.libervia_version))
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
120 _dialog = dialog.GenericDialog("About", _about)
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
121 _dialog.show()
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
122 self.host.getVersions(gotVersions)
78
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
123
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
124 #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
125
391
c86d7a8d2c1e browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents: 387
diff changeset
126 def onAccount(self):
467
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
127 def gotUI(xml_ui):
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
128 if not xml_ui:
391
c86d7a8d2c1e browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents: 387
diff changeset
129 return
500
67a4e8383b70 browser side (XMLUI): XMLUI update to follow core changes:
Goffi <goffi@goffi.org>
parents: 498
diff changeset
130 body = xmlui.create(self.host, xml_ui)
464
bea9788f3170 browser and server sides: don't handle the "connectionError" signal anymore, we now use asyncConnect errback:
souliane <souliane@mailoo.org>
parents: 449
diff changeset
131 _dialog = dialog.GenericDialog("Manage your account", body, options=['NO_CLOSE'])
391
c86d7a8d2c1e browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents: 387
diff changeset
132 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
133 _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
134 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
135
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
136 def onParameters(self):
467
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
137 def gotParams(xml_ui):
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
138 if not xml_ui:
218
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
139 return
500
67a4e8383b70 browser side (XMLUI): XMLUI update to follow core changes:
Goffi <goffi@goffi.org>
parents: 498
diff changeset
140 body = xmlui.create(self.host, xml_ui)
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
141 _dialog = dialog.GenericDialog("Parameters", body, options=['NO_CLOSE'])
336
629c99bbd031 browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents: 300
diff changeset
142 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
143 _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
144 _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
145 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
146
218
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
147 def removeItemParams(self):
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
148 """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
149 self.menu_settings.removeItem(self.item_params)
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
150
152
7e87c87b7952 browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents: 148
diff changeset
151 def onAvatarUpload(self):
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
152 body = file_tools.AvatarUpload()
152
7e87c87b7952 browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents: 148
diff changeset
153 _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
154 body.setCloseCb(_dialog.close)
392
f539f6f8ee9c browser_side: standardize the dialogs size and buttons display:
souliane <souliane@mailoo.org>
parents: 391
diff changeset
155 _dialog.setWidth('40%')
152
7e87c87b7952 browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents: 148
diff changeset
156 _dialog.show()