Changeset 167

Show
Ignore:
Timestamp:
Wed Aug 23 18:05:23 2006
Author:
Brian
Message:

fixed lost aliases bug; added progress display

Files:

Legend:

Unmodified
Added
Removed
Modified
  • server/trunk/update/client/Commit Changes to Server.py

    r166 r167  
    30 30 # 060708 - Some fixes to foreign key corrections  
    31 31 # 060821 - fixes to logic that applies changes from server  
      32 # 060823 - fixed lost aliases bug; added progress display  
    32 33  
    33 34 debug = 1  
     
    180 181             Data.Database[tname] = newkeys  # update tables to use new row ids  
    181 182  
      183         # recreate aliases  <- this shouldn't be hard coded  
      184         Data.Database['Prerequisite'] = Data.Database['Task']  
      185         if Data.Database.has_key('Resource'):  
      186             Data.Database['ResourceGroup'] = Data.Database['Resource']  
      187         if Data.Database.has_key('Measurement'):  
      188             Data.Database['PriorMeasurement'] = Data.Database['Measurement']  
      189      
    182 190         Data.PrepDatabase()  # tables have been replaced, fix short cuts  
    183 191         for k, v in Data.OpenReports.iteritems():  # update report window short cuts to database  
     
    560 568     # save backup of file <- still needed!!!  
    561 569  
      570     max = 100  
      571     dlg = wx.ProgressDialog("Sharing information with server",  
      572                            "Where does this display?",  
      573                            maximum = max,  
      574                            parent=self,  
      575                            style = wx.PD_APP_MODAL  
      576                             # | wx.PD_CAN_ABORT  
      577                             | wx.PD_ELAPSED_TIME  
      578                             #| wx.PD_ESTIMATED_TIME  
      579                             #| wx.PD_REMAINING_TIME  
      580                             )  
      581  
      582     answer = dlg.Update(10, "Getting updates from server")  
      583  
    562 584     if not GetData():  
    563 585         if debug: print "Couldn't get data from server"  
    564 586         # return  
    565 587     else:  # we got the data  
      588         answer = dlg.Update(50, "Sending update to server")  
    566 589         while LocalRowsAdded():  # new report rows (probably)  
    567 590             if debug: print "Local rows added %d" % LocalRowsAdded()  
     
    573 596             # return  
    574 597         else: # we sent the data  
      598             answer = dlg.Update(80, "Updating the display")  
    575 599             pass  
    576       Data.SetUndo("Commit")  # Can't do this until after our changes are sent to the server  
      600     # Data.SetUndo("Commit")  # Can't do this until after our changes are sent to the server  
    576 600                             # PROBLEM - don't want risk adding rows until aftter  
    577 601                             # OK?? Adjusting report rows at the end of GetData  
      602                             # oops. Set undo won't update the display unless it thinks something has changed!  
      603     # not adjusting rows, because that was already done after applying changes from server  
      604     Data.UndoStack = []  
      605     Data.RedoStack = []  
      606     Data.ChangedData = True  # just in case  
      607     Data.ChangedCalendar = True  # force all calculations (just in case)  
      608     Data.Recalculate()  # this also refreshes the reports  
      609  
      610     answer = dlg.Update(100, "Complete")  
      611     dlg.Destroy()  
    578 612  
    579 613     # NOTE - not really undoable, should clear undo stack,  
    580 614     # but setundo is useful to update the reports with the changes  
      615     # BUT only if the change flags were set and the above code doesn't  
    581 616      
    582 617     # save changed file or revert to saved file??