comparison src/browser/sat_browser/game_radiocol.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 b39a9eddfe56
children e876f493dccc
comparison
equal deleted inserted replaced
675:941e53b3af5c 676:849ffb24d5bf
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 23
24 from sat.core.i18n import _ 24 from sat.core.i18n import _, D_
25 from sat_frontends.tools.misc import DEFAULT_MUC 25 from sat_frontends.tools.misc import DEFAULT_MUC
26 from sat_frontends.tools import host_listener
26 from constants import Const as C 27 from constants import Const as C
27 28
28 from pyjamas.ui.VerticalPanel import VerticalPanel 29 from pyjamas.ui.VerticalPanel import VerticalPanel
29 from pyjamas.ui.HorizontalPanel import HorizontalPanel 30 from pyjamas.ui.HorizontalPanel import HorizontalPanel
30 from pyjamas.ui.FlexTable import FlexTable 31 from pyjamas.ui.FlexTable import FlexTable
38 from pyjamas import Window 39 from pyjamas import Window
39 from pyjamas.Timer import Timer 40 from pyjamas.Timer import Timer
40 41
41 import html_tools 42 import html_tools
42 import file_tools 43 import file_tools
44 import dialog
43 45
44 46
45 class MetadataPanel(FlexTable): 47 class MetadataPanel(FlexTable):
46 48
47 def __init__(self): 49 def __init__(self):
318 def radiocolUploadOkHandler(self): 320 def radiocolUploadOkHandler(self):
319 self.control_panel.unblockUpload() 321 self.control_panel.unblockUpload()
320 322
321 def radiocolSongRejectedHandler(self, reason): 323 def radiocolSongRejectedHandler(self, reason):
322 Window.alert("Song rejected: %s" % reason) 324 Window.alert("Song rejected: %s" % reason)
325
326
327 ## Menu
328
329 def hostReady(host):
330 def onCollectiveRadio(self):
331 def callback(room_jid, contacts):
332 contacts = [unicode(contact) for contact in contacts]
333 room_jid_s = unicode(room_jid) if room_jid else ''
334 host.bridge.RadioCollective(contacts, room_jid_s, profile=C.PROF_KEY_NONE)
335 dialog.RoomAndContactsChooser(host, callback, ok_button="Choose", title="Collective Radio", visible=(False, True))
336
337
338 def gotMenus():
339 host.menus.addMenu(C.MENU_GLOBAL, (D_(u"Groups"), D_(u"Collective radio")), callback=onCollectiveRadio)
340
341 host.addListener('gotMenus', gotMenus)
342
343 host_listener.addListener(hostReady)