Changeset 1268
- Timestamp:
- 04/17/08 22:07:51 (7 months ago)
- Location:
- trunk/peppy
- Files:
-
- 2 modified
-
actions/minibuffer.py (modified) (1 diff)
-
plugins/find_replace.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/peppy/actions/minibuffer.py
r1266 r1268 96 96 self.win.SetFocus() 97 97 98 def closePreHook(self): 99 """Hook called when minibuffer is about to be closed to allow it to 100 save any persistent data. 101 """ 102 pass 103 98 104 def close(self): 99 105 """ 100 106 Destroy the minibuffer widgets. 101 107 """ 108 self.closePreHook() 102 109 self.win.Destroy() 103 110 self.win=None -
trunk/peppy/plugins/find_replace.py
r1265 r1268 26 26 backward = "Find Backward" 27 27 28 def __init__(self, parent, frame, stc, initial='', direction=1):28 def __init__(self, parent, frame, stc, storage=None, direction=1): 29 29 wx.Panel.__init__(self, parent, style=wx.NO_BORDER|wx.TAB_TRAVERSAL) 30 30 self.frame = frame 31 31 self.stc = stc 32 if isinstance(storage, dict): 33 self.storage = storage 34 else: 35 self.storage = {} 32 36 33 37 sizer = wx.BoxSizer(wx.HORIZONTAL) … … 46 50 self.text.Bind(wx.EVT_TEXT_ENTER, self.OnEnter) 47 51 self.text.Bind(wx.EVT_TEXT, self.OnChar) 48 49 if initial:50 self.text.ChangeValue(initial)51 52 52 53 def setDirection(self, dir=1): … … 186 187 self.OnNotFound() 187 188 188 189 def repeat(self, direction): 190 if not self.getSearchString(): 191 if 'last_search' in self.storage: 192 self.text.ChangeValue(self.storage['last_search']) 193 self.text.SetInsertionPointEnd() 194 return 195 196 if direction < 0: 197 self.setDirection(-1) 198 self.OnFindP(None) 199 else: 200 self.setDirection(1) 201 self.OnFindN(None) 202 203 def saveState(self): 204 last = self.getSearchString() 205 if last: 206 self.storage['last_search'] = last 189 207 190 208 … … 193 211 Adapter for PyPE findbar. Maps findbar callbacks to our stuff. 194 212 """ 213 search_storage = {} 214 195 215 def createWindow(self): 196 216 # Create the find bar widget. … … 199 219 else: 200 220 dir = 1 201 self.win = FindBar(self.mode.wrapper, self.mode.frame, self.mode, direction=dir)221 self.win = FindBar(self.mode.wrapper, self.mode.frame, self.mode, self.search_storage, direction=dir) 202 222 203 223 def repeat(self, action): … … 205 225 dprint(action) 206 226 if action.__class__ == FindPrevText: 207 self.win.setDirection(-1) 208 self.win.OnFindP(None) 209 else: 210 self.win.setDirection(1) 211 self.win.OnFindN(None) 227 self.win.repeat(-1) 228 else: 229 self.win.repeat(1) 212 230 213 231 def focus(self): … … 215 233 # to the text ctrl or combo box of the pype findbar. 216 234 self.win.text.SetFocus() 235 236 def closePreHook(self): 237 self.win.saveState() 238 self.dprint(self.search_storage) 217 239 218 240
