diff options
author | Alexandre Antonino Gonçalves Martinazzo <alexandremartinazzo@gmail.com> | 2007-08-24 18:49:44 (GMT) |
---|---|---|
committer | Alexandre Antonino Gonçalves Martinazzo <alexandremartinazzo@gmail.com> | 2007-08-24 18:49:44 (GMT) |
commit | fc1f549a9711d6d5d91558295906fbc0f813f927 (patch) | |
tree | 8ddc33451afdd06466c98994c4d671863b5cc66b /Desenho.py | |
parent | 023e8784a6b67399ee4f383e9310b9677df7f1ef (diff) |
Text tool improved.
Using a gtk.TextView to display text.
Diffstat (limited to 'Desenho.py')
-rw-r--r-- | Desenho.py | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -530,13 +530,26 @@ class Desenho: else: self.d.estadoTexto = 0 - texto = self.d.janela._textview.get_text() - layout = self.d.create_pango_layout(texto) + + try: + # This works for a gtk.Entry + text = self.d.janela._textview.get_text() + except: + # This works for a gtk.TextView + buf = self.d.janela._textview.get_buffer() + start, end = buf.get_bounds() + text = buf.get_text(start, end) + + layout = self.d.create_pango_layout(text) layout.set_font_description(self.d.font) + self.d.pixmap.draw_layout(self.d.gc, self.d.oldx, self.d.oldy, layout) self.d.pixmap_temp.draw_layout(self.d.gc, self.d.oldx, self.d.oldy, layout) self.d.janela._textview.hide() - self.d.janela._textview.set_text('') + try: + self.d.janela._textview.set_text('') + except: + buf.set_text('') self.d.enableUndo(widget) |