OSDN Git Service

The scrollbar on ThreadView is shown or hidden when the "changed" signal on the adjum...
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Sun, 3 May 2009 14:34:13 +0000 (23:34 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Sun, 3 May 2009 14:34:13 +0000 (23:34 +0900)
src/FukuiNoNamari/thread_view.py

index 0c181ba..1c2aa3f 100644 (file)
@@ -560,6 +560,8 @@ class ThreadView(gtk.HBox):
             "key-press-event", self.on_drawingarea_key_press_event)
         self.adjustment.connect(
             "value-changed", self.on_adjustment_value_changed)
+        self.adjustment.connect(
+            "changed", self.on_adjustment_changed)
 
         self.pango_layout = self.drawingarea.create_pango_layout("")
 
@@ -598,7 +600,6 @@ class ThreadView(gtk.HBox):
         self.adjustment.upper = res_layout.posY + y
         # do not use this method in a loop because expensive.
         # self.redraw()
-        self.change_vscrollbar_visible()
 
     def create_res_layout(self, left_margin, resnum):
         return ResLayout(left_margin, resnum, self.pango_layout)
@@ -635,7 +636,6 @@ class ThreadView(gtk.HBox):
             sum_height += y
 
         self.adjustment.upper = sum_height
-        self.change_vscrollbar_visible()
 
     def change_vscrollbar_visible(self):
         if self.adjustment.upper <= self.adjustment.page_size:
@@ -863,11 +863,13 @@ class ThreadView(gtk.HBox):
 
         # re-set 'value' for prevent overflow
         self._set_adjustment_value(self.adjustment.value)
-        self.change_vscrollbar_visible()
 
     def on_adjustment_value_changed(self, widget, data=None):
         self.drawingarea.queue_draw()
 
+    def on_adjustment_changed(self, widget, data=None):
+        self.change_vscrollbar_visible()
+
     def on_drawingarea_scroll_event(self, widget, event, data=None):
         self.vscrollbar.emit("scroll-event", event)