]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/frogedit/FrogEditor.py
   4 # Copyright 2001 Adam Feuer and Steve Howell 
  11 from wx
.lib
.editor 
import Editor
 
  13 #--------------------------------------------------------------------- 
  15 class FrogEditor(Editor
): 
  16     def __init__(self
, parent
, id, 
  17                  pos
=wx
.DefaultPosition
, size
=wx
.DefaultSize
, style
=0, statusBar
=None): 
  18         self
.StatusBar 
= statusBar
 
  19         Editor
.__init
__(self
, parent
, id, pos
, size
, style
) 
  22     ##------------------------------------ 
  24     def TouchBuffer(self
): 
  25         Editor
.TouchBuffer(self
) 
  26         self
.StatusBar
.setDirty(1) 
  28     def UnTouchBuffer(self
): 
  29         Editor
.UnTouchBuffer(self
) 
  30         self
.StatusBar
.setDirty(0) 
  33     #--------- utility function ------------- 
  35     # override our base class method 
  36     def DrawCursor(self
, dc 
= None): 
  37         Editor
.DrawCursor(self
,dc
) 
  38         self
.StatusBar
.setRowCol(self
.cy
,self
.cx
) 
  41         lastline 
= self
.sy 
+ self
.sh 
- 1 
  42         return min(lastline
, self
.LinesInFile() - 1) 
  45         return [l
.text 
for l 
in self
.text
] 
  49             self
.ds
.store(self
.page
,self
.rawLines()) 
  51     def SetRawText(self
, rawtext
=""): 
  53         self
.SetText(self
.RenderText()) 
  58     #---------- logging ------------- 
  60     def SetStatus(self
, log
): 
  64     def PrintSeparator(self
, event
): 
  65         self
.Print("..........................") 
  67     def Print(self
, data
): 
  68         self
.status
.append(data
) 
  73     #--------- wxEditor keyboard overrides 
  75     def SetControlFuncs(self
, action
): 
  76         Editor
.SetControlFuncs(self
, action
) 
  77         action
['-'] = self
.PrintSeparator
 
  79     def SetAltFuncs(self
, action
): 
  80         Editor
.SetAltFuncs(self
, action
) 
  81         action
['x'] = self
.Exit
 
  83     #----------- commands ----------- 
  85     def OnCloseWindow(self
, event
): 
  86         # xxx - We don't fully understand how exit logic works. 
  87         # This event is actually called by our parent frame. 
  91         self
.parent
.Close(None)