diff browser_side/xmlui.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 a927a98b398d
children
line wrap: on
line diff
--- a/browser_side/xmlui.py	Thu May 08 17:21:30 2014 +0200
+++ b/browser_side/xmlui.py	Thu May 08 17:21:34 2014 +0200
@@ -17,13 +17,13 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+from sat.core.log import getLogger
+log = getLogger(__name__)
 from pyjamas.ui.VerticalPanel import VerticalPanel
 from pyjamas.ui.HorizontalPanel import HorizontalPanel
-from pyjamas.ui.CellPanel import CellPanel
 from pyjamas.ui.TabPanel import TabPanel
 from pyjamas.ui.Grid import Grid
 from pyjamas.ui.Label import Label
-from pyjamas.ui.TextBoxBase import TextBoxBase
 from pyjamas.ui.TextBox import TextBox
 from pyjamas.ui.PasswordTextBox import PasswordTextBox
 from pyjamas.ui.TextArea import TextArea
@@ -33,7 +33,6 @@
 from pyjamas.ui.HTML import HTML
 from nativedom import NativeDOM
 from sat_frontends.tools import xmlui
-from sat.core.i18n import _
 
 
 class EmptyWidget(xmlui.EmptyWidget, Label):
@@ -168,7 +167,7 @@
         try:
             label = [label for label, _value in self._xmlui_attr_map.items() if _value == value][0]
         except IndexError:
-            print(_("WARNING: Can't find value [%s] to select" % value))
+            log.warning("Can't find value [%s] to select" % value)
             return
         self.selectItem(label)
 
@@ -223,7 +222,7 @@
         try:
             self._xmlui_select_cb(self)
         except AttributeError:
-            print "WARNING: no select callback set"
+            log.warning("no select callback set")
 
 
     def _xmluiAppend(self, widget):
@@ -392,7 +391,7 @@
         if self.close_cb:
             self.close_cb()
         else:
-            print "WARNING: no close method defined"
+            log.warning("no close method defined")
 
     def _xmluiLaunchAction(self, action_id, data):
         self.host.launchAction(action_id, data)