bug in scrollbar???



I am having problems with scrolling a vertical scrollbar.  My program
has a notebook of 4 textviews, 1 treeview (specialized terminal in
python).   I have set it up to use arrays to hold the widgets for easy
code re-use between different widgets.   I can get it to turn on/off
auto scrolling ok until there are somewhere between 5,000 & as high as
110,000 (<= open-office) lines of text (compiler output) before it
happens.   For whatever reason it will snap back to a previous location
in the buffer/textview instead of sticking to the end of the buffer.  It
will do this repeatedly to the same position in the textview buffer and
refuse to stick to the bottom.  I can move the slider as close to the
bottom as I can before autoscrolling & it will stay, a little closer and
it snaps back.  I added a setting_scroll lock in an attempt, but it
never shows as being caught.

Any ideas what may be causing this strange behavior?



<code snipits>

SLIDER_CLOSE_ENOUGH = 0.5 # of page size

     <some of the init code>
        for x in TABS[:-1]:  # in this case [0,1,2,3]
            #dprint(x)
            adj = self.term.scrolled_window[x].get_vadjustment()
            self.term.vadjustment +=  [adj]
            id = self.term.vadjustment[x].connect("value_changed", self.set_scroll)
            self.term.vhandler_id += [id]

    def set_scroll(self,  vadjustment):  # callback function
        """Sets autoscrolling on when moved to bottom of scrollbar"""
        self.setting_scroll = True
        self.term.auto_scroll[self.term.current_tab] = (vadjustment.upper - \
                                                        vadjustment.get_value() - \
                                                        vadjustment.page_size < \
                                                         SLIDER_CLOSE_ENOUGH * vadjustment.page_size)
        #dprint(self.term.auto_scroll[self.term.current_tab])
        self.setting_scroll = False
        return


    def append(self, num, text, tagname = None):
        """ Append text to a text buffer.  Line numbering based on
            the process window line count is automatically added.
            BUT -- if multiple text buffers are going to be updated,
            always update the process buffer LAST to guarantee the
            line numbering is correct.
            Optionally, text formatting can be applied as well
        """
        while self.setting_scroll:
            dprint("TERMINAL: append() -- self.setting_scroll, waiting 150 ms")
            # wait 150 ms and check again
            time.sleep(0.15)

        <snip>...
        
        if self.term.auto_scroll[num] and num == self.term.current_tab:
            #dprint("TERMINAL: append() -- self.term.vadjustment[], self.term.vhandler_id[]")
            #dprint(self.term.vadjustment)
            #dprint(self.term.vhandler_id)
            self.term.vadjustment[num].handler_block(self.term.vhandler_id[num])
            self.term.view[num].scroll_mark_onscreen(self.term.buffer[num].get_insert())
            self.term.vadjustment[num].handler_unblock(self.term.vhandler_id[num])





-- 
Brian <dol-sen telus net>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]