diff options
author | mascha@ma-scha.de <mascha@ma-scha.de@8f060a39-251c-0410-b1f3-431655927647> | 2008-07-14 19:02:46 (GMT) |
---|---|---|
committer | mascha@ma-scha.de <mascha@ma-scha.de@8f060a39-251c-0410-b1f3-431655927647> | 2008-07-14 19:02:46 (GMT) |
commit | 9cbbbc96ac00af272b2986a90a0bc2ba855aec62 (patch) | |
tree | bc5fe867f876411d688d4c47eda18edd894c1299 /src/TextThought.py | |
parent | ec10b63676524a330ecbf3c336079ec0918a05f8 (diff) |
o fix AttributeErrors
o remember last selected font, fixes issue 119
git-svn-id: http://labyrinth.googlecode.com/svn/trunk@336 8f060a39-251c-0410-b1f3-431655927647
Diffstat (limited to 'src/TextThought.py')
-rw-r--r-- | src/TextThought.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/TextThought.py b/src/TextThought.py index 423d6b7..87fd5d3 100644 --- a/src/TextThought.py +++ b/src/TextThought.py @@ -197,6 +197,8 @@ class TextThought (BaseThought.BaseThought): return show_text def recalc_edges (self): + if (not hasattr(self, "layout")): + return del self.layout show_text = self.attrs_changed () @@ -227,9 +229,10 @@ class TextThought (BaseThought.BaseThought): self.text_location = (self.lr[0] - margin[2] - x, self.ul[1] + margin[1]) self.ul = (self.lr[0] - margin[0] - margin[2] - x, tmp1) - def commit_text (self, context, string, mode): + def commit_text (self, context, string, mode, font_name): if not self.editing: self.emit ("begin_editing") + self.set_font(font_name) self.add_text (string) self.recalc_edges () self.emit ("title_changed", self.text) @@ -1209,7 +1212,10 @@ class TextThought (BaseThought.BaseThought): self.undo.add_undo(UndoManager.UndoAction(self, UNDO_ADD_ATTR, self.undo_attr_cb, attr)) - self.current_attrs.change(attr) + try: + self.current_attrs.change(attr) + except AttributeError: + self.current_attrs.append(attr) else: old_attrs = self.attributes.copy() self.attributes.change(attr) |