]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/frogedit/FrogEditor.py
4 # Copyright 2001 Adam Feuer and Steve Howell
9 from wxPython
.wx
import *
10 from wxPython
.lib
.editor
import wxEditor
12 #---------------------------------------------------------------------
14 class FrogEditor(wxEditor
):
15 def __init__(self
, parent
, id,
16 pos
=wxDefaultPosition
, size
=wxDefaultSize
, style
=0, statusBar
=None):
17 self
.StatusBar
= statusBar
18 wxEditor
.__init
__(self
, parent
, id, pos
, size
, style
)
21 ##------------------------------------
23 def TouchBuffer(self
):
24 wxEditor
.TouchBuffer(self
)
25 self
.StatusBar
.setDirty(1)
27 def UnTouchBuffer(self
):
28 wxEditor
.UnTouchBuffer(self
)
29 self
.StatusBar
.setDirty(0)
32 #--------- utility function -------------
34 # override our base class method
35 def DrawCursor(self
, dc
= None):
36 wxEditor
.DrawCursor(self
,dc
)
37 self
.StatusBar
.setRowCol(self
.cy
,self
.cx
)
40 lastline
= self
.sy
+ self
.sh
- 1
41 return min(lastline
, self
.LinesInFile() - 1)
44 return [l
.text
for l
in self
.text
]
48 self
.ds
.store(self
.page
,self
.rawLines())
50 def SetRawText(self
, rawtext
=""):
52 self
.SetText(self
.RenderText())
57 #---------- logging -------------
59 def SetStatus(self
, log
):
63 def PrintSeparator(self
, event
):
64 self
.Print("..........................")
66 def Print(self
, data
):
67 self
.status
.append(data
)
72 #--------- wxEditor keyboard overrides
74 def SetControlFuncs(self
, action
):
75 wxEditor
.SetControlFuncs(self
, action
)
76 action
['-'] = self
.PrintSeparator
78 def SetAltFuncs(self
, action
):
79 wxEditor
.SetAltFuncs(self
, action
)
80 action
['x'] = self
.Exit
82 #----------- commands -----------
84 def OnCloseWindow(self
, event
):
85 # xxx - We don't fully understand how exit logic works.
86 # This event is actually called by our parent frame.
90 self
.parent
.Close(None)