annotate src/browser/sat_browser/menu.py @ 722:242dde89e698

browser side (xmlui): default callback is used for launchAction
author Goffi <goffi@goffi.org>
date Tue, 25 Aug 2015 14:42:45 +0200
parents f1271f769ffd
children ad733b670cc3
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):
690
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 686
diff changeset
51 """Build the html to be used for displaying a category item.
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 686
diff changeset
52
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 686
diff changeset
53 @param category (quick_menus.MenuCategory): category to add
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 686
diff changeset
54 @return unicode: HTML to display
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 686
diff changeset
55 """
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
56 name = html_tools.html_sanitize(category.name)
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
57 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
58
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
59 ## callbacks
218
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
60
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
61 # General menu
181
c0b78a3af06d browser side: web widget first draft
Goffi <goffi@goffi.org>
parents: 165
diff changeset
62
158
58442ed28f2b browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents: 152
diff changeset
63 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
64 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
65 if answer:
665
6a8a1103ad10 browser_side: OTR uses 'profilePlugged', 'disconnect' and 'gotMenus' listeners
souliane <souliane@mailoo.org>
parents: 654
diff changeset
66 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
67 _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
68 _dialog.show()
58442ed28f2b browser side: basic disconnection management: hard reload is done on empty signal response
Goffi <goffi@goffi.org>
parents: 152
diff changeset
69
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
70 #Contact menu
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
71
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
72 def onManageContactGroups(self):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
73 """Open the contact groups manager."""
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 def onCloseCallback():
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
76 pass
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 contact_group.ContactGroupEditor(self.host, None, onCloseCallback)
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
79
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
80 #Group menu
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
81 def onJoinRoom(self):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
82
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
83 def invite(room_jid, contacts):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
84 for contact in contacts:
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
85 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
86
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
87 def join(room_jid, contacts):
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
88 if self.host.whoami:
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
89 nick = self.host.whoami.node
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
90 contact_list = self.host.contact_list
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
91 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
92 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
93 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
94 else:
698
f1271f769ffd browser_side: don't open a new tab when inviting people to a MUC we already joined
souliane <souliane@mailoo.org>
parents: 690
diff changeset
95 self.host.displayWidget(chat.Chat, room_jid, type_="group")
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
96 invite(room_jid, contacts)
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
97
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
98 dialog.RoomAndContactsChooser(self.host, join, ok_button="Join", visible=(True, False))
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
99
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
100
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
101 # Help menu
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 669
diff changeset
102
78
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
103 def onSocialContract(self):
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
104 _frame = Frame('contrat_social.html')
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
105 _frame.setStyleName('infoFrame')
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
106 _dialog = dialog.GenericDialog("Contrat Social", _frame)
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
107 _dialog.setSize('80%', '80%')
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
108 _dialog.show()
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
109
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
110 def onAbout(self):
683
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
111 def gotVersions():
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
112 _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
113 <br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
114 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
115 <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
116 <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
117 <br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
118 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
119 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
120 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
121 <br />
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
122 Any help welcome :)
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
123 <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
124 """.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
125 _dialog = dialog.GenericDialog("About", _about)
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
126 _dialog.show()
801eb94aa869 browser side: versions management + version is shown in about dialog
Goffi <goffi@goffi.org>
parents: 676
diff changeset
127 self.host.getVersions(gotVersions)
78
12680e220b35 browser side: refactoring: menu is now in its own module
Goffi <goffi@goffi.org>
parents:
diff changeset
128
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
129 #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
130
391
c86d7a8d2c1e browser_side: added a dialog in Settings/Account to update/delete the XMPP account
souliane <souliane@mailoo.org>
parents: 387
diff changeset
131 def onAccount(self):
467
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
132 def gotUI(xml_ui):
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
133 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
134 return
500
67a4e8383b70 browser side (XMLUI): XMLUI update to follow core changes:
Goffi <goffi@goffi.org>
parents: 498
diff changeset
135 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
136 _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
137 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
138 _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
139 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
140
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 def onParameters(self):
467
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
142 def gotParams(xml_ui):
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 464
diff changeset
143 if not xml_ui:
218
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
144 return
500
67a4e8383b70 browser side (XMLUI): XMLUI update to follow core changes:
Goffi <goffi@goffi.org>
parents: 498
diff changeset
145 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
146 _dialog = dialog.GenericDialog("Parameters", body, options=['NO_CLOSE'])
336
629c99bbd031 browser + server side: refactored menus:
Goffi <goffi@goffi.org>
parents: 300
diff changeset
147 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
148 _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
149 _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
150 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
151
218
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
152 def removeItemParams(self):
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
153 """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
154 self.menu_settings.removeItem(self.item_params)
4e6467efd6bf browser_side: small improvements for parameters panel
souliane <souliane@mailoo.org>
parents: 215
diff changeset
155
152
7e87c87b7952 browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents: 148
diff changeset
156 def onAvatarUpload(self):
494
5d8632a7bfde browser_side: refactorisation of menus and LiberviaWidget's header
souliane <souliane@mailoo.org>
parents: 492
diff changeset
157 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
158 _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
159 body.setCloseCb(_dialog.close)
392
f539f6f8ee9c browser_side: standardize the dialogs size and buttons display:
souliane <souliane@mailoo.org>
parents: 391
diff changeset
160 _dialog.setWidth('40%')
152
7e87c87b7952 browser side: temporary avatar upload dialog is added to setting menu
Goffi <goffi@goffi.org>
parents: 148
diff changeset
161 _dialog.show()