On 8/30/11 11:53 AM, Jacek Kałucki wrote:
> Użytkownik Paul McNett napisał:
>> I think that sounds reasonable.
>
> We can modify dForm.confirmChanges() method by adding "abandonChanges=False" 
> parameter.
> But there is possible code interference because after confirmChanges call,
> developer beforeCancel method is called.

Clarification on the performance problem:

If I close the form, and there are changes, it takes about 3 seconds to even 
get the 
"Save Changes?" prompt. Then, whether I answer yes or no, the form closes 
almost 
instantly.

It strikes me that we should be able to optimize the question "is there at 
least one 
change?" (or, alternatively, "are there zero changes?") versus "show me all the 
changed rows".

biz.isAnyChanged() could probably be rewritten like:

See r6807  which I just committed, which adds a biz._isAnyChanged() proposed 
replacement for isAnyChanged(). It doesn't scan() anything, it merely iterates 
the 
__cursors dict and calls isChanged() on each of those, returning True as soon 
as a 
change is found.

Sure, there's still a lot of iteration for a large hierarchy, but no extra code 
is 
being run to find out the answer to the question being asked, plus we return 
True 
immediately when we find the first changed record, and we look from top-down.

My quick testing shows completely acceptable results using my real test data in 
a 
large bizobj hierarchy. 1/4 second to find no changes where I'm currently 
waiting 3+ 
seconds for that same answer with the status quo.

To test what I mean, change dabo/dabo/ui/uiwx/dForm.py #162 to:
      if biz and biz._isAnyChanged():

It is totally rocking now. The only thing wrong still with this is if I answer 
'no' 
to 'save changes?': the cancelAll() takes a couple seconds.

Paul


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to