uix:TextInput don't convert to window if the pos is already in window co-ordinates.

This commit is contained in:
akshayaurora 2014-08-03 02:17:27 +05:30
parent 7847e45972
commit 418108577e
1 changed files with 6 additions and 5 deletions

View File

@ -1046,10 +1046,11 @@ class TextInput(Widget):
return return
self._update_selection() self._update_selection()
print instance.pos
self._show_cut_copy_paste( self._show_cut_copy_paste(
(instance.x + ((1 if instance is self._handle_left else - 1) (instance.x + ((1 if instance is self._handle_left else -1)
* self._bubble.width / 2) if self._bubble else 0, * self._bubble.width / 2) if self._bubble else instance.x,
instance.y + self.line_height), self._win) instance.top + self.line_height), self._win, pos_in_window=True)
def _handle_move(self, instance, touch): def _handle_move(self, instance, touch):
if touch.grab_current != instance: if touch.grab_current != instance:
@ -1173,7 +1174,7 @@ class TextInput(Widget):
anim.start(self._handle_left) anim.start(self._handle_left)
def _show_cut_copy_paste(self, pos, win, parent_changed=False, def _show_cut_copy_paste(self, pos, win, parent_changed=False,
mode='', *l): mode='', pos_in_window=False, *l):
# Show a bubble with cut copy and paste buttons # Show a bubble with cut copy and paste buttons
if not self.use_bubble: if not self.use_bubble:
return return
@ -1196,7 +1197,7 @@ class TextInput(Widget):
lh, ls = self.line_height, self.line_spacing lh, ls = self.line_height, self.line_spacing
x, y = pos x, y = pos
t_pos = self.to_window(x, y) t_pos = (x, y) if pos_in_window else self.to_window(x, y)
bubble_size = bubble.size bubble_size = bubble.size
win_size = win.size win_size = win.size
bubble.pos = (t_pos[0] - bubble_size[0] / 2., t_pos[1] + inch(.25)) bubble.pos = (t_pos[0] - bubble_size[0] / 2., t_pos[1] + inch(.25))