diff options
author | mascha@ma-scha.de <mascha@ma-scha.de@8f060a39-251c-0410-b1f3-431655927647> | 2008-03-29 12:40:41 (GMT) |
---|---|---|
committer | mascha@ma-scha.de <mascha@ma-scha.de@8f060a39-251c-0410-b1f3-431655927647> | 2008-03-29 12:40:41 (GMT) |
commit | b9f3a228c17581cf5e5a276c65d47b67ff47c160 (patch) | |
tree | 5f7a627b2915e044431a9112dc62467d884f0c78 /src/TextThought.py | |
parent | bf7fd6ebff3ddf5c2666ec369a48ee89e5bf2843 (diff) |
2008-03-29 Martin Schaaf <mascha@ma-scha.de>
* src/TextThought.py
o set attribute to none or normal on unsetting (there is more work
todo)
git-svn-id: http://labyrinth.googlecode.com/svn/trunk@251 8f060a39-251c-0410-b1f3-431655927647
Diffstat (limited to 'src/TextThought.py')
-rw-r--r-- | src/TextThought.py | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/src/TextThought.py b/src/TextThought.py index 082680c..861272d 100644 --- a/src/TextThought.py +++ b/src/TextThought.py @@ -1132,6 +1132,17 @@ class TextThought (BaseThought.BaseThought): if not self.editing: return if not active: + if self.index == self.end_index: + attr = pango.AttrStyle(pango.WEIGHT_NORMAL, self.index, self.end_index) + self.current_attrs.change(attr) + elif self.index < self.end_index: + attr = pango.AttrStyle(pango.WEIGHT_NORMAL, self.index, self.end_index) + self.attributes.change(attr) + else: + attr = pango.AttrStyle(pango.WEIGHT_NORMAL, self.end_index, self.index) + self.attributes.change(attr) + + # FIXME: The following code should be cleaned up tmp = [] attr = None if self.index == self.end_index: @@ -1212,6 +1223,17 @@ class TextThought (BaseThought.BaseThought): if not self.editing: return if not active: + if self.index == self.end_index: + attr = pango.AttrStyle(pango.STYLE_NORMAL, self.index, self.end_index) + self.current_attrs.change(attr) + elif self.index < self.end_index: + attr = pango.AttrStyle(pango.STYLE_NORMAL, self.index, self.end_index) + self.attributes.change(attr) + else: + attr = pango.AttrStyle(pango.STYLE_NORMAL, self.end_index, self.index) + self.attributes.change(attr) + + # FIXME: The following code should be cleaned up tmp = [] attr = None if self.index == self.end_index: @@ -1269,9 +1291,9 @@ class TextThought (BaseThought.BaseThought): self.undo.add_undo(UndoManager.UndoAction(self, UNDO_ADD_ATTR, self.undo_attr_cb, attr)) - self.current_attrs.append(attr) + self.current_attrs.change(attr) elif self.index < self.end_index: - attr = pango.AttrStyle(pango.STYLE_ITALIC, self.index, self.end_index) + attr = pango.AttrStyle(pango.STYLE_ITALIC, self.index, self.end_index) old_attrs = self.attributes.copy() self.attributes.change(attr) self.undo.add_undo(UndoManager.UndoAction(self, UNDO_ADD_ATTR_SELECTION, \ @@ -1292,6 +1314,17 @@ class TextThought (BaseThought.BaseThought): if not self.editing: return if not active: + if self.index == self.end_index: + attr = pango.AttrStyle(pango.UNDERLINE_NONE, self.index, self.end_index) + self.current_attrs.change(attr) + elif self.index < self.end_index: + attr = pango.AttrStyle(pango.UNDERLINE_NONE, self.index, self.end_index) + self.attributes.change(attr) + else: + attr = pango.AttrStyle(pango.UNDERLINE_NONE, self.end_index, self.index) + self.attributes.change(attr) + + # FIXME: The following code should be cleaned up tmp = [] attr = None if self.index == self.end_index: @@ -1349,7 +1382,7 @@ class TextThought (BaseThought.BaseThought): self.undo.add_undo(UndoManager.UndoAction(self, UNDO_ADD_ATTR, self.undo_attr_cb, attr)) - self.current_attrs.append(attr) + self.current_attrs.change(attr) elif self.index < self.end_index: attr = pango.AttrUnderline(pango.UNDERLINE_SINGLE, self.index, self.end_index) old_attrs = self.attributes.copy() @@ -1384,7 +1417,7 @@ class TextThought (BaseThought.BaseThought): self.undo.add_undo(UndoManager.UndoAction(self, UNDO_ADD_ATTR, self.undo_attr_cb, attr)) - self.current_attrs.append(attr) + self.current_attrs.change(attr) else: old_attrs = self.attributes.copy() self.attributes.change(attr) |