Changeset 1b69256 in sasview for sansview/perspectives/fitting
- Timestamp:
- Jun 4, 2009 5:01:00 PM (16 years ago)
- 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:
- 7d8094b
- Parents:
- 9c0fe9a5
- Location:
- sansview/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r7437880 r1b69256 72 72 self.qmax_x= 0.13 73 73 self.num_points= 50 74 74 75 ## Create memento to save the current state 75 76 76 self.state= PageState(parent= self.parent,model=self.model, data=self.data) 77 77 ## save customized array … … 82 82 ## dictionary of saved state 83 83 self.saved_states={} 84 self.slicerpop = wx.Menu() 84 85 ## Create context menu for page 86 self.popUpMenu = wx.Menu() 87 id = wx.NewId() 88 self._undo = wx.MenuItem(self.popUpMenu,id, "Undo","cancel the previous action") 89 self.popUpMenu.AppendItem(self._undo) 90 self._undo.Enable(False) 91 wx.EVT_MENU(self, id, self.onUndo) 92 93 id = wx.NewId() 94 self._redo = wx.MenuItem(self.popUpMenu,id,"Redo"," Restore the previous action") 95 self.popUpMenu.AppendItem(self._redo) 96 self._redo.Enable(False) 97 wx.EVT_MENU(self, id, self.onRedo) 98 85 99 ## Default locations 86 100 self._default_save_location = os.getcwd() 87 101 ## save initial state on context menu 88 self.onSave(event=None)102 #self.onSave(event=None) 89 103 self.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenu) 90 104 … … 107 121 pos = event.GetPosition() 108 122 pos = self.ScreenToClient(pos) 109 #TODO: why is the state menu called "slicerpop"? 110 self.PopupMenu(self.slicerpop, pos) 111 112 123 124 self.PopupMenu(self.popUpMenu, pos) 125 126 127 128 def onUndo(self, event): 129 """ 130 Cancel the previous action 131 """ 132 print "enable undo" 133 134 def onRedo(self, event): 135 """ 136 Restore the previous action cancelled 137 """ 138 print "enable redo" 113 139 114 140 def define_page_structure(self): … … 345 371 """ 346 372 ## post help message for the selected model 347 msg = self. slicerpop.GetHelpString(event.GetId())373 msg = self.popUpMenu.GetHelpString(event.GetId()) 348 374 msg +=" reloaded" 349 375 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 350 376 351 name= self. slicerpop.GetLabel(event.GetId())377 name= self.popUpMenu.GetLabel(event.GetId()) 352 378 if name in self.saved_states.keys(): 353 379 previous_state = self.saved_states[name] … … 390 416 391 417 id = wx.NewId() 392 self. slicerpop.Append(id,name,str(msg))418 self.popUpMenu.Append(id,name,str(msg)) 393 419 wx.EVT_MENU(self, id, self.onResetModel) 394 420 … … 581 607 n = self.disp_box.GetCurrentSelection() 582 608 dispersity= self.disp_box.GetClientData(n) 583 609 584 610 self._set_dipers_Param(event=None) 585 611 name= dispersity.__name__ … … 673 699 ## Add item in the context menu 674 700 id = wx.NewId() 675 self. slicerpop.Append(id,name, 'Save model and state %g'%self.number_saved_state)701 self.popUpMenu.Append(id,name, 'Save model and state %g'%self.number_saved_state) 676 702 wx.EVT_MENU(self, id, self.onResetModel) 677 703 … … 703 729 use : _check_value_enter 704 730 """ 731 self._undo.Enable(True) 705 732 if self.model !=None: 706 733 … … 1173 1200 """ 1174 1201 tcrtl= event.GetEventObject() 1202 1175 1203 if check_float(tcrtl): 1176 1204 self._onparamEnter_helper() -
sansview/perspectives/fitting/fitpanel.py
r7437880 r1b69256 8 8 import basepage 9 9 10 class StateContainer(object): 11 """ 12 Contains all saved state of a given page. 13 Provide position of the current state of a page, the first save state 14 and the last state for a given page. 15 Allow easy unoding or redo for a given page 16 """ 17 def __init__(self, page=None): 18 """ 19 Initialize variable 20 """ 21 self.page = page 22 self.begin =0 23 self.current=0 24 self.end=0 25 26 27 10 28 class PageInfo(object): 11 29 """
Note: See TracChangeset
for help on using the changeset viewer.