(self, *args, **kwargs)
| 67 | |
| 68 | """ |
| 69 | def __init__(self, *args, **kwargs): |
| 70 | # Fix for python curses resize bug: |
| 71 | # http://bugs.python.org/issue2675 |
| 72 | os.unsetenv('LINES') |
| 73 | os.unsetenv('COLUMNS') |
| 74 | self.scr = args[0] |
| 75 | self.data = [[str(j) for j in i] for i in args[1]] |
| 76 | self.info = kwargs.get('info') |
| 77 | self.header_offset_orig = 3 |
| 78 | self.header = self.data[0] |
| 79 | if len(self.data) > 1 and \ |
| 80 | not any(self._is_num(cell) for cell in self.header): |
| 81 | del self.data[0] |
| 82 | self.header_offset = self.header_offset_orig |
| 83 | else: |
| 84 | # Don't make one line file a header row |
| 85 | # If any of the header line cells are all digits, assume that the |
| 86 | # first line is NOT a header |
| 87 | self.header_offset = self.header_offset_orig - 1 |
| 88 | self.num_data_columns = len(self.data[0]) |
| 89 | self._init_double_width(kwargs.get('double_width')) |
| 90 | self.column_width_mode = kwargs.get('column_width') |
| 91 | self.column_gap = kwargs.get('column_gap') |
| 92 | self._init_column_widths(kwargs.get('column_width'), |
| 93 | kwargs.get('column_widths')) |
| 94 | try: |
| 95 | kwargs.get('trunc_char').encode(sys.stdout.encoding or 'utf-8') |
| 96 | self.trunc_char = kwargs.get('trunc_char') |
| 97 | except (UnicodeDecodeError, UnicodeError): |
| 98 | self.trunc_char = '>' |
| 99 | |
| 100 | self.x, self.y = 0, 0 |
| 101 | self.win_x, self.win_y = 0, 0 |
| 102 | self.max_y, self.max_x = 0, 0 |
| 103 | self.num_columns = 0 |
| 104 | self.vis_columns = 0 |
| 105 | self.init_search = self.search_str = kwargs.get('search_str') |
| 106 | self._search_win_open = 0 |
| 107 | self.modifier = str() |
| 108 | self.define_keys() |
| 109 | self.resize() |
| 110 | self.display() |
| 111 | # Handle goto initial position (either (y,x), [y] or y) |
| 112 | try: |
| 113 | self.goto_y(kwargs.get('start_pos')[0]) |
| 114 | except TypeError: |
| 115 | self.goto_y(kwargs.get('start_pos')) |
| 116 | try: |
| 117 | self.goto_x(kwargs.get('start_pos')[1]) |
| 118 | except (IndexError, TypeError): |
| 119 | pass |
| 120 | |
| 121 | def _is_num(self, cell): |
| 122 | try: |
nothing calls this directly
no test coverage detected