Mercurial > urwid-satext
comparison urwid_satext/sat_widgets.py @ 89:2141f07b5fdd
primitivus: no more direct error/warning methods for logging
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Sep 2014 15:42:25 +0200 |
parents | c95462c21966 |
children | f5992b2a0dbf |
comparison
equal
deleted
inserted
replaced
88:c95462c21966 | 89:2141f07b5fdd |
---|---|
16 # | 16 # |
17 # You should have received a copy of the GNU Lesser General Public License | 17 # You should have received a copy of the GNU Lesser 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 import urwid | 20 import urwid |
21 from logging import debug, info, warning, error | 21 import logging as log |
22 import encodings | 22 import encodings |
23 utf8decode = lambda s: encodings.codecs.utf_8_decode(s)[0] | 23 utf8decode = lambda s: encodings.codecs.utf_8_decode(s)[0] |
24 | 24 |
25 from urwid.util import is_mouse_press #XXX: is_mouse_press is not included in urwid in 1.0.0 | 25 from urwid.util import is_mouse_press #XXX: is_mouse_press is not included in urwid in 1.0.0 |
26 from .keys import action_key_map as a_key | 26 from .keys import action_key_map as a_key |
1205 tab_name = button.get_label() | 1205 tab_name = button.get_label() |
1206 for tab in self.tabs: | 1206 for tab in self.tabs: |
1207 if tab[0] == tab_name: | 1207 if tab[0] == tab_name: |
1208 break | 1208 break |
1209 if tab[0] != tab_name: | 1209 if tab[0] != tab_name: |
1210 error(_("INTERNAL ERROR: Tab not found")) | 1210 log.error(_("INTERNAL ERROR: Tab not found")) |
1211 assert(False) | 1211 assert(False) |
1212 self.__frame.body = tab[1] | 1212 self.__frame.body = tab[1] |
1213 button.set_label(('title',button.get_label())) | 1213 button.set_label(('title',button.get_label())) |
1214 if self._current_tab: | 1214 if self._current_tab: |
1215 self._current_tab.set_label(self._current_tab.get_label()) | 1215 self._current_tab.set_label(self._current_tab.get_label()) |
1340 for opt in ['ADAPT', 'HIGHLIGHT']: | 1340 for opt in ['ADAPT', 'HIGHLIGHT']: |
1341 if opt in options: | 1341 if opt in options: |
1342 try: | 1342 try: |
1343 options[opt] = tuple(options[opt]) | 1343 options[opt] = tuple(options[opt]) |
1344 except TypeError: | 1344 except TypeError: |
1345 warning('[%s] option is not a tuple' % opt) | 1345 log.warning('[%s] option is not a tuple' % opt) |
1346 options[opt] = () | 1346 options[opt] = () |
1347 self._options = options | 1347 self._options = options |
1348 self._dividechars = dividechars | 1348 self._dividechars = dividechars |
1349 self._idx = 0 | 1349 self._idx = 0 |
1350 self._longuest = self._columns * [0] | 1350 self._longuest = self._columns * [0] |