Skip to content
Permalink
Browse files

update ezhil document help view #193

  • Loading branch information...
Muthiah Annamalai
Muthiah Annamalai committed Jul 21, 2017
1 parent b7b8443 commit b00c83456887e58587a3ba3519480af307d7a3a2
Showing with 10 additions and 6 deletions.
  1. +10 −6 editor/DocView.py
@@ -82,6 +82,7 @@ def __init__(self):
self.tag = {}
self.pageno = 0
self.default_font = "Sans 18"
self.default_font_chapter = "Serif 16"
self.default_font_title = "Sans 24"
self.textbuffer = None
self.layoutpos = {"title":u"","section":0}
@@ -104,6 +105,8 @@ def build_tags(self,textbuffer):
self.tag["keyword"] = textbuffer.create_tag("keyword",
weight=Pango.Weight.BOLD,foreground="blue",font=self.default_font)
# use for text/section tags
self.tag["chapter"] = textbuffer.create_tag("chapter",
weight=Pango.Weight.SEMIBOLD,foreground="black",font=self.default_font_chapter)
self.tag["text"] = textbuffer.create_tag("text",font=self.default_font,foreground="black")
self.tag["literal"] = textbuffer.create_tag("literal",
style=Pango.Style.ITALIC,font=self.default_font,foreground="green")
@@ -141,17 +144,16 @@ def visit_fmt(self,*args):

def visit_chapter(self,*args):
child = args[0]
title = u"%d) "%self.pageno + child.getAttribute("title")+u"\n"
# skip chapter 0 - ithu managatti mathiri irukku
title = ((self.pageno > 0) and u"%d) "%self.pageno or u" ") + child.getAttribute("title")+u"\n"
self.layoutpos["title"]=title
#print("Chapter => %s"%title)
self.append_text_with_tag(title,self.tag["title"])

def visit_section(self,*args):
child = args[0]
self.layoutpos["section"] += 1
#print("Section => %s"%str(child))
self.append_text_with_tag(u"_"*100+u"\n",self.tag["text"])
self.append_text_with_tag(u"பிரிவு %d\n"%self.layoutpos["section"],self.tag["found"])
self.append_text_with_tag(u"பிரிவு %d\n"%self.layoutpos["section"], self.tag["found"])

def visit_code(self,*args):
child = args[0]
@@ -168,7 +170,7 @@ def visit_code(self,*args):
def visit_text(self,text):
child = text
#print("Text => %s"%str(child))
self.append_text_with_tag(child.data,self.tag["text"])
self.append_text_with_tag(child.data,self.pageno == 0 and self.tag["chapter"] or self.tag["text"])

def visit_list(self,*args):
child = args[0]
@@ -226,7 +228,9 @@ def render_page(self,pageno,textbuffer):
def update_toc(self,box,parent):
toc_list = [u"<chapter title=\"தமிழில் நிரல் எழுது - புத்தக உள்ளீடு\">",]
for pos,chapter in self.chapters.items():
btn = Gtk.Button(u"%d. %s"%(pos,chapter['title']))
btn = Gtk.Button(u"%d. <b>%s</b>"%(pos,chapter['title']))
btn.get_children()[0].set_use_markup(True)
btn.set_alignment(0.0,0.0)
btn.connect('clicked',parent.on_navigate_to,chapter['title'],pos)
box.pack_start(btn,True,True,0)
toc_list.append(u"<section>%s</section>"%chapter['title'])

0 comments on commit b00c834

Please sign in to comment.
You can’t perform that action at this time.