OSDN Git Service

not relayout pango layout list when adding pango layout.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Sun, 9 Dec 2007 20:21:33 +0000 (05:21 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Sun, 9 Dec 2007 20:21:33 +0000 (05:21 +0900)
src/FukuiNoNamari/thread_view.py
src/FukuiNoNamari/thread_window.py

index b20b510..b256795 100644 (file)
@@ -53,11 +53,23 @@ class ThreadView(gtk.HBox):
         self.pangolayout = []
 
     def add_layout(self, pangolayout):
+        if (len(self.pangolayout) != 0):
+            last = self.pangolayout[len(self.pangolayout)-1]
+            x, y = last.get_pixel_size()
+            pangolayout.posY = last.posY + y
+        self.set_layout_width(pangolayout)
         self.pangolayout.append(pangolayout)
+        x, y = pangolayout.get_pixel_size()
+        self.adjustment.upper = pangolayout.posY + y
+        self.redraw()
 
     def create_pango_layout(self, text):
         return self.drawingarea.create_pango_layout(text)
 
+    def set_layout_width(self, layout):
+        width = self.drawingarea.allocation.width
+        layout.set_width((width - layout.marginleft) * pango.SCALE)
+        
     def redraw(self):
         self.drawingarea.queue_draw()
 
index f87b3dc..20f6650 100644 (file)
@@ -402,13 +402,7 @@ class WinWrap(winwrapbase.WinWrapBase):
             self.res_queue.append((line, False, None, True))
             print "maybe syntax error.", self.num, line
 
-        def process_res_queue(res_queue, num):
-            self.process_queue(res_queue, num)
-            # for next res
-            #self.textbuffer.create_mark(str(num+1), self.enditer, True)
-
-        gobject.idle_add(
-            process_res_queue, self.res_queue, self.num)
+        self.process_queue(self.res_queue, self.num)
 
     def reselems_to_buffer(self, num, name, mail, date, msg):
         p = barehtmlparser.BareHTMLParser(
@@ -454,8 +448,7 @@ class WinWrap(winwrapbase.WinWrapBase):
                     layout.marginleft = 20
                 else:
                     layout.marginleft = 0
-
-                self.threadview.add_layout(layout)
+                gobject.idle_add(self.threadview.add_layout, layout)
 
                 current_margin = margin
                 text = ""
@@ -480,9 +473,7 @@ class WinWrap(winwrapbase.WinWrapBase):
                 layout.marginleft = 20
             else:
                 layout.marginleft = 0
-        self.threadview.add_layout(layout)
-        self.threadview.relayout()
-        self.threadview.redraw()
+        gobject.idle_add(self.threadview.add_layout, layout)
 #             taglist = []
 #             if bold:
 #                 taglist.append(self.boldtag)