(self)
| 734 | transform=self.ax.transAxes) |
| 735 | |
| 736 | def _rendercursor(self): |
| 737 | # this is a hack to figure out where the cursor should go. |
| 738 | # we draw the text up to where the cursor should go, measure |
| 739 | # and save its dimensions, draw the real text, then put the cursor |
| 740 | # at the saved dimensions |
| 741 | |
| 742 | widthtext = self.text[:self.cursor_index] |
| 743 | no_text = False |
| 744 | if(widthtext == "" or widthtext == " " or widthtext == " "): |
| 745 | no_text = widthtext == "" |
| 746 | widthtext = "," |
| 747 | |
| 748 | wt_disp = self._make_text_disp(widthtext) |
| 749 | |
| 750 | self.ax.figure.canvas.draw() |
| 751 | bb = wt_disp.get_window_extent() |
| 752 | inv = self.ax.transData.inverted() |
| 753 | bb = inv.transform(bb) |
| 754 | wt_disp.set_visible(False) |
| 755 | if no_text: |
| 756 | bb[1, 0] = bb[0, 0] |
| 757 | # hack done |
| 758 | self.cursor.set_visible(False) |
| 759 | |
| 760 | self.cursor = self.ax.vlines(bb[1, 0], bb[0, 1], bb[1, 1]) |
| 761 | self.ax.figure.canvas.draw() |
| 762 | |
| 763 | def _notify_submit_observers(self): |
| 764 | for cid, func in self.submit_observers.items(): |
no test coverage detected