Re: SpinButton: how to avoid calling signal handler when set_value()



Il Wed, 2 Nov 2016 00:09:29 +0100 pozzugno <pozzugno gmail com> scrisse:

...
A simple and clear sequence of instructions:

   _set_value()
   _set_value()
   ..

will be transformed in a complex, long and cryptic sequence of 
instructions:

   _block()
   _set_value()
   _unblock()
   _block()
   _set_value()
   _unblock()

Hi,

I hope you are missing some fundamental detail because this is a
non-problem.

    _my_set_value()
        _block()
        _set_value()
        _unblock

    _my_set_value()
    _my_set_value()

I hoped there was another better solution. Actually I'm using a flag 
that is checked in the handler:

   refreshing = True
   _set_value()
   _set_value()
   ...
   refreshing = False

This is not equivalent to what you wrote above. This is (roughly)
equivalent to:

    _block()
    _set_value()
    _set_value()
    ...
    _unblock()

A minimal test case exposing the problem would be much clearer.

Ciao.
-- 
Nicola


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