| 625 |
|
if not GetData():
|
| 626 |
|
if debug: print "Couldn't get data from server"
|
| 627 |
|
# return
|
| 628 |
|
else: # we got the data
|
| 629 |
|
answer = dlg.Update(50, "Sending update to server")
|
| 630 |
|
while LocalRowsAdded(): # new report rows (probably)
|
| 631 |
|
if debug: print "Local rows added %d" % LocalRowsAdded()
|
| 632 |
|
if not GetData(): # repeat until we don't add any more rows in response to server
|
| 633 |
|
if debug: print "Couldn't get data on repeat"
|
| 634 |
|
return
|
| 635 |
|
if not SendData():
|
| 636 |
|
if debug: print "Couldn't send data to server"
|
| |
632 |
if not GetData():
|
| |
633 |
if debug: print "Couldn't get data from server"
|
| 638 |
|
else: # we sent the data
|
| 639 |
|
answer = dlg.Update(80, "Updating the display")
|
| 640 |
|
pass
|
| 641 |
|
# Data.SetUndo("Commit") # Can't do this until after our changes are sent to the server
|
| 642 |
|
# PROBLEM - don't want risk adding rows until aftter
|
| 643 |
|
# OK?? Adjusting report rows at the end of GetData
|
| 644 |
|
# oops. Set undo won't update the display unless it thinks something has changed!
|
| 645 |
|
# not adjusting rows, because that was already done after applying changes from server
|
| |
635 |
else: # we got the data
|
| |
636 |
save_server_prior = server_prior_nextid.copy() # save original server prior (set by GetData)
|
| |
637 |
repeatcount = 0
|
| |
638 |
answer = dlg.Update(50, "Sending update to server")
|
| |
639 |
while LocalRowsAdded(): # new report rows (probably)
|
| |
640 |
repeatcount += 1
|
| |
641 |
if repeatcount > 10: print "repeatcount = 10"; return
|
| |
642 |
if debug: print "Local rows added %d" % LocalRowsAdded()
|
| |
643 |
if not GetData(): # repeat until we don't add any more rows in response to server
|
| |
644 |
if debug: print "Couldn't get data on repeat"
|
| |
645 |
return
|
| |
646 |
server_prior_nextid = save_server_prior # use the values set by first GetData
|
| |
647 |
if not SendData():
|
| |
648 |
if debug: print "Couldn't send data to server"
|
| |
649 |
# return
|
| |
650 |
else: # we sent the data
|
| |
651 |
answer = dlg.Update(80, "Updating the display")
|
| |
652 |
pass
|
| |
653 |
# Data.SetUndo("Commit") # Can't do this until after our changes are sent to the server
|
| |
654 |
# PROBLEM - don't want risk adding rows until aftter
|
| |
655 |
# OK?? Adjusting report rows at the end of GetData
|
| |
656 |
# oops. Set undo won't update the display unless it thinks something has changed!
|
| |
657 |
# not adjusting rows, because that was already done after applying changes from server
|
| |
658 |
|
| |
659 |
finally:
|
| |
660 |
answer = dlg.Update(100, "Complete")
|
| |
661 |
dlg.Destroy()
|
| |
662 |
|
| |
663 |
if debug: print "start final clean up"
|