diff options
-rw-r--r-- | src/tabs.py | 14 | ||||
-rw-r--r-- | src/windows.py | 31 |
2 files changed, 38 insertions, 7 deletions
diff --git a/src/tabs.py b/src/tabs.py index 62647ad0..c9707996 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -980,7 +980,7 @@ class MucListTab(Tab): self.list_header = windows.ColumnHeaderWin(columns) self.listview = windows.ListWin(columns) self.tab_win = windows.GlobalInfoBar() - self.default_help_message = windows.HelpText("“j”: join room. “i”: information") + self.default_help_message = windows.HelpText("“j”: join room.") self.input = self.default_help_message self.key_func["KEY_DOWN"] = self.listview.move_cursor_down self.key_func["KEY_UP"] = self.listview.move_cursor_up @@ -1065,6 +1065,18 @@ class MucListTab(Tab): def get_color_state(self): return self._color_state +# class SimpleTextTab(Tab): +# """ +# A very simple tab, with just a text displaying some +# information or whatever +# """ +# def __init__(self, core, text): +# Tab.__init__(self, core) +# self.text = text +# self.text_win = + +# def resize(self): +# pass def diffmatch(search, string): """ Use difflib and a loop to check if search_pattern can diff --git a/src/windows.py b/src/windows.py index f4524ff1..9d38cd84 100644 --- a/src/windows.py +++ b/src/windows.py @@ -470,8 +470,13 @@ class TextWin(Win): if not first: nick = None time = None - else: - time = message.time + else: # strftime is VERY slow, improve performance + # by calling it only one time here, and + # not at each refresh + time = {'hour': '%s'%(message.time.strftime("%H"),), + 'minute': '%s'%(message.time.strftime("%M"),), + 'second': '%s'%(message.time.strftime("%S"),), + } l = Line(nick, color, time, txt[:limit], message.color, @@ -589,12 +594,12 @@ class TextWin(Win): Write the date on the yth line of the window """ self.addstr(theme.CHAR_TIME_LEFT, curses.color_pair(theme.COLOR_TIME_LIMITER)) - self.addstr(time.strftime("%H"), curses.color_pair(theme.COLOR_TIME_NUMBERS)) + self.addstr(time['hour'], curses.color_pair(theme.COLOR_TIME_NUMBERS)) self.addstr(':', curses.color_pair(theme.COLOR_TIME_SEPARATOR)) - self.addstr(time.strftime("%M"), curses.color_pair(theme.COLOR_TIME_NUMBERS)) + self.addstr(time['minute'], curses.color_pair(theme.COLOR_TIME_NUMBERS)) self.addstr(':', curses.color_pair(theme.COLOR_TIME_SEPARATOR)) - self.addstr(time.strftime('%S'), curses.color_pair(theme.COLOR_TIME_NUMBERS)) - self.addnstr(theme.CHAR_TIME_RIGHT, curses.color_pair(theme.COLOR_TIME_LIMITER)) + self.addstr(time['second'], curses.color_pair(theme.COLOR_TIME_NUMBERS)) + self.addstr(theme.CHAR_TIME_RIGHT, curses.color_pair(theme.COLOR_TIME_LIMITER)) self.addstr(' ') def resize(self, height, width, y, x, stdscr, room=None): @@ -1425,3 +1430,17 @@ class ColumnHeaderWin(Win): self.addstr(0, x, txt, curses.color_pair(theme.COLOR_STATUS_UNAVAILABLE)) x += size self._refresh() + +# class SimpleTextWin(Win): +# def __init__(self, text): +# self._text = text +# self.built_lines = [] + +# def resize(self, height, width, y, x, stdscr): +# self._resize(height, width, y, x, stdscr) +# self.rebuild_text() + +# def rebuild_text(self): + +# def refresh(self): +# pass |