Changeset 20b228a0 in sasview for sansview/perspectives/fitting


Ignore:
Timestamp:
Feb 14, 2011 3:13:15 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
982e953
Parents:
cb69775
Message:

add bookmark funtionality to toolbar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/basepage.py

    rcadd049e r20b228a0  
    1313from sans.guiframe.events import PanelOnFocusEvent 
    1414from sans.guiframe.events import StatusEvent 
     15from sans.guiframe.events import AppendBookmarkEvent 
    1516import pagestate 
    1617from pagestate import PageState 
     
    155156        self.popUpMenu.AppendItem(self._keep) 
    156157        self._keep.Enable(True) 
     158        self._set_bookmark_flag(False) 
     159        self._set_save_flag(False) 
    157160        wx.EVT_MENU(self, id, self.on_bookmark) 
    158161        self.popUpMenu.AppendSeparator() 
     
    168171        ## drawing Initial dispersion parameters sizer  
    169172        self.set_dispers_sizer() 
    170         self._set_save_flag(True) 
     173         
    171174        ## layout 
    172175        self.set_layout() 
     
    594597        Reset model state 
    595598        """ 
     599        menu = event.GetEventObject() 
    596600        ## post help message for the selected model  
    597         msg = self.popUpMenu.GetHelpString(event.GetId()) 
     601        msg = menu.GetHelpString(event.GetId()) 
    598602        msg +=" reloaded" 
    599         wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 
    600          
    601         name= self.popUpMenu.GetLabel(event.GetId()) 
     603        wx.PostEvent(self.parent.parent, StatusEvent(status=msg)) 
     604         
     605        name = menu.GetLabel(event.GetId()) 
    602606        self._on_select_model_helper() 
    603607         
     
    626630        return new_state   
    627631     
     632    def _get_time_stamp(self): 
     633        """ 
     634        return time and date stings 
     635        """ 
     636        # date and time  
     637        year, month, day,hour,minute,second,tda,ty,tm_isdst= time.localtime() 
     638        current_time= str(hour)+":"+str(minute)+":"+str(second) 
     639        current_date= str( month)+"/"+str(day)+"/"+str(year) 
     640        return current_time, current_date 
     641       
    628642    def on_bookmark(self, event): 
    629643        """ 
     
    638652        ##Add model state on context menu 
    639653        self.number_saved_state += 1 
     654        current_time, current_date = self._get_time_stamp() 
    640655        #name= self.model.name+"[%g]"%self.number_saved_state  
    641         name= self.model.__class__.__name__+"[%g]"%self.number_saved_state  
     656        name = "Fitting: %g]" % self.number_saved_state  
     657        name += self.model.__class__.__name__  
     658        name += "bookmarked at %s on %s" % (current_time, current_date) 
    642659        self.saved_states[name]= new_state 
    643660         
    644661        ## Add item in the context menu 
    645          
    646         year, month, day,hour,minute,second,tda,ty,tm_isdst= time.localtime() 
    647         my_time= str(hour)+" : "+str(minute)+" : "+str(second)+" " 
    648         date= str( month)+"|"+str(day)+"|"+str(year) 
    649         msg=  "Model saved at %s on %s"%(my_time, date) 
     662        msg =  "Model saved at %s on %s"%(current_time, current_date) 
    650663         ## post help message for the selected model  
    651664        msg +=" Saved! right click on this page to retrieve this model" 
    652665        wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 
    653666         
    654         id = wx.NewId() 
    655         self.popUpMenu.Append(id,name,str(msg)) 
    656         wx.EVT_MENU(self, id, self.onResetModel) 
     667        #id = wx.NewId() 
     668        #self.popUpMenu.Append(id,name,str(msg)) 
     669        #wx.EVT_MENU(self, id, self.onResetModel) 
     670        wx.PostEvent(self.parent.parent,  
     671                     AppendBookmarkEvent(title=name,  
     672                                         hint=str(msg), handler=self.onResetModel)) 
    657673         
    658674    def old_on_bookmark(self, event): 
Note: See TracChangeset for help on using the changeset viewer.