scrolled window signal when user scrolls with mouse etc.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

scrolled window signal when user scrolls with mouse etc.

Rob Brown-Bayliss-2
Hi

I have a textview in a scrolled window, this is watching a growing log file, so it scrolls quite quickly.  

I have set it to scroll with the output (using scroll_to_mark() on the textview, and given the users a pause button to disable the automatic scrolling. 

I want to get notified when the user scrolls the view manually via either the keyboard or scrollbars to also pause the scrolling.  But watching the vadjustment value_changed signal of the scrolled window I get notices for every new log entry (the scroll_to_mark()) and can't distinguish between these and the users actions.

Does any one have any ideas on how to achieve this?


Thanks

--
--

Rob

_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Reply | Threaded
Open this post in threaded view
|

Re: scrolled window signal when user scrolls with mouse etc.

roggedaniel
This post has NOT been accepted by the mailing list yet.
You've got to get the vscrollbar associated with that scrolledwindow, then connect the button-press and button-release events to callbacks which disable/enable the automatic scrolling:

example:

scroll_bar = scrolledwindow.get_vscrollbar()
scroll_bar.connect("button-press-event", self.on_vscrollbar_button_press)
scroll_bar.connect("button-release-event", self.on_vscrollbar_button_release)


    def on_vscrollbar_button_press(self, vscrollbar, event, data=None):
        # mask the motion line update so user can scroll through code without periodic update stepping on his scrolling
        self.textview.masked = True