Mercurial > libervia-web
annotate src/browser/sat_browser/main_panel.py @ 1000:4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 05 Jan 2018 16:30:05 +0100 |
parents | fd4eae654182 |
children | f2170536ba23 |
rev | line source |
---|---|
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
4 # Libervia: a Salut à Toi frontend |
964
fd4eae654182
misc: date update (yes it's a bit late :p )
Goffi <goffi@goffi.org>
parents:
944
diff
changeset
|
5 # Copyright (C) 2011-2017 Jérôme Poisson <goffi@goffi.org> |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
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:
334
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:
334
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:
334
diff
changeset
|
10 # (at your option) any later version. |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
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:
334
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:
334
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:
334
diff
changeset
|
15 # GNU Affero General Public License for more details. |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
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:
334
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
20 """Panels used as main basis""" |
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
21 |
226
744426c2b699
browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents:
223
diff
changeset
|
22 import pyjd # this is dummy in pyjs |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
23 from sat.core.log import getLogger |
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
24 log = getLogger(__name__) |
449
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
25 |
620
ac5881d683d3
browser_side: move SatWebFrontend.addTab to MainTabPanel.addWidgetsTab and rename MainTabPanel.add to MainTabPanel.addTab
souliane <souliane@mailoo.org>
parents:
615
diff
changeset
|
26 from sat.core.i18n import _ |
840
73cc4658f431
browser (strings): add a parameter "new_target" to addURLToText + fix a wrong import
souliane <souliane@mailoo.org>
parents:
838
diff
changeset
|
27 from sat_browser import strings |
449
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
28 |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
29 from pyjamas.ui.DockPanel import DockPanel |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 from pyjamas.ui.HorizontalPanel import HorizontalPanel |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
31 from pyjamas.ui.VerticalPanel import VerticalPanel |
83 | 32 from pyjamas.ui.Button import Button |
33 | 33 from pyjamas.ui.HTML import HTML |
19 | 34 from pyjamas.ui.ClickListener import ClickHandler |
33 | 35 from pyjamas.Timer import Timer |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
36 from pyjamas.ui import HasVerticalAlignment |
323
0b7934e75e76
misc: reorganization of the file panels.py + clean the modules import:
souliane <souliane@mailoo.org>
parents:
322
diff
changeset
|
37 |
449
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
38 |
467 | 39 import menu |
449
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
40 import dialog |
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
41 import base_widget |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
42 import base_menu |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
43 import libervia_widget |
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
44 import editor_widget |
684
e876f493dccc
browser_side: follow changes made on quick_frontend for chat states and MUC symbols + minor fixes following the refactorisation:
souliane <souliane@mailoo.org>
parents:
679
diff
changeset
|
45 import html_tools |
433
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
46 from constants import Const as C |
310
5d11ec1f2c22
browser_side: make UniBox inherit from a more basic MessageBox class
souliane <souliane@mailoo.org>
parents:
309
diff
changeset
|
47 |
5d11ec1f2c22
browser_side: make UniBox inherit from a more basic MessageBox class
souliane <souliane@mailoo.org>
parents:
309
diff
changeset
|
48 |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
49 ### Warning notification (visibility of message, and other warning data) ### |
33 | 50 |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
51 |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
52 class WarningPopup(): |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
53 |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
54 def __init__(self): |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
55 self._popup = None |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
56 self._timer = Timer(notify=self._timeCb) |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
57 self.timeout = None |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
58 self._html = None |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
59 self._last_type = None |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
60 self._last_html = None |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
61 |
394
ee61b0765d6c
browser_side: radiocol supports MP3
souliane <souliane@mailoo.org>
parents:
383
diff
changeset
|
62 def showWarning(self, type_=None, msg=None, duration=2000): |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
63 """Display a popup information message, e.g. to notify the recipient of a message being composed. |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
64 |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
65 If type_ is None, a popup being currently displayed will be hidden. |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
66 @type_: a type determining the CSS style to be applied (see _showWarning) |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
67 @msg: message to be displayed |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
68 @duration(int, None): time (in ms) to display the message |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
69 """ |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
70 if type_ is None: |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
71 self._removeWarning() |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
72 return |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
73 |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
74 self.timeout = duration |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
75 |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
76 if not self._popup or self._last_type != type_ or self._last_html != msg: |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
77 self._showWarning(type_, msg) |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
78 |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
79 def _showWarning(self, type_, msg): |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
80 """Display a popup information message, e.g. to notify the recipient of a message being composed. |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
81 |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
82 @type_: a type determining the CSS style to be applied. For now the defined styles are |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
83 "NONE" (will do nothing), "PUBLIC", "GROUP", "STATUS" and "ONE2ONE". |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
84 @msg: message to be displayed |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
85 """ |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
86 if type_ == "NONE": |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
87 return |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
88 if not msg: |
696
c2f22ca12e23
browser and server side: remove unibox
souliane <souliane@mailoo.org>
parents:
690
diff
changeset
|
89 log.warning("no msg set") |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
90 return |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
91 if type_ == "PUBLIC": |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
92 style = "targetPublic" |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
93 elif type_ == "GROUP": |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
94 style = "targetGroup" |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
95 elif type_ == "STATUS": |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
96 style = "targetStatus" |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
97 elif type_ == "ONE2ONE": |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
98 style = "targetOne2One" |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
99 elif type_ == "INFO": |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
100 style = "notifInfo" |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
101 elif type_ == "WARNING": |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
102 style = "notifWarning" |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
103 else: |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
104 log.error("unknown message type") |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
105 return |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
106 |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
107 self._last_html = msg |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
108 |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
109 if self._popup is None: |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
110 self._popup = dialog.PopupPanelWrapper(autoHide=False, modal=False) |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
111 self._html = HTML(msg) |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
112 self._popup.add(self._html) |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
113 |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
114 left = 0 |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
115 top = 0 # max(0, self.getAbsoluteTop() - contents.getOffsetHeight() - 2) |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
116 self._popup.setPopupPosition(left, top) |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
117 self._popup.show() |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
118 else: |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
119 self._html.setHTML(msg) |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
120 |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
121 if type_ != self._last_type: |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
122 self._last_type = type_ |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
123 self._popup.setStyleName("warningPopup") |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
124 self._popup.addStyleName(style) |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
125 |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
126 if self.timeout is not None: |
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
127 self._timer.schedule(self.timeout) |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
128 |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
129 def _timeCb(self, timer): |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
130 if self._popup: |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
131 self._popup.hide() |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
132 self._popup = None |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
133 |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
134 def _removeWarning(self): |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
135 """Remove the popup""" |
844
2ef71ec07d87
browser (warning message): resuses the popup if it already exists, allows a None duration, and added INFO and WARNING types
Goffi <goffi@goffi.org>
parents:
840
diff
changeset
|
136 self._timer.cancel() |
361
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
137 self._timeCb(None) |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
138 |
f4efffb9627c
browser_side: the popup notifying the message's recipient is no more dependent to the unibox.
souliane <souliane@mailoo.org>
parents:
351
diff
changeset
|
139 |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
140 ### Status ### |
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
141 |
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
142 |
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
143 class StatusPanel(editor_widget.HTMLTextEditor): |
314
70ac3067d641
browser_side: status can be edited with a click on it
souliane <souliane@mailoo.org>
parents:
313
diff
changeset
|
144 |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
145 EMPTY_STATUS = '<click to set a status>' |
838
ab87da500820
browser: validate the status with ENTER (fixes bug 111)
souliane <souliane@mailoo.org>
parents:
818
diff
changeset
|
146 VALIDATE_WITH_SHIFT_ENTER = False |
314
70ac3067d641
browser_side: status can be edited with a click on it
souliane <souliane@mailoo.org>
parents:
313
diff
changeset
|
147 |
20 | 148 def __init__(self, host, status=''): |
149 self.host = host | |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
150 modifiedCb = lambda content: self.host.bridge.call('setStatus', None, self.host.presence_status_panel.presence, content['text']) or True |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
151 editor_widget.HTMLTextEditor.__init__(self, {'text': status}, modifiedCb, options={'no_xhtml': True, 'listen_focus': True, 'listen_click': True}) |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
152 self.edit(False) |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
153 self.setStyleName('marginAuto') |
19 | 154 |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
155 @property |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
156 def status(self): |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
157 return self._original_content['text'] |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
158 |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
159 def __cleanContent(self, content): |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
160 status = content['text'] |
433
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
161 if status == self.EMPTY_STATUS or status in C.PRESENCE.values(): |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
162 content['text'] = '' |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
163 return content |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
164 |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
165 def getContent(self): |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
166 return self.__cleanContent(editor_widget.HTMLTextEditor.getContent(self)) |
19 | 167 |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
168 def setContent(self, content): |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
169 content = self.__cleanContent(content) |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
170 editor_widget.BaseTextEditor.setContent(self, content) |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
171 |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
172 def setDisplayContent(self): |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
173 status = self._original_content['text'] |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
174 try: |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
175 presence = self.host.presence_status_panel.presence |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
176 except AttributeError: # during initialization |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
177 presence = None |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
178 if not status: |
433
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
179 if presence and presence in C.PRESENCE: |
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
180 status = C.PRESENCE[presence] |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
181 else: |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
182 status = self.EMPTY_STATUS |
840
73cc4658f431
browser (strings): add a parameter "new_target" to addURLToText + fix a wrong import
souliane <souliane@mailoo.org>
parents:
838
diff
changeset
|
183 self.display.setHTML(strings.addURLToText(status)) |
314
70ac3067d641
browser_side: status can be edited with a click on it
souliane <souliane@mailoo.org>
parents:
313
diff
changeset
|
184 |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
185 |
510
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
186 class PresenceStatusMenuBar(base_widget.WidgetMenuBar): |
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
187 def __init__(self, parent): |
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
188 styles = {'menu_bar': 'presence-button'} |
632
c2abadf31afb
browser side (menu): minor improvments:
Goffi <goffi@goffi.org>
parents:
615
diff
changeset
|
189 base_widget.WidgetMenuBar.__init__(self, parent, parent.host, styles=styles) |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
190 self.button = self.addCategory(u"◉") |
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
191 presence_menu = self.button.getSubMenu() |
510
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
192 for presence, presence_i18n in C.PRESENCE.items(): |
684
e876f493dccc
browser_side: follow changes made on quick_frontend for chat states and MUC symbols + minor fixes following the refactorisation:
souliane <souliane@mailoo.org>
parents:
679
diff
changeset
|
193 html = u'<span class="%s">◉</span> %s' % (html_tools.buildPresenceStyle(presence), presence_i18n) |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
194 presence_menu.addItem(html, True, base_menu.SimpleCmd(lambda presence=presence: self.changePresenceCb(presence))) |
510
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
195 self.parent_panel = parent |
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
196 |
655
048401e5c506
browser_side: implements setStatusOnline since it is not used only for setting the connected state on/off, but also to update the user presence and status
souliane <souliane@mailoo.org>
parents:
654
diff
changeset
|
197 def changePresenceCb(self, presence=''): |
510
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
198 """Callback to notice the backend of a new presence set by the user. |
662
ebb602d8b3f2
browser_side: replace all instances of 'str' with 'unicode'
souliane <souliane@mailoo.org>
parents:
657
diff
changeset
|
199 @param presence (unicode): the new presence is a value in ('', 'chat', 'away', 'dnd', 'xa') |
510
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
200 """ |
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
201 self.host.bridge.call('setStatus', None, presence, self.parent_panel.status_panel.status) |
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
202 |
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
203 @classmethod |
690
76a67d04c63e
browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents:
685
diff
changeset
|
204 def getCategoryHTML(cls, category): |
76a67d04c63e
browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents:
685
diff
changeset
|
205 """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:
685
diff
changeset
|
206 |
76a67d04c63e
browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents:
685
diff
changeset
|
207 @param category (quick_menus.MenuCategory): category to add |
76a67d04c63e
browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents:
685
diff
changeset
|
208 @return unicode: HTML to display |
76a67d04c63e
browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents:
685
diff
changeset
|
209 """ |
76a67d04c63e
browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents:
685
diff
changeset
|
210 return category |
510
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
211 |
db3436c85fb1
browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents:
499
diff
changeset
|
212 |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
213 class PresenceStatusPanel(HorizontalPanel, ClickHandler): |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
214 |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
215 def __init__(self, host, presence="", status=""): |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
216 self.host = host |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
217 self.plugin_menu_context = [] |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
218 HorizontalPanel.__init__(self, Width='100%') |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
219 self.presence_bar = PresenceStatusMenuBar(self) |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
220 self.status_panel = StatusPanel(host, status=status) |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
221 self.setPresence(presence) |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
222 |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
223 panel = HorizontalPanel() |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
224 panel.add(self.presence_bar) |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
225 panel.add(self.status_panel) |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
226 panel.setCellVerticalAlignment(self.presence_bar, 'baseline') |
314
70ac3067d641
browser_side: status can be edited with a click on it
souliane <souliane@mailoo.org>
parents:
313
diff
changeset
|
227 panel.setCellVerticalAlignment(self.status_panel, 'baseline') |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
228 panel.setStyleName("presenceStatusPanel") |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
229 self.add(panel) |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
230 |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
231 self.status_panel.edit(False) |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
232 |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
233 ClickHandler.__init__(self) |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
234 self.addClickListener(self) |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
235 |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
236 @property |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
237 def presence(self): |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
238 return self._presence |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
239 |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
240 @property |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
241 def status(self): |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
242 return self.status_panel._original_content['text'] |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
243 |
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
244 def setPresence(self, presence): |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
245 self._presence = presence |
684
e876f493dccc
browser_side: follow changes made on quick_frontend for chat states and MUC symbols + minor fixes following the refactorisation:
souliane <souliane@mailoo.org>
parents:
679
diff
changeset
|
246 html_tools.setPresenceStyle(self.presence_bar.button, self._presence) |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
247 |
349
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
248 def setStatus(self, status): |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
249 self.status_panel.setContent({'text': status}) |
f488692c4903
browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents:
347
diff
changeset
|
250 self.status_panel.setDisplayContent() |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
251 |
62 | 252 def onClick(self, sender): |
226
744426c2b699
browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents:
223
diff
changeset
|
253 # As status is the default target of uniBar, we don't want to select anything if click on it |
192
cf5c83e7d515
browser side: per tab selected widget management
Goffi <goffi@goffi.org>
parents:
191
diff
changeset
|
254 self.host.setSelected(None) |
20 | 255 |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
256 |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
257 ### Panels managing the main area ### |
181
c0b78a3af06d
browser side: web widget first draft
Goffi <goffi@goffi.org>
parents:
179
diff
changeset
|
258 |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
259 |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
260 class MainPanel(DockPanel): |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
261 """The panel which take the whole screen""" |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
262 |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
263 def __init__(self, host): |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
264 self.host = host |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
265 DockPanel.__init__(self, StyleName="mainPanel liberviaTabPanel") |
184
97d5e9de1106
browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents:
181
diff
changeset
|
266 |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
267 # menu and status panel |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
268 self.header = VerticalPanel(StyleName="header") |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
269 self.menu = menu.MainMenuBar(host) |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
270 self.header.add(self.menu) |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
271 |
226
744426c2b699
browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents:
223
diff
changeset
|
272 # contacts |
255
da0487f0a2e7
browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents:
249
diff
changeset
|
273 self.contacts_switch = Button(u'«', self._contactsSwitch) |
da0487f0a2e7
browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents:
249
diff
changeset
|
274 self.contacts_switch.addStyleName('contactsSwitch') |
184
97d5e9de1106
browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents:
181
diff
changeset
|
275 |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
276 # tab panel |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
637
diff
changeset
|
277 self.tab_panel = libervia_widget.MainTabPanel(host) |
620
ac5881d683d3
browser_side: move SatWebFrontend.addTab to MainTabPanel.addWidgetsTab and rename MainTabPanel.add to MainTabPanel.addTab
souliane <souliane@mailoo.org>
parents:
615
diff
changeset
|
278 self.tab_panel.addWidgetsTab(_(u"Discussions"), select=True, locked=True) |
676
849ffb24d5bf
browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents:
662
diff
changeset
|
279 |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
280 # XXX: widget's addition order is important! |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
281 self.add(self.header, DockPanel.NORTH) |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
282 self.add(self.tab_panel, DockPanel.CENTER) |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
283 self.setCellWidth(self.tab_panel, '100%') |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
284 self.setCellHeight(self.tab_panel, '100%') |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
285 self.add(self.tab_panel.getTabBar(), DockPanel.SOUTH) |
33 | 286 |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
287 def addContactList(self, contact_list): |
657
0b7e4226378d
browser_side: hide the tab bar and contact list's toggle button until the profile is connected
souliane <souliane@mailoo.org>
parents:
655
diff
changeset
|
288 self.add(self.contacts_switch, DockPanel.WEST) |
654
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
289 self.add(contact_list, DockPanel.WEST) |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
290 |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
291 def addPresenceStatusPanel(self, panel): |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
292 self.header.add(panel) |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
293 self.header.setCellHeight(panel, '100%') |
40c72f3b7638
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
294 self.header.setCellVerticalAlignment(panel, HasVerticalAlignment.ALIGN_BOTTOM) |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
295 |
255
da0487f0a2e7
browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents:
249
diff
changeset
|
296 def _contactsSwitch(self, btn=None): |
184
97d5e9de1106
browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents:
181
diff
changeset
|
297 """ (Un)hide contacts panel """ |
255
da0487f0a2e7
browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents:
249
diff
changeset
|
298 if btn is None: |
da0487f0a2e7
browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents:
249
diff
changeset
|
299 btn = self.contacts_switch |
944 | 300 clist = self.host.contact_list_widget |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
301 clist.setVisible(not clist.getVisible()) |
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
302 btn.setText(u"«" if clist.getVisible() else u"»") |
184
97d5e9de1106
browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents:
181
diff
changeset
|
303 self.host.resize() |
97d5e9de1106
browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents:
181
diff
changeset
|
304 |
232
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
305 def _contactsMove(self, parent): |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
306 """Move the contacts container (containing the contact list and |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
307 the "hide/show" button) to another parent, but always as the |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
308 first child position (insert at index 0). |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
309 """ |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
310 if self._contacts.getParent(): |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
311 if self._contacts.getParent() == parent: |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
312 return |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
313 self._contacts.removeFromParent() |
0ed09cc0566f
browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents:
231
diff
changeset
|
314 parent.insert(self._contacts, 0) |