ivoflipse / Pawlabeling

Tool for processing and analyzing pressure measurements
Other
18 stars 1 forks source link

Update current contact doesn't work for the last contact #122

Closed ivoflipse closed 10 years ago

ivoflipse commented 10 years ago

Due to some bound checking of mine, update current contact doesn't seem to be called when we've reached the last contact.

While it shouldn't try to get in an endless loop to reach the next contact, which doesn't exist, it should at least call update_current_contact once.

Perhaps I should even let the index wrap around and go back to zero

ivoflipse commented 10 years ago

Right, I suspected that measurement tree was responsible for updating itself, turns out that processing_widget was doing the updating! Bad, bad, bad!

Anyway, I'm one step closer, but I fear I'll have to refactor a lot of things again to separate these concerns.

ivoflipse commented 10 years ago

I think the culprit was that the loop that updates the tree checks with the model what it should update to. However, updating the model wasn't being done until AFTER the colors were updated. This is probably the result of me refactoring the processing widget to put everything into the model, then forgetting that we're no longer using the processing widget to update itself...

ivoflipse commented 10 years ago

Right, it was even worse, my terribly hacky previous_contact and next_contact were preventing it from updating if it reached the first or last (by incrementing/decrementing). So now I've made them wrap around, such that going one beyond the end will make you jump back to the beginning.

Careful though that you don't keep labeling beyond the end! ;-)