svn: r16688
This commit is contained in:
Gerald Britton 2011-02-21 14:35:04 +00:00
parent f035bb83a9
commit e8b0c9d1eb

View File

@ -228,18 +228,21 @@ class Gramplet(object):
""" """
Set the textview to wrap or not. Set the textview to wrap or not.
""" """
textview = self.gui.textview
import gtk import gtk
# gtk.WRAP_NONE, gtk.WRAP_CHAR, gtk.WRAP_WORD or gtk.WRAP_WORD_CHAR. # gtk.WRAP_NONE, gtk.WRAP_CHAR, gtk.WRAP_WORD or gtk.WRAP_WORD_CHAR.
if value in [True, 1]: if value in [True, 1]:
self.gui.textview.set_wrap_mode(gtk.WRAP_WORD) textview.set_wrap_mode(gtk.WRAP_WORD)
elif value in [False, 0, None]: elif value in [False, 0, None]:
self.gui.textview.set_wrap_mode(gtk.WRAP_NONE) textview.set_wrap_mode(gtk.WRAP_NONE)
elif value in ["char"]: elif value in ["char"]:
self.gui.textview.set_wrap_mode(gtk.WRAP_CHAR) textview.set_wrap_mode(gtk.WRAP_CHAR)
elif value in ["word char"]: elif value in ["word char"]:
self.gui.textview.set_wrap_mode(gtk.WRAP_WORD_CHAR) textview.set_wrap_mode(gtk.WRAP_WORD_CHAR)
else: else:
raise Exception("Unknown wrap mode: '%s': use 0,1,'char' or 'word char')" % value) raise ValueError(
"Unknown wrap mode: '%s': use 0,1,'char' or 'word char')"
% value)
def no_wrap(self): def no_wrap(self):
""" """