(self, event)
| 144 | pass |
| 145 | |
| 146 | def AutoReload(self, event): |
| 147 | if(self.logfile != "" and self.logfile != None): |
| 148 | # Max number of lines to display per reload |
| 149 | # Would be better if adjusted to effective display capability |
| 150 | max_lines = 20 |
| 151 | |
| 152 | circular_buffer = [u'' for i in range(max_lines)] |
| 153 | index = 0 |
| 154 | # Did we overwrote lines in the circular buffer? |
| 155 | wrapped_buffer = False |
| 156 | overwritten_lines = 0 |
| 157 | |
| 158 | while True: |
| 159 | line = self.logfile.readline() |
| 160 | if not line: |
| 161 | # Reached the current bottom of log, disable throttling |
| 162 | # Could mean we never disable it if we're overflowed with logs |
| 163 | # from the very beginning |
| 164 | self.throttling = True |
| 165 | if self.log_reader.IsFrozen(): |
| 166 | self.log_reader.Thaw() |
| 167 | break |
| 168 | |
| 169 | # Line buffering |
| 170 | self.line_buffer += line |
| 171 | if line[-1] != '\n': |
| 172 | break |
| 173 | circular_buffer[index] = self.line_buffer |
| 174 | self.line_buffer = "" |
| 175 | |
| 176 | index += 1 |
| 177 | if wrapped_buffer: |
| 178 | overwritten_lines += 1 |
| 179 | |
| 180 | # Buffer wrapping |
| 181 | if index >= max_lines: |
| 182 | if not self.throttling: |
| 183 | break |
| 184 | index = 0 |
| 185 | wrapped_buffer = True |
| 186 | |
| 187 | if wrapped_buffer: |
| 188 | if overwritten_lines > 0: |
| 189 | self.AppendStyledText("...skipped %d line(s)...\n" % overwritten_lines) |
| 190 | # Fix skipped line as soon as we have some free time |
| 191 | self.need_redisplay = True |
| 192 | for k in range(index, max_lines): |
| 193 | self.AppendStyledText(circular_buffer[k]) |
| 194 | for k in range(0, index): |
| 195 | self.AppendStyledText(circular_buffer[k]) |
| 196 | |
| 197 | def OnFocus(self, event): |
| 198 | if self.need_redisplay: |
no test coverage detected