Codebase list sugar-read-activity / 230f691
flake8 fixes James Cameron authored 5 years ago Rahul Bothra committed 5 years ago
4 changed file(s) with 15 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
0 [flake8]
1
2 # E402 module level import not at top of file
3 # gi.require_version() is required before later imports
4
5 ignore = E402
117117
118118 self._bookmarks = []
119119 self._populate_bookmarks()
120 self._highlights = {0: []}
120 self._highlights = {0: []}
121121 self._populate_highlights()
122122
123123 self._user = profile.get_nick_name()
7272 combotool.show()
7373 speech.reset_buttons_cb = self.reset_buttons_cb
7474
75 def compare_voices(self, a, b):
75 def compare_voices(self, a, b):
7676 if a[0].lower() == b[0].lower():
7777 return 0
7878 if a[0] .lower() < b[0].lower():
9696 self.spoken_word_tag = self.textview.get_buffer().create_tag()
9797 self.spoken_word_tag.set_property('weight', Pango.Weight.BOLD)
9898 self.normal_tag = self.textview.get_buffer().create_tag()
99 self.normal_tag.set_property('weight', Pango.Weight.NORMAL)
99 self.normal_tag.set_property('weight', Pango.Weight.NORMAL)
100100
101101 def load_document(self, file_path):
102102
149149 break
150150 else:
151151 line = _clean_text(line)
152 label_text = label_text + unicode(line, "iso-8859-1")
152 label_text = label_text + unicode(line, "iso-8859-1")
153153 line_increment = (len(line) / 80) + 1
154154 linecount = linecount + line_increment
155155 textbuffer = self.textview.get_buffer()
294294 j = 0
295295 word_begin = 0
296296 word_end = 0
297 ignore_chars = [' ', '\n', u'\r', '_', '[', '{', ']', '}', '|',
298 '<', '>', '*', '+', '/', '\\']
297 ignore_chars = [' ', '\n', u'\r', '_', '[', '{', ']', '}', '|',
298 '<', '>', '*', '+', '/', '\\']
299299 ignore_set = set(ignore_chars)
300300 self.word_tuples = []
301301 len_page_text = len(page_text)
313313 self.word_tuples.append(word_tuple)
314314 i = i + 1
315315
316 def highlight_next_word(self, word_count):
316 def highlight_next_word(self, word_count):
317317 if word_count < len(self.word_tuples):
318318 word_tuple = self.word_tuples[word_count]
319319 textbuffer = self.textview.get_buffer()
320320 iterStart = textbuffer.get_iter_at_offset(word_tuple[0])
321321 iterEnd = textbuffer.get_iter_at_offset(word_tuple[1])
322322 bounds = textbuffer.get_bounds()
323 textbuffer.apply_tag(self.normal_tag, bounds[0], iterStart)
323 textbuffer.apply_tag(self.normal_tag, bounds[0], iterStart)
324324 textbuffer.apply_tag(self.spoken_word_tag, iterStart, iterEnd)
325325 v_adjustment = self._sw.get_vadjustment()
326326 max_pos = v_adjustment.get_upper() - v_adjustment.get_page_size()
621621
622622 return False
623623
624 def _allindices(self, line, search, listindex=None, offset=0):
624 def _allindices(self, line, search, listindex=None, offset=0):
625625 if listindex is None:
626626 listindex = []
627627 if (line.find(search) == -1):