Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2013-01-18 20:14:22 (GMT)
committer Walter Bender <walter.bender@gmail.com>2013-01-18 20:14:22 (GMT)
commitf651ba457b9cb6afacd295fcffecdd9d79ab9d65 (patch)
tree909dd61d049fd3286794639660df20baca158a54
parent5a2511b8dd9a69871e8abbfd184f9acc3c433f3e (diff)
make rtfparse import optional
-rw-r--r--TurtleArt/talogo.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index c1456d7..19150b3 100644
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -38,7 +38,11 @@ from tapalette import block_names, value_blocks
from tautils import get_pixbuf_from_journal, convert, data_from_file, \
text_media_type, round_int, debug_output, find_group
-from util.RtfParser import RtfTextOnly
+try:
+ from util.RtfParser import RtfTextOnly
+ RTFPARSE = True
+except ImportError:
+ RTFPARSE = False
from gettext import gettext as _
@@ -761,8 +765,9 @@ class LogoCode:
return
text = None
if text_media_type(self.filepath):
- if mimetype == 'application/rtf' or \
- self.filepath.endswith(('rtf')):
+ if RTFPARSE and (
+ mimetype == 'application/rtf' or \
+ self.filepath.endswith(('rtf'))):
text_only = RtfTextOnly()
for line in open(self.filepath, 'r'):
text_only.feed(line)