Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Desenho.py
diff options
context:
space:
mode:
authorAlexandre 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)
commitfc1f549a9711d6d5d91558295906fbc0f813f927 (patch)
tree8ddc33451afdd06466c98994c4d671863b5cc66b /Desenho.py
parent023e8784a6b67399ee4f383e9310b9677df7f1ef (diff)
Text tool improved.
Using a gtk.TextView to display text.
Diffstat (limited to 'Desenho.py')
-rw-r--r--Desenho.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/Desenho.py b/Desenho.py
index efc6dd8..05f7919 100644
--- a/Desenho.py
+++ b/Desenho.py
@@ -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)