comparison 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
comparison
equal deleted inserted replaced
438:582c435dab6b 439:d52f529a6d42
15 # GNU Affero General Public License for more details. 15 # GNU Affero General Public License for more details.
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
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 from sat.core.log import getLogger
21 log = getLogger(__name__)
20 from pyjamas.ui.VerticalPanel import VerticalPanel 22 from pyjamas.ui.VerticalPanel import VerticalPanel
21 from pyjamas.ui.HorizontalPanel import HorizontalPanel 23 from pyjamas.ui.HorizontalPanel import HorizontalPanel
22 from pyjamas.ui.CellPanel import CellPanel
23 from pyjamas.ui.TabPanel import TabPanel 24 from pyjamas.ui.TabPanel import TabPanel
24 from pyjamas.ui.Grid import Grid 25 from pyjamas.ui.Grid import Grid
25 from pyjamas.ui.Label import Label 26 from pyjamas.ui.Label import Label
26 from pyjamas.ui.TextBoxBase import TextBoxBase
27 from pyjamas.ui.TextBox import TextBox 27 from pyjamas.ui.TextBox import TextBox
28 from pyjamas.ui.PasswordTextBox import PasswordTextBox 28 from pyjamas.ui.PasswordTextBox import PasswordTextBox
29 from pyjamas.ui.TextArea import TextArea 29 from pyjamas.ui.TextArea import TextArea
30 from pyjamas.ui.CheckBox import CheckBox 30 from pyjamas.ui.CheckBox import CheckBox
31 from pyjamas.ui.ListBox import ListBox 31 from pyjamas.ui.ListBox import ListBox
32 from pyjamas.ui.Button import Button 32 from pyjamas.ui.Button import Button
33 from pyjamas.ui.HTML import HTML 33 from pyjamas.ui.HTML import HTML
34 from nativedom import NativeDOM 34 from nativedom import NativeDOM
35 from sat_frontends.tools import xmlui 35 from sat_frontends.tools import xmlui
36 from sat.core.i18n import _
37 36
38 37
39 class EmptyWidget(xmlui.EmptyWidget, Label): 38 class EmptyWidget(xmlui.EmptyWidget, Label):
40 39
41 def __init__(self, parent): 40 def __init__(self, parent):
166 def _xmluiSelectValue(self, value): 165 def _xmluiSelectValue(self, value):
167 """Select a value checking its item""" 166 """Select a value checking its item"""
168 try: 167 try:
169 label = [label for label, _value in self._xmlui_attr_map.items() if _value == value][0] 168 label = [label for label, _value in self._xmlui_attr_map.items() if _value == value][0]
170 except IndexError: 169 except IndexError:
171 print(_("WARNING: Can't find value [%s] to select" % value)) 170 log.warning("Can't find value [%s] to select" % value)
172 return 171 return
173 self.selectItem(label) 172 self.selectItem(label)
174 173
175 def _xmluiSelectValues(self, values): 174 def _xmluiSelectValues(self, values):
176 """Select multiple values, ignore the items""" 175 """Select multiple values, ignore the items"""
221 return 220 return
222 self._xmlui_selected_row = row 221 self._xmlui_selected_row = row
223 try: 222 try:
224 self._xmlui_select_cb(self) 223 self._xmlui_select_cb(self)
225 except AttributeError: 224 except AttributeError:
226 print "WARNING: no select callback set" 225 log.warning("no select callback set")
227 226
228 227
229 def _xmluiAppend(self, widget): 228 def _xmluiAppend(self, widget):
230 self.setWidget(self.row, self.col, widget) 229 self.setWidget(self.row, self.col, widget)
231 self.col += 1 230 self.col += 1
390 389
391 def _xmluiClose(self): 390 def _xmluiClose(self):
392 if self.close_cb: 391 if self.close_cb:
393 self.close_cb() 392 self.close_cb()
394 else: 393 else:
395 print "WARNING: no close method defined" 394 log.warning("no close method defined")
396 395
397 def _xmluiLaunchAction(self, action_id, data): 396 def _xmluiLaunchAction(self, action_id, data):
398 self.host.launchAction(action_id, data) 397 self.host.launchAction(action_id, data)
399 398
400 def _xmluiSetParam(self, name, value, category): 399 def _xmluiSetParam(self, name, value, category):