OSDN Git Service

relayout when size change.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Sat, 8 Dec 2007 08:17:05 +0000 (17:17 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Sat, 8 Dec 2007 08:17:05 +0000 (17:17 +0900)
src/FukuiNoNamari/thread_window.py
src/data/thread_window.glade

index d40bd1c..6ffdc0d 100644 (file)
@@ -108,10 +108,15 @@ class WinWrap(winwrapbase.WinWrapBase):
                 self.drawingarea.window.draw_layout(gc, 0, layout.posY, layout)
 
     def on_drawingarea_expose_event(self, widget, event, data=None):
-        self.relayout()
         self.draw_viewport(event.area)
         return True
 
+    def on_drawingarea_size_allocate(self, widget, allocation, data=None):
+        if allocation.width != self.drawingarea.prev_width:
+            self.relayout()
+            self.drawingarea.prev_width = allocation.width
+        return False
+
     def __init__(self, uri):
         self.pangolayout = []
 
@@ -137,6 +142,8 @@ class WinWrap(winwrapbase.WinWrapBase):
         self.drawingarea = self.widget_tree.get_widget("drawingarea")
         self.viewport = self.drawingarea.parent
 
+        self.drawingarea.prev_width = 0
+
         self.initialize_buffer()
 
         sigdic = {"on_refresh_activate": self.update,
@@ -149,6 +156,8 @@ class WinWrap(winwrapbase.WinWrapBase):
                   "on_show_board_activate": self.on_show_board_activate,
                   "on_delete_activate": self.on_delete_activate,
                   "on_drawingarea_expose_event": self.on_drawingarea_expose_event,
+                  "on_drawingarea_size_allocate":
+                  self.on_drawingarea_size_allocate,
                   "on_thread_window_delete_event":
                   self.on_thread_window_delete_event,
                   "on_add_bookmark_activate": self.on_add_bookmark_activate,
index 9d34a2e..774c417 100644 (file)
                     <property name="visible">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <signal name="expose_event" handler="on_drawingarea_expose_event"/>
+                    <signal name="size_allocate" handler="on_drawingarea_size_allocate"/>
                   </widget>
                 </child>
               </widget>