annotate src/browser/sat_browser/main_panel.py @ 840:73cc4658f431

browser (strings): add a parameter "new_target" to addURLToText + fix a wrong import
author souliane <souliane@mailoo.org>
date Wed, 13 Jan 2016 13:12:58 +0100
parents ab87da500820
children 2ef71ec07d87
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
818
f8a7a046ff9c copyright update
Goffi <goffi@goffi.org>
parents: 779
diff changeset
5 # Copyright (C) 2011-2016 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
68d360caeecb New widget system: first draft
Goffi <goffi@goffi.org>
parents: 78
diff changeset
32 from pyjamas.ui.Button import Button
33
e70521e6d803 browser side, misc stuffs
Goffi <goffi@goffi.org>
parents: 27
diff changeset
33 from pyjamas.ui.HTML import HTML
19
e8e3704eb97f Added basic chat panel
Goffi <goffi@goffi.org>
parents: 18
diff changeset
34 from pyjamas.ui.ClickListener import ClickHandler
33
e70521e6d803 browser side, misc stuffs
Goffi <goffi@goffi.org>
parents: 27
diff changeset
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
97c72fe4a5f2 browser_side: import fixes:
Goffi <goffi@goffi.org>
parents: 463
diff changeset
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
e70521e6d803 browser side, misc stuffs
Goffi <goffi@goffi.org>
parents: 27
diff changeset
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)
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
57
394
ee61b0765d6c browser_side: radiocol supports MP3
souliane <souliane@mailoo.org>
parents: 383
diff changeset
58 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
59 """Display a popup information message, e.g. to notify the recipient of a message being composed.
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
60 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
61 @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
62 @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
63 """
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
64 if type_ is 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
65 self.__removeWarning()
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
66 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
67 if not self._popup:
589
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 585
diff changeset
68 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
69 elif (type_, msg) != self._popup.target_data:
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 self._timeCb(None) # we remove the popup
589
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 585
diff changeset
71 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
72
394
ee61b0765d6c browser_side: radiocol supports MP3
souliane <souliane@mailoo.org>
parents: 383
diff changeset
73 self._timer.schedule(duration)
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
74
589
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 585
diff changeset
75 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
76 """Display a popup information message, e.g. to notify the recipient of a message being composed.
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
77 @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
78 "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
79 @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
80 """
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
81 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
82 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
83 if not msg:
696
c2f22ca12e23 browser and server side: remove unibox
souliane <souliane@mailoo.org>
parents: 690
diff changeset
84 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
85 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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93 style = "targetOne2One"
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 else:
439
d52f529a6d42 browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents: 433
diff changeset
95 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
96 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
97 contents = HTML(msg)
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
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
99 self._popup = dialog.PopupPanelWrapper(autoHide=False, modal=False)
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
100 self._popup.target_data = (type_, msg)
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
101 self._popup.add(contents)
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
102 self._popup.setStyleName("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
103 if 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
104 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
105
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
106 left = 0
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
107 top = 0 # max(0, self.getAbsoluteTop() - contents.getOffsetHeight() - 2)
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
108 self._popup.setPopupPosition(left, top)
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
109 self._popup.show()
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
110
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
111 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
112 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
113 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
114 del 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
115 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
116
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
117 def __removeWarning(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
118 """Remove the 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
119 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
120
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
121
648
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
122 ### Status ###
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
123
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
124
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
125 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
126
349
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
127 EMPTY_STATUS = '&lt;click to set a status&gt;'
838
ab87da500820 browser: validate the status with ENTER (fixes bug 111)
souliane <souliane@mailoo.org>
parents: 818
diff changeset
128 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
129
20
8f4b1a8914c3 - User status is now updated
Goffi <goffi@goffi.org>
parents: 19
diff changeset
130 def __init__(self, host, status=''):
8f4b1a8914c3 - User status is now updated
Goffi <goffi@goffi.org>
parents: 19
diff changeset
131 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
132 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
133 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
134 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
135 self.setStyleName('marginAuto')
19
e8e3704eb97f Added basic chat panel
Goffi <goffi@goffi.org>
parents: 18
diff changeset
136
349
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
137 @property
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
138 def status(self):
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
139 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
140
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
141 def __cleanContent(self, content):
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
142 status = content['text']
433
bbdbee25123a import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents: 432
diff changeset
143 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
144 content['text'] = ''
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
145 return content
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
146
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
147 def getContent(self):
648
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
148 return self.__cleanContent(editor_widget.HTMLTextEditor.getContent(self))
19
e8e3704eb97f Added basic chat panel
Goffi <goffi@goffi.org>
parents: 18
diff changeset
149
349
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
150 def setContent(self, content):
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
151 content = self.__cleanContent(content)
648
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
152 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
153
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
154 def setDisplayContent(self):
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
155 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
156 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
157 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
158 except AttributeError: # during initialization
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
159 presence = None
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
160 if not status:
433
bbdbee25123a import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents: 432
diff changeset
161 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
162 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
163 else:
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
164 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
165 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
166
279
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
167
510
db3436c85fb1 browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents: 499
diff changeset
168 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
169 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
170 styles = {'menu_bar': 'presence-button'}
632
c2abadf31afb browser side (menu): minor improvments:
Goffi <goffi@goffi.org>
parents: 615
diff changeset
171 base_widget.WidgetMenuBar.__init__(self, parent, parent.host, styles=styles)
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 662
diff changeset
172 self.button = self.addCategory(u"◉")
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 662
diff changeset
173 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
174 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
175 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
176 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
177 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
178
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
179 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
180 """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
181 @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
182 """
db3436c85fb1 browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents: 499
diff changeset
183 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
184
db3436c85fb1 browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents: 499
diff changeset
185 @classmethod
690
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 685
diff changeset
186 def getCategoryHTML(cls, category):
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 685
diff changeset
187 """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
188
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 685
diff changeset
189 @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
190 @return unicode: HTML to display
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 685
diff changeset
191 """
76a67d04c63e browser_side: improve comments for menus-related methods
souliane <souliane@mailoo.org>
parents: 685
diff changeset
192 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
193
db3436c85fb1 browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
souliane <souliane@mailoo.org>
parents: 499
diff changeset
194
279
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
195 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
196
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
197 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
198 self.host = host
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 662
diff changeset
199 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
200 HorizontalPanel.__init__(self, Width='100%')
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 662
diff changeset
201 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
202 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
203 self.setPresence(presence)
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
204
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
205 panel = HorizontalPanel()
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 662
diff changeset
206 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
207 panel.add(self.status_panel)
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 662
diff changeset
208 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
209 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
210 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
211 self.add(panel)
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
212
349
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
213 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
214
279
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
215 ClickHandler.__init__(self)
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
216 self.addClickListener(self)
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
217
349
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
218 @property
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
219 def presence(self):
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
220 return self._presence
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
221
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
222 @property
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
223 def status(self):
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
224 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
225
2d6bd975a72d browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents: 276
diff changeset
226 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
227 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
228 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
229
349
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
230 def setStatus(self, status):
f488692c4903 browser_side: LightTextEditor inheritates from BaseTextEditor + display URL in the status
souliane <souliane@mailoo.org>
parents: 347
diff changeset
231 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
232 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
233
62
12e889a683ce server side: misc stuff:
Goffi <goffi@goffi.org>
parents: 58
diff changeset
234 def onClick(self, sender):
226
744426c2b699 browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents: 223
diff changeset
235 # 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
236 self.host.setSelected(None)
20
8f4b1a8914c3 - User status is now updated
Goffi <goffi@goffi.org>
parents: 19
diff changeset
237
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
238
648
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
239 ### Panels managing the main area ###
181
c0b78a3af06d browser side: web widget first draft
Goffi <goffi@goffi.org>
parents: 179
diff changeset
240
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
241
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
242 class MainPanel(DockPanel):
648
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
243 """The panel which take the whole screen"""
18
795d144fc1d2 moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff changeset
244
795d144fc1d2 moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff changeset
245 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
246 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
247 DockPanel.__init__(self, StyleName="mainPanel liberviaTabPanel")
184
97d5e9de1106 browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents: 181
diff changeset
248
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
249 # 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
250 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
251 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
252 self.header.add(self.menu)
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 662
diff changeset
253
226
744426c2b699 browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents: 223
diff changeset
254 # contacts
255
da0487f0a2e7 browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents: 249
diff changeset
255 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
256 self.contacts_switch.addStyleName('contactsSwitch')
184
97d5e9de1106 browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents: 181
diff changeset
257
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
258 # tab panel
648
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
259 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
260 self.tab_panel.addWidgetsTab(_(u"Discussions"), select=True, locked=True)
676
849ffb24d5bf browser side: menus refactorisation:
Goffi <goffi@goffi.org>
parents: 662
diff changeset
261
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
262 # 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
263 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
264 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
265 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
266 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
267 self.add(self.tab_panel.getTabBar(), DockPanel.SOUTH)
33
e70521e6d803 browser side, misc stuffs
Goffi <goffi@goffi.org>
parents: 27
diff changeset
268
589
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 585
diff changeset
269 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
270 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
271 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
272
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
273 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
274 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
275 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
276 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
277
255
da0487f0a2e7 browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents: 249
diff changeset
278 def _contactsSwitch(self, btn=None):
184
97d5e9de1106 browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents: 181
diff changeset
279 """ (Un)hide contacts panel """
255
da0487f0a2e7 browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents: 249
diff changeset
280 if btn is None:
da0487f0a2e7 browser_side: small changes to prepare the contact group manager:
souliane <souliane@mailoo.org>
parents: 249
diff changeset
281 btn = self.contacts_switch
589
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 585
diff changeset
282 clist = self.host.contact_list
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 585
diff changeset
283 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
284 btn.setText(u"«" if clist.getVisible() else u"»")
184
97d5e9de1106 browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents: 181
diff changeset
285 self.host.resize()
97d5e9de1106 browser side: contacts panel switch:
Goffi <goffi@goffi.org>
parents: 181
diff changeset
286
232
0ed09cc0566f browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents: 231
diff changeset
287 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
288 """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
289 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
290 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
291 """
0ed09cc0566f browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents: 231
diff changeset
292 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
293 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
294 return
0ed09cc0566f browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents: 231
diff changeset
295 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
296 parent.insert(self._contacts, 0)
0ed09cc0566f browser_side: added UIs for rich text editor and addressing to multiple recipients
souliane <souliane@mailoo.org>
parents: 231
diff changeset
297
648
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
298
6d3142b782c3 browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents: 637
diff changeset
299