comparison src/browser/sat_browser/widget.py @ 676:849ffb24d5bf frontends_multi_profiles

browser side: menus refactorisation: - use of the new quick_frontends.quick_menus module, resulting in a big code simplification in Libervia - menu are added in there respective modules: main menus are done directely in libervia_main, while tarot and radiocol menus are done in game_tarot and game_radiocol - launchAction has the same signature as in QuickApp - base_menu: there are now 2 classes to launch an action: MenuCmd which manage quick_menus classes, and SimpleCmd to launch a generic callback - base_menu: MenuNode has been removed as logic is now in quick_menus - base_menu: GenericMenuBar.update method can be called to fully (re)build the menus - base_widget: removed WidgetSubMenuBar which is no more useful (GenericMenuBar do the same thing) - plugin_menu_context is used in LiberviaWidget and other classes with menus to indicate which menu types must be used - otr menus hooks are temporarily removed, will be fixed soon
author Goffi <goffi@goffi.org>
date Tue, 17 Mar 2015 20:42:02 +0100
parents 6d3142b782c3
children a90cc8fc9605
comparison
equal deleted inserted replaced
675:941e53b3af5c 676:849ffb24d5bf
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 import pyjd # this is dummy in pyjs 20 import pyjd # this is dummy in pyjs
21 from sat.core.log import getLogger 21 from sat.core.log import getLogger
22 log = getLogger(__name__) 22 log = getLogger(__name__)
23
24 from sat.core.i18n import D_
23 25
24 from pyjamas.ui.VerticalPanel import VerticalPanel 26 from pyjamas.ui.VerticalPanel import VerticalPanel
25 from pyjamas.ui.HorizontalPanel import HorizontalPanel 27 from pyjamas.ui.HorizontalPanel import HorizontalPanel
26 from pyjamas.ui.Button import Button 28 from pyjamas.ui.Button import Button
27 from pyjamas.ui.Frame import Frame 29 from pyjamas.ui.Frame import Frame
30 32
31 import dialog 33 import dialog
32 import libervia_widget 34 import libervia_widget
33 from constants import Const as C 35 from constants import Const as C
34 from sat_frontends.quick_frontend import quick_widgets 36 from sat_frontends.quick_frontend import quick_widgets
37 from sat_frontends.tools import host_listener
35 38
36 39
37 # class UniBoxPanel(HorizontalPanel): 40 # class UniBoxPanel(HorizontalPanel):
38 # """Panel containing the UniBox""" 41 # """Panel containing the UniBox"""
39 # 42 #
240 scheme_end = url.find(':') 243 scheme_end = url.find(':')
241 scheme = "" if scheme_end == -1 else url[:scheme_end] 244 scheme = "" if scheme_end == -1 else url[:scheme_end]
242 if scheme not in C.WEB_PANEL_SCHEMES: 245 if scheme not in C.WEB_PANEL_SCHEMES:
243 url = "http://" + url 246 url = "http://" + url
244 self._frame.setUrl(url) 247 self._frame.setUrl(url)
248
249
250 ## Menu
251
252 def hostReady(host):
253 def onWebWidget():
254 web_widget = host.displayWidget(WebWidget, C.WEB_PANEL_DEFAULT_URL)
255 host.setSelected(web_widget)
256
257 def gotMenus():
258 host.menus.addMenu(C.MENU_GLOBAL, (D_(u"General"), D_(u"Web widget")), callback=onWebWidget)
259 host.addListener('gotMenus', gotMenus)
260
261 host_listener.addListener(hostReady)