def press_right(self, x, y): self._check_region_press(x, y) if self._region_active == 'view': xo, yo = self._T_1(x, y) # TEXT EDITING MODE if self._mode == 'text': try: self.pcursor.target(xo, yo) if len(self.pcursor.i) != 2: return ib, it = self.pcursor.i ms = self.pcursor.PLANE.content[ib].content.misspellings pair_i = bisect.bisect([pair[0] for pair in ms], it) - 1 if ms[pair_i][0] <= it <= ms[pair_i][1]: self.pcursor.i = (ib, ms[pair_i][0]) self.pcursor.j = (self.pcursor.j[0], ms[pair_i][1]) # used to keep track of ui redraws self._sel_cursor = self.pcursor.j suggestions = [ms[pair_i][2]] + [w.decode("utf-8") for w in wonder.struck.suggest(ms[pair_i][2].encode('latin-1', 'ignore'))] labels = suggestions[:] labels[0] = '“' + labels[0] + '”' menu.create(x, y, 200, list(zip(suggestions, labels)), self._replace_misspelled) except IndexError: # occurs if an empty frame is selected pass # check if paragraph context changed self.context.update()
def focus(self, x, y): J = self.hover(x, y) self._dropdown_active = J == 1 if J == 1: menu.create(self._mx, self._my - 5, 200, self._menu_options, self._recieve_menu_value, inform=(self._minform,), source=self._msource ) elif J == 2: self._NAMEWIDGET.focus(x - self._d1, y) elif J == 3: self._O = self._supernode.content_new(self._O) self._minform() elif J == 4: self._O = None self._minform()
def focus(self, x, y): self._dropdown_active = True menu.create(self._mx, self._my - 5, 200, self._menu_options, self._recieve_menu_value, inform=(self._minform,), source=self._msource )