diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2013-04-11 15:14:56 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-04-11 17:48:56 (GMT) |
commit | a4c765a0cecf34b42ea86a1aad5f03cf49227d2a (patch) | |
tree | 86284c2d77647b310984d626f7843af80c3122c5 /globos.py | |
parent | 947c489b1296de7ad0f20788467690ab75aec57f (diff) |
Fix movement of textview when the globe is resized
After the change to use a textview to edit text, this was a pending
issue. Is solved using the HBox around the text view to calculate
the real size. The x, y coordinates in the class CuadroTexto
were removed, using the values in the parent Globe.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'globos.py')
-rw-r--r-- | globos.py | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -780,10 +780,6 @@ class CuadroTexto: self.ancho = ancho self.alto = alto - #Centro del cuadro - self.x = globe.x - self.y = globe.y - self.text = '' #Caracteristicas de la tipografia @@ -821,9 +817,9 @@ class CuadroTexto: self.font_description)) self.set_dimension(self.ancho, self.alto) - self._size_alloc_id = self._box.textview.connect('size_allocate', - self._textview_size_allocate) - self.mover_a(self.x, self.y) + self._size_alloc_id = self._box.textviewbox.connect( + 'size_allocate', self._textview_size_allocate) + self.mover_a(self._globe.x, self._globe.y) self._box.textviewbox.show_all() self._box.textview.grab_focus() else: @@ -832,7 +828,7 @@ class CuadroTexto: self._box.textviewbox.hide() tbuffer.set_text('') if self._size_alloc_id != 0: - self._box.textview.disconnect(self._size_alloc_id) + self._box.textviewbox.disconnect(self._size_alloc_id) self._size_alloc_id = 0 def imprimir(self, ctx): @@ -867,8 +863,6 @@ class CuadroTexto: def mover_a(self, x, y): "Mueve el centro del cuadro a la posicion (x,y)" - self.y = y - self.x = x x = self._globe.x - self.ancho y = self._globe.y - self.alto self._box.move_textview(x, y) @@ -891,7 +885,6 @@ class CuadroTexto: def _textview_size_allocate(self, widget, alloc): if self._in_edition: - # recalculate size and position with the real size allocated self.ancho = alloc.width / 2 self.alto = alloc.height / 2 |