Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
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
parent023e8784a6b67399ee4f383e9310b9677df7f1ef (diff)
Text tool improved.
Using a gtk.TextView to display text.
-rw-r--r--Area.py9
-rw-r--r--Desenho.py19
-rw-r--r--NEWS1
-rw-r--r--OficinaActivity.py8
4 files changed, 30 insertions, 7 deletions
diff --git a/Area.py b/Area.py
index 1f1984a..3d9499a 100644
--- a/Area.py
+++ b/Area.py
@@ -257,7 +257,14 @@ class Area(gtk.DrawingArea):
# This fixes a bug that made the text viewer get stuck in the canvas
elif self.estadoTexto is 1:
- text = self.janela._textview.get_text()
+ try:
+ # This works for a gtk.Entry
+ text = self.janela._textview.get_text()
+ except:
+ # This works for a gtk.TextView
+ buf = self.janela._textview.get_buffer()
+ start, end = buf.get_bounds()
+ text = buf.get_text(start, end)
if text is not None:
self.d.text(widget,event)
self.estadoTexto = 0
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)
diff --git a/NEWS b/NEWS
index 3545488..3d265db 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
7
+* Writting tool improved (alexandre)
* Bug #2147 fixed (alexandre)
* Build as Paint not oficina
* Clean up NEWS file - please use setup.py release to do releases
diff --git a/OficinaActivity.py b/OficinaActivity.py
index fdc62d7..d76664a 100644
--- a/OficinaActivity.py
+++ b/OficinaActivity.py
@@ -101,9 +101,11 @@ class OficinaActivity(activity.Activity):
self.bg.show()
#FIXME: use a textview instead of an Entry
- #self._textview = gtk.TextView()
- self._textview = gtk.Entry()
- self._area.tool = 2
+ self._textview = gtk.TextView()
+ # If we use this, text viewer will have constant size, we don't want that
+ #self._textview.set_size_request(100,100)
+ #self._textview = gtk.Entry()
+
self._fixed.put(self._area, 200 , 100)
# Area size increased
#self._fixed.put(self._area, 0 , 0)