foiegras r51 - in trunk: . src/foiegras
- From: denisw svn gnome org
- To: svn-commits-list gnome org
- Subject: foiegras r51 - in trunk: . src/foiegras
- Date: Fri, 1 Feb 2008 19:00:27 +0000 (GMT)
Author: denisw
Date: Fri Feb 1 19:00:27 2008
New Revision: 51
URL: http://svn.gnome.org/viewvc/foiegras?rev=51&view=rev
Log:
2008-02-01 Denis Washington <denisw svn gnome org>
* src/foiegras/docbuffer.py:
Start a new file with a title and a add-text-here paragraph.
Modified:
trunk/ChangeLog
trunk/src/foiegras/docbuffer.py
Modified: trunk/src/foiegras/docbuffer.py
==============================================================================
--- trunk/src/foiegras/docbuffer.py (original)
+++ trunk/src/foiegras/docbuffer.py Fri Feb 1 19:00:27 2008
@@ -20,6 +20,9 @@
import pango
import gobject
+def _(string):
+ return string
+
INLINE_TAGS = []
BLOCK_TAGS = []
@@ -37,6 +40,10 @@
INLINE_TAGS.append(name)
return gtk.TextTag(name)
+ # read-only areas
+ tag = gtk.TextTag("_readonly")
+ tag.set_property("editable", False)
+ TAG_TABLE.add(tag)
# <app>
tag = inline_tag("app")
@@ -73,7 +80,7 @@
# <em>
tag = inline_tag("em")
- tag.set_property("style", pango.STYLE_ITALIC)
+ tag.set_property("weight", pango.WEIGHT_BOLD)
TAG_TABLE.add(tag)
# <figure>
@@ -138,6 +145,12 @@
tag.set_property("family", "monospace")
TAG_TABLE.add(tag)
+ # <title>
+ tag = block_tag("title")
+ tag.set_property("scale", pango.SCALE_XX_LARGE)
+ tag.set_property("underline", True)
+ TAG_TABLE.add(tag)
+
# <var>
tag = inline_tag("var")
tag.set_property("style", pango.STYLE_ITALIC)
@@ -165,7 +178,27 @@
self.connect("insert-text", self.__insert_text_cb)
self.connect_after("insert-text", self.__insert_text_after_cb)
+ if filename:
+ # TODO: File loading
+ pass
+ else:
+ self.set_text(_("New Topic\nAdd the topic's content here."))
+
+ start_iter = self.get_start_iter()
+ self.apply_block_tag("title", start_iter)
+ newline_iter = self.get_start_iter().copy()
+
+ while not newline_iter.get_char() == "\n":
+ newline_iter.forward_char()
+
+
+ end_iter = newline_iter.copy()
+ end_iter.forward_char()
+
+ self.apply_tag(self.get_tag_table().lookup("_readonly"), newline_iter, end_iter)
+
+
def get_filename(self):
"""
Returns the name of the file represented by the buffer.
@@ -196,8 +229,13 @@
start_iter = block_iter.copy()
start_iter.set_line_offset(0)
+
end_iter = block_iter.copy()
- end_iter.forward_to_line_end()
+
+ if not end_iter.ends_line():
+ end_iter.forward_to_line_end()
+
+ end_iter.forward_char()
self.apply_tag_by_name(tag_name, start_iter, end_iter)
@@ -350,7 +388,11 @@
it.backward_char()
for tag in it.get_tags():
- active_tags.add(tag.get_property("name"))
+ tag_name = tag.get_property("name")
+
+ if not tag_name.startswith("_") and \
+ not (it.ends_line() and tag_name in BLOCK_TAGS):
+ active_tags.add(tag.get_property("name"))
active_tags = active_tags.union(self.__activated_tags)
active_tags = active_tags.difference(self.__deactivated_tags)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]