Mercurial > libervia-web
diff browser_side/menu.py @ 439:d52f529a6d42
browser side: use of new log system (first draft):
- configuration is hardcoded in libervia.py, it will change in the (hopefuly) near future
- log level is DEBUG for the moment, will be changed to INFO when configuration will not be hardcoded anymore
- the basic log backend is used, in the future, a console.debug/info/etc should be used instead. A log widget which HTML colors is also an option
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 08 May 2014 17:21:34 +0200 |
parents | 8ecc5a7062e4 |
children |
line wrap: on
line diff
--- a/browser_side/menu.py Thu May 08 17:21:30 2014 +0200 +++ b/browser_side/menu.py Thu May 08 17:21:34 2014 +0200 @@ -18,23 +18,20 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import pyjd # this is dummy in pyjs +from sat.core.log import getLogger +log = getLogger(__name__) from pyjamas.ui.SimplePanel import SimplePanel from pyjamas.ui.MenuBar import MenuBar from pyjamas.ui.MenuItem import MenuItem -from pyjamas.ui.ListBox import ListBox -from pyjamas.ui.Label import Label -from pyjamas.ui.TextBox import TextBox from pyjamas.ui.HTML import HTML from pyjamas.ui.Frame import Frame from pyjamas import Window from jid import JID -from html_tools import html_sanitize from file_tools import FileUploadPanel from xmlui import XMLUI from browser_side import panels from browser_side import dialog from contact_group import ContactGroupEditor -import re from sat.core.i18n import _ @@ -100,7 +97,7 @@ def addMenu(menu_name, menu_name_i18n, item_name_i18n, icon, menu_cmd): """ add a menu to menu_dict """ - print "addMenu:", menu_name, menu_name_i18n, item_name_i18n, icon, menu_cmd + log.info("addMenu: %s %s %s %s %s" % (menu_name, menu_name_i18n, item_name_i18n, icon, menu_cmd)) try: menu_bar = menus_dict[menu_name] except KeyError: @@ -120,16 +117,16 @@ # additional menus for action_id, type_, path, path_i18n in add_menus: if not path: - print "WARNING: skipping menu without path" + log.warning("skipping menu without path") continue if len(path) != len(path_i18n): - print "ERROR: inconsistency between menu paths" + log.error("inconsistency between menu paths") continue menu_name = path[0] menu_name_i18n = path_i18n[0] item_name = path[1:] if not item_name: - print "WARNING: skipping menu with a path of lenght 1 [%s]" % path[0] + log.warning("skipping menu with a path of lenght 1 [%s]" % path[0]) continue item_name_i18n = ' | '.join(path_i18n[1:]) addMenu(menu_name, menu_name_i18n, item_name_i18n, 'plugins', PluginMenuCmd(self.host, action_id)) @@ -169,7 +166,7 @@ def onDisconnect(self): def confirm_cb(answer): if answer: - print "disconnection" + log.info("disconnection") self.host.bridge.call('disconnect', None) _dialog = dialog.ConfirmDialog(confirm_cb, text="Do you really want to disconnect ?") _dialog.show()