Added wxEditor from Dirc Holtwic
Some tweaks and fixes Some distrib updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
a5e3f3e9fa
commit
1b55cabf50
@ -37,7 +37,7 @@ below.)
|
|||||||
You can use whatever flags you want, but these work for me.
|
You can use whatever flags you want, but these work for me.
|
||||||
|
|
||||||
For Win32 systems I use Visual C++ 6.0, but 5.0 should work. The
|
For Win32 systems I use Visual C++ 6.0, but 5.0 should work. The
|
||||||
build utility currently does not support any other win32
|
wxPython build utility currently does not support any other win32
|
||||||
compilers. Be sure to copy include/wx/msw/setup0.h to
|
compilers. Be sure to copy include/wx/msw/setup0.h to
|
||||||
include/wx/msw/setup.h and edit it for the options you want.
|
include/wx/msw/setup.h and edit it for the options you want.
|
||||||
|
|
||||||
@ -46,13 +46,14 @@ below.)
|
|||||||
variable named WXWIN to be the path to the top of the wxWindows
|
variable named WXWIN to be the path to the top of the wxWindows
|
||||||
tree.
|
tree.
|
||||||
|
|
||||||
|
|
||||||
3. If you are working from a copy of the code retrieved from CVS, then
|
3. If you are working from a copy of the code retrieved from CVS, then
|
||||||
you will find wxPython in $WXWIN/utils/wxPython. If you are
|
you will find wxPython in $WXWIN/utils/wxPython. If you are
|
||||||
working from the tar.gz or .zip files then you will probably want
|
working from the tar.gz or .zip files then you will probably want
|
||||||
to unpack wxPython in the $WXWIN/utils directory and rename the new
|
to unpack wxPython in the $WXWIN/utils directory and rename the new
|
||||||
directory to wxPython (or use a symlink.) If you want to keep it
|
directory to wxPython (or use a symlink.) If you want to keep it
|
||||||
in a separate directory then you can change where the build.py tool
|
in a separate directory then you can change where the build.py tool
|
||||||
expects to find it by creating a file named build.local (see step 6
|
expects to find it by creating a file named build.local (see step 7
|
||||||
for more examples about build.local,) containing something like
|
for more examples about build.local,) containing something like
|
||||||
this:
|
this:
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ below.)
|
|||||||
|
|
||||||
|
|
||||||
4. At this point you may want to make an alias or symlink, script,
|
4. At this point you may want to make an alias or symlink, script,
|
||||||
batch file, whatever on the PATH that invokes
|
batch file, or whatever on the PATH that invokes
|
||||||
$WXWIN/utils/wxPython/distrib/build.py to help simplify matters
|
$WXWIN/utils/wxPython/distrib/build.py to help simplify matters
|
||||||
somewhat. For example, on my win32 system I have a file named
|
somewhat. For example, on my win32 system I have a file named
|
||||||
build.bat in a directory on the PATH that contains:
|
build.bat in a directory on the PATH that contains:
|
||||||
@ -71,16 +72,25 @@ below.)
|
|||||||
5. Change into the $(WXWIN)/utils/wxPython/src directory.
|
5. Change into the $(WXWIN)/utils/wxPython/src directory.
|
||||||
|
|
||||||
|
|
||||||
6. Type "build -b" to build wxPython and "build -i" to install it.
|
6. If you don't use SWIG, or have a new enough version installed, you
|
||||||
|
may have to update the timestamps of the files it generates so the
|
||||||
|
make utility won't think they are out of date and try to run SWIG
|
||||||
|
to update them. The standard touch utility can do this for you:
|
||||||
|
|
||||||
|
touch gtk/*.cpp gtk/*.py
|
||||||
|
|
||||||
|
|
||||||
|
7. Type "build -b" to build wxPython and "build -i" to install it.
|
||||||
|
|
||||||
The build.py script actually generates a Makefile based on what it
|
The build.py script actually generates a Makefile based on what it
|
||||||
finds on your system and information found in the build.cfg file.
|
finds on your system and information found in the build.cfg file.
|
||||||
If you have troubles building or you want it built or installed in
|
If you have troubles building or you want it built or installed in
|
||||||
a different way, take a look at the docstring in build.py. You may
|
a different way, take a look at the docstring in build.py. You may
|
||||||
be able to override configuration options in a file named
|
be able to override configuration options in a file named
|
||||||
build.local. For example, you can set a new TARGETDIR just by
|
build.local. For example, you can set a new TARGETDIR (the
|
||||||
creating a file named build.local in your wxPython source directory
|
installation directory) just by creating a file named build.local
|
||||||
and assign a value to it, like this:
|
in your wxPython source directory and assign a value to it, like
|
||||||
|
this:
|
||||||
|
|
||||||
TARGETDIR = "/usr/local/lib/python1.5/site-packages/wxPython"
|
TARGETDIR = "/usr/local/lib/python1.5/site-packages/wxPython"
|
||||||
|
|
||||||
@ -88,20 +98,23 @@ below.)
|
|||||||
creative things there if you need to.
|
creative things there if you need to.
|
||||||
|
|
||||||
|
|
||||||
7. To build and install the add-on modules, change to the appropriate
|
8. To build and install the add-on modules, change to the appropriate
|
||||||
directory under $WXWIN/utils/wxPython/modules and run the build
|
directory under $WXWIN/utils/wxPython/modules and run the build
|
||||||
utility again.
|
utility again.
|
||||||
|
|
||||||
|
|
||||||
8. Change to the $WXWIN/utils/wxPython/demo directory.
|
9. Change to the $WXWIN/utils/wxPython/demo directory.
|
||||||
|
|
||||||
|
|
||||||
9. Try executing the demo program. For example:
|
10. Try executing the demo program. For example:
|
||||||
|
|
||||||
python demo.py
|
python demo.py
|
||||||
|
|
||||||
To run it without requiring a console on win32, you can use the
|
To run it without requiring a console on win32, you can use the
|
||||||
pythonw.exe version of Python either from the command line or from a
|
pythonw.exe version of Python either from the command line or from
|
||||||
shortcut.
|
a shortcut.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,6 +72,9 @@ http://starship.python.net:9673/crew/da/Code/PyOpenGL.
|
|||||||
|
|
||||||
Added some missing EVT_ functions.
|
Added some missing EVT_ functions.
|
||||||
|
|
||||||
|
Added Dirk Holtwic's editor classes to the wxPython.lib.editor
|
||||||
|
package.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ _useNestedSplitter = true
|
|||||||
_treeList = [
|
_treeList = [
|
||||||
('New since last release', ['wxMVCTree', 'wxVTKRenderWindow',
|
('New since last release', ['wxMVCTree', 'wxVTKRenderWindow',
|
||||||
'FileBrowseButton', 'GenericButtons',
|
'FileBrowseButton', 'GenericButtons',
|
||||||
'wxMask']),
|
'wxMask', 'wxEditor']),
|
||||||
|
|
||||||
('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
|
('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ _treeList = [
|
|||||||
('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
|
('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
|
||||||
'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
|
'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
|
||||||
'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
|
'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
|
||||||
'FileBrowseButton', 'GenericButtons']),
|
'FileBrowseButton', 'GenericButtons', 'wxEditor']),
|
||||||
|
|
||||||
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
|
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
|
||||||
|
|
||||||
|
42
utils/wxPython/demo/wxEditor.py
Normal file
42
utils/wxPython/demo/wxEditor.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
from wxPython.wx import *
|
||||||
|
from wxPython.lib.editor import wxEditor, wxPyEditor
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def runTest(frame, nb, log):
|
||||||
|
win = wxPanel(nb, -1)
|
||||||
|
ed = wxEditor(win)
|
||||||
|
pyed = wxPyEditor(win)
|
||||||
|
box = wxBoxSizer(wxVERTICAL)
|
||||||
|
box.Add(ed, 1, wxALL|wxGROW, 5)
|
||||||
|
box.Add(pyed, 1, wxALL|wxGROW, 5)
|
||||||
|
win.SetSizer(box)
|
||||||
|
win.SetAutoLayout(true)
|
||||||
|
|
||||||
|
ed.SetText(["",
|
||||||
|
"This is a simple text editor, the class name is",
|
||||||
|
"wxEditor. Type a few lines and try it out."])
|
||||||
|
|
||||||
|
pyed.SetText(["# This one is a derived class named wxPyEditor.",
|
||||||
|
"# It adds syntax highlighting, folding (press",
|
||||||
|
"# F12 on the \"def\" line below) and other stuff.",
|
||||||
|
"import sys",
|
||||||
|
"def hello():",
|
||||||
|
" print 'hello'",
|
||||||
|
" for x in sys.path:",
|
||||||
|
" print x",
|
||||||
|
""])
|
||||||
|
return win
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overview = """\
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -17,24 +17,24 @@ class TestFloatBar(wxFrame):
|
|||||||
tb.SetFloatable(1)
|
tb.SetFloatable(1)
|
||||||
tb.SetTitle("Floating!")
|
tb.SetTitle("Floating!")
|
||||||
self.CreateStatusBar()
|
self.CreateStatusBar()
|
||||||
tb.AddTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP),
|
tb.AddSimpleTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP),
|
||||||
wxNullBitmap, false, -1, -1, "New", "Long help for 'New'")
|
"New", "Long help for 'New'")
|
||||||
EVT_TOOL(self, 10, self.OnToolClick)
|
EVT_TOOL(self, 10, self.OnToolClick)
|
||||||
EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
|
EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
|
||||||
|
|
||||||
tb.AddTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP),
|
tb.AddSimpleTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP),
|
||||||
wxNullBitmap, false, -1, -1, "Open")
|
"Open")
|
||||||
EVT_TOOL(self, 20, self.OnToolClick)
|
EVT_TOOL(self, 20, self.OnToolClick)
|
||||||
EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
|
EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
|
||||||
|
|
||||||
tb.AddSeparator()
|
tb.AddSeparator()
|
||||||
tb.AddTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP),
|
tb.AddSimpleTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP),
|
||||||
wxNullBitmap, false, -1, -1, "Copy")
|
"Copy")
|
||||||
EVT_TOOL(self, 30, self.OnToolClick)
|
EVT_TOOL(self, 30, self.OnToolClick)
|
||||||
EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
|
EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
|
||||||
|
|
||||||
tb.AddTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP),
|
tb.AddSimpleTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP),
|
||||||
wxNullBitmap, false, -1, -1, "Paste")
|
"Paste")
|
||||||
EVT_TOOL(self, 40, self.OnToolClick)
|
EVT_TOOL(self, 40, self.OnToolClick)
|
||||||
EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
|
EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
|
||||||
|
|
||||||
@ -42,8 +42,8 @@ class TestFloatBar(wxFrame):
|
|||||||
|
|
||||||
|
|
||||||
tb.AddTool(60, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
tb.AddTool(60, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
||||||
wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP),
|
wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP),
|
||||||
true, -1, -1, "Toggle with 2 bitmaps")
|
shortHelpString="Toggle with 2 bitmaps", toggle=true)
|
||||||
EVT_TOOL(self, 60, self.OnToolClick)
|
EVT_TOOL(self, 60, self.OnToolClick)
|
||||||
EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick)
|
EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick)
|
||||||
tb.Realize()
|
tb.Realize()
|
||||||
|
164
utils/wxPython/distrib/autobuild.py
Normal file
164
utils/wxPython/distrib/autobuild.py
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import sys, os, string, time
|
||||||
|
from ftplib import FTP
|
||||||
|
|
||||||
|
|
||||||
|
logfile = 'e:\\temp\\autobuild.log'
|
||||||
|
WXDIR = os.environ['WXWIN']
|
||||||
|
dllVer = '21_11'
|
||||||
|
wxpVer = '2.1.11'
|
||||||
|
dateSt = time.strftime("%Y%m%d", time.localtime(time.time()))
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def do(cmd):
|
||||||
|
st = " " + cmd + " >> " + logfile
|
||||||
|
print st
|
||||||
|
f = open(logfile, "at")
|
||||||
|
f.write(st + '\n')
|
||||||
|
f.close()
|
||||||
|
os.system(cmd + " >>& " + logfile)
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def logTruncate():
|
||||||
|
f = open(logfile, "wt")
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
def logSeparator(msg=None, f=None, recurse=1):
|
||||||
|
if not f:
|
||||||
|
f = open(logfile, "at")
|
||||||
|
f.write('\n')
|
||||||
|
f.write('--' * 35)
|
||||||
|
f.write('\n')
|
||||||
|
if msg:
|
||||||
|
f.write(msg)
|
||||||
|
f.write('\n')
|
||||||
|
f.write('--' * 35)
|
||||||
|
f.write('\n')
|
||||||
|
if recurse:
|
||||||
|
logSeparator(msg, sys.stdout, 0)
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def validateFile(file):
|
||||||
|
if not os.path.exists(file):
|
||||||
|
logSeparator("***** %s does not exist, exiting! *****" % file)
|
||||||
|
raise SystemExit
|
||||||
|
else:
|
||||||
|
logSeparator("%s found, continuing..." % file, recurse=0)
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def main():
|
||||||
|
logTruncate()
|
||||||
|
|
||||||
|
try:
|
||||||
|
logSeparator("Cleanup")
|
||||||
|
os.chdir(WXDIR + '/src/msw')
|
||||||
|
do('make cleandll FINAL=1')
|
||||||
|
os.chdir(WXDIR + '/utils/ogl/src')
|
||||||
|
do('wxm clean FINAL=1')
|
||||||
|
os.chdir(WXDIR + '/utils/glcanvas/win')
|
||||||
|
do('wxm clean FINAL=1')
|
||||||
|
|
||||||
|
logSeparator("Building Documentation...")
|
||||||
|
os.chdir(WXDIR + '/src/msw')
|
||||||
|
do('make touchmanual htmlhelp')
|
||||||
|
validateFile(WXDIR + '/docs/html/wx/wx.chm')
|
||||||
|
|
||||||
|
logSeparator("Building wxWindows and libraries...")
|
||||||
|
os.chdir(WXDIR + '/src/msw')
|
||||||
|
do('make dll pch FINAL=1')
|
||||||
|
validateFile(WXDIR + '/lib/wx'+dllVer+'.dll')
|
||||||
|
|
||||||
|
os.chdir(WXDIR + '/utils/ogl/src')
|
||||||
|
do('wxm FINAL=1')
|
||||||
|
os.chdir(WXDIR + '/utils/glcanvas/win')
|
||||||
|
do('wxm FINAL=1')
|
||||||
|
validateFile(WXDIR + '/lib/ogl.lib')
|
||||||
|
validateFile(WXDIR + '/lib/glcanvas.lib')
|
||||||
|
|
||||||
|
|
||||||
|
logSeparator("Copying wxPython workspace to build directory...")
|
||||||
|
do("copy /s %s %s" % ('e:\\projects\\wxPython\*.*', WXDIR+'\\utils\\wxPython'))
|
||||||
|
os.chdir(WXDIR + '/utils/wxPython')
|
||||||
|
f = open("build.local", "w")
|
||||||
|
f.write("""
|
||||||
|
TARGETDIR = 'e:\\projects\\wx\\utils\\wxPython'
|
||||||
|
WXPSRCDIR = 'e:\\projects\\wx\\utils\\wxPython\\src'
|
||||||
|
CRTFLAG='/MD'
|
||||||
|
FINAL=1
|
||||||
|
""")
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
logSeparator("Cleaning wxPython...")
|
||||||
|
os.chdir(WXDIR+'\\utils\\wxPython')
|
||||||
|
do("buildall -cu")
|
||||||
|
do("ll")
|
||||||
|
|
||||||
|
|
||||||
|
logSeparator("Building core wxPython...")
|
||||||
|
os.chdir(WXDIR+'\\utils\\wxPython\\src')
|
||||||
|
do("build -bi")
|
||||||
|
validateFile(WXDIR+'\\utils\\wxPython\\wxc.pyd')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
logSeparator("Building wxPython addon modules...")
|
||||||
|
os.chdir(WXDIR+'\\utils\\wxPython\\modules')
|
||||||
|
do("buildall -bi")
|
||||||
|
validateFile(WXDIR+'\\utils\\wxPython\\utilsc.pyd')
|
||||||
|
validateFile(WXDIR+'\\utils\\wxPython\\htmlc.pyd')
|
||||||
|
validateFile(WXDIR+'\\utils\\wxPython\\glcanvasc.pyd')
|
||||||
|
validateFile(WXDIR+'\\utils\\wxPython\\oglc.pyd')
|
||||||
|
|
||||||
|
|
||||||
|
logSeparator("Building installer executable...")
|
||||||
|
os.chdir(WXDIR+'\\utils\\wxPython\\distrib')
|
||||||
|
do("autoit2 wise.aut")
|
||||||
|
srcName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-'+wxpVer+'.EXE'
|
||||||
|
destName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-'+wxpVer+'-'+dateSt+'.EXE'
|
||||||
|
validateFile(srcName)
|
||||||
|
try:
|
||||||
|
os.rename(srcName, destName)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
logSeparator("Building source zip file...")
|
||||||
|
os.chdir(WXDIR+'\\utils')
|
||||||
|
do("wxPython\\distrib\\zipit.bat %s" % wxpVer)
|
||||||
|
srcZName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-src-'+wxpVer+'.zip'
|
||||||
|
destZName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-src-'+wxpVer+'-'+dateSt+'.zip'
|
||||||
|
validateFile(srcZName)
|
||||||
|
try:
|
||||||
|
os.rename(srcZName, destZName)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
logSeparator("Uploading to website...")
|
||||||
|
do('python d:\util32\sendwxp.py %s' % destName)
|
||||||
|
do('python d:\util32\sendwxp.py %s' % destZName)
|
||||||
|
os.unlink(destName)
|
||||||
|
os.unlink(destZName)
|
||||||
|
|
||||||
|
|
||||||
|
logSeparator("Finished!!!")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
os.system("list " + logfile)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
7
utils/wxPython/distrib/wise.aut
Normal file
7
utils/wxPython/distrib/wise.aut
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
run, e:\\Tools\\Wise\\WISE32.EXE wxPython.wse
|
||||||
|
winwaitactive, wxPython.wse - Wise Installation System
|
||||||
|
send, !ic
|
||||||
|
sleep, 1000
|
||||||
|
winwaitactive, wxPython.wse - Wise Installation System
|
||||||
|
send, !fx
|
@ -18,6 +18,8 @@ wxPython/lib/*.py
|
|||||||
wxPython/lib/*.txt
|
wxPython/lib/*.txt
|
||||||
wxPython/lib/sizers/*.py
|
wxPython/lib/sizers/*.py
|
||||||
wxPython/lib/sizers/*.txt
|
wxPython/lib/sizers/*.txt
|
||||||
|
wxPython/lib/editor/*.py
|
||||||
|
wxPython/lib/editor/*.txt
|
||||||
|
|
||||||
|
|
||||||
wxPython/src/build.cfg
|
wxPython/src/build.cfg
|
||||||
|
@ -849,6 +849,12 @@ item: Install File
|
|||||||
Description=wxPython Standard Library
|
Description=wxPython Standard Library
|
||||||
Flags=0000000010000010
|
Flags=0000000010000010
|
||||||
end
|
end
|
||||||
|
item: Install File
|
||||||
|
Source=e:\Projects\wx\utils\wxPython\lib\editor\*.py
|
||||||
|
Destination=%MAINDIR%\wxPython\lib\editor
|
||||||
|
Description=wxPython Standard Library
|
||||||
|
Flags=0000000010000010
|
||||||
|
end
|
||||||
item: Install File
|
item: Install File
|
||||||
Source=e:\Projects\wx\utils\wxPython\demo\*.py
|
Source=e:\Projects\wx\utils\wxPython\demo\*.py
|
||||||
Destination=%MAINDIR%\wxPython\demo
|
Destination=%MAINDIR%\wxPython\demo
|
||||||
@ -1133,6 +1139,20 @@ item: Create Shortcut
|
|||||||
Key Type=1536
|
Key Type=1536
|
||||||
Flags=00000001
|
Flags=00000001
|
||||||
end
|
end
|
||||||
|
item: Create Shortcut
|
||||||
|
Source=%MAINDIR%\wxPython\README.txt
|
||||||
|
Destination=%CGROUPDIR%\%CGROUP_SAVE%\ReadMe.lnk
|
||||||
|
Icon Number=0
|
||||||
|
Key Type=1536
|
||||||
|
Flags=00000001
|
||||||
|
end
|
||||||
|
item: Create Shortcut
|
||||||
|
Source=%MAINDIR%\wxPython\CHANGES.txt
|
||||||
|
Destination=%CGROUPDIR%\%CGROUP_SAVE%\Changes.lnk
|
||||||
|
Icon Number=0
|
||||||
|
Key Type=1536
|
||||||
|
Flags=00000001
|
||||||
|
end
|
||||||
item: Create Shortcut
|
item: Create Shortcut
|
||||||
Source=%UNINSTALL_PATH%
|
Source=%UNINSTALL_PATH%
|
||||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\Uninstall %APPTITLE%.lnk
|
Destination=%CGROUPDIR%\%CGROUP_SAVE%\Uninstall %APPTITLE%.lnk
|
||||||
|
Binary file not shown.
4
utils/wxPython/lib/editor/.cvsignore
Normal file
4
utils/wxPython/lib/editor/.cvsignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
__init__.pyc
|
||||||
|
editor.pyc
|
||||||
|
py_editor.pyc
|
||||||
|
tokenizer.pyc
|
18
utils/wxPython/lib/editor/__init__.py
Normal file
18
utils/wxPython/lib/editor/__init__.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Name: wxPython.lib.editor
|
||||||
|
# Purpose: A package containing a colourizable text editror
|
||||||
|
#
|
||||||
|
# Author: Robin Dunn
|
||||||
|
#
|
||||||
|
# Created: 30-Dec-1999
|
||||||
|
# RCS-ID: $Id$
|
||||||
|
# Copyright: (c) 1999 by Total Control Software
|
||||||
|
# Licence: wxWindows license
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# This file makes this directory into a Python package
|
||||||
|
|
||||||
|
|
||||||
|
# import the main classes into the package namespace.
|
||||||
|
from editor import wxEditor
|
||||||
|
from py_editor import wxPyEditor
|
619
utils/wxPython/lib/editor/editor.py
Normal file
619
utils/wxPython/lib/editor/editor.py
Normal file
@ -0,0 +1,619 @@
|
|||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Name: wxPython.lib.editor.wxEditor
|
||||||
|
# Purpose: An intelligent text editor with colorization capabilities.
|
||||||
|
#
|
||||||
|
# Author: Dirk Holtwic, Robin Dunn
|
||||||
|
#
|
||||||
|
# Created: 15-Dec-1999
|
||||||
|
# RCS-ID: $Id$
|
||||||
|
# Copyright: (c) 1999 by Dirk Holtwick, 1999
|
||||||
|
# Licence: wxWindows license
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
from wxPython.wx import *
|
||||||
|
from string import *
|
||||||
|
from keyword import *
|
||||||
|
from regsub import *
|
||||||
|
from tokenizer import *
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#EDITOR_STD_LINE = ("", [], (0,0,0))
|
||||||
|
|
||||||
|
#---------
|
||||||
|
|
||||||
|
class Line:
|
||||||
|
def __init__(self, text=""):
|
||||||
|
self.text = text # the string itself
|
||||||
|
self.syntax = [] # the colors of the line
|
||||||
|
self.editable = true # edit?
|
||||||
|
self.visible = 0 # will be incremented if not
|
||||||
|
self.indent = 0 # not used yet
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxEditor(wxScrolledWindow):
|
||||||
|
|
||||||
|
def __init__(self, parent, id=-1):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Alles hat einen Anfang
|
||||||
|
"""
|
||||||
|
|
||||||
|
wxScrolledWindow.__init__(self, parent, id,
|
||||||
|
wxDefaultPosition, wxSize(500,400),
|
||||||
|
wxSUNKEN_BORDER|wxWANTS_CHARS)
|
||||||
|
|
||||||
|
# the syntax informations, if they don't exist,
|
||||||
|
# all syntax stuff will be ignored
|
||||||
|
|
||||||
|
# cursor pos
|
||||||
|
self.cx = 0
|
||||||
|
self.cy = 0
|
||||||
|
|
||||||
|
# the lines that are visible
|
||||||
|
self.lines = []
|
||||||
|
self.line = 0
|
||||||
|
self.len = 0
|
||||||
|
|
||||||
|
self.ocy = 0
|
||||||
|
|
||||||
|
# border pos
|
||||||
|
#self.bx = 0
|
||||||
|
#self.by = 0
|
||||||
|
|
||||||
|
# screen
|
||||||
|
self.sx = 0
|
||||||
|
self.sy = 0
|
||||||
|
self.sw = 0
|
||||||
|
self.sh = 0
|
||||||
|
|
||||||
|
# font
|
||||||
|
dc = wxClientDC(self)
|
||||||
|
|
||||||
|
#if wxPlatform == "__WXMSW__":
|
||||||
|
self.font = wxFont(12, wxMODERN, wxNORMAL, wxNORMAL)
|
||||||
|
#else:
|
||||||
|
# self.font = wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, false)
|
||||||
|
dc.SetFont(self.font)
|
||||||
|
|
||||||
|
# font weight, height
|
||||||
|
self.fw = dc.GetCharWidth()
|
||||||
|
self.fh = dc.GetCharHeight()
|
||||||
|
|
||||||
|
# back, for colour
|
||||||
|
self.bcol = wxNamedColour('white')
|
||||||
|
self.fcol = wxNamedColour('black')
|
||||||
|
|
||||||
|
self.cfcol = wxNamedColour('black')
|
||||||
|
self.cbcol = wxNamedColour('red')
|
||||||
|
|
||||||
|
# nicht edierbare zeile (hintergrund)
|
||||||
|
self.nedcol = wxNamedColour('grey')
|
||||||
|
|
||||||
|
self.SetBackgroundColour(self.bcol)
|
||||||
|
#dc.SetForegroundColour(self.fcol)
|
||||||
|
|
||||||
|
# events
|
||||||
|
EVT_LEFT_DOWN(self, self.OnMouseClick)
|
||||||
|
EVT_RIGHT_DOWN(self, self.OnMouseClick)
|
||||||
|
EVT_SCROLLWIN(self, self.OnScroll)
|
||||||
|
|
||||||
|
self.o_cx = self.cx
|
||||||
|
self.o_cy = self.cy
|
||||||
|
self.o_sx = self.sx
|
||||||
|
self.o_sy = self.sy
|
||||||
|
self.o_line = self.line
|
||||||
|
self.sco_x = 0
|
||||||
|
self.sco_y = 0
|
||||||
|
|
||||||
|
self.tabsize = 4
|
||||||
|
|
||||||
|
self.update = true
|
||||||
|
self.in_scroll =FALSE
|
||||||
|
|
||||||
|
bw,bh = self.GetSizeTuple()
|
||||||
|
# double buffering
|
||||||
|
self.mdc = wxMemoryDC()
|
||||||
|
self.mdc.SelectObject(wxEmptyBitmap(bw,bh))
|
||||||
|
# disable physical scrolling because invisible parts are not drawn
|
||||||
|
self.EnableScrolling(FALSE, FALSE)
|
||||||
|
|
||||||
|
# the ordinary text as it is
|
||||||
|
self.SetText()
|
||||||
|
self.SetFocus()
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def CalcLines(self):
|
||||||
|
###############################################################
|
||||||
|
self.lines = []
|
||||||
|
x =maxlen =0
|
||||||
|
for line in self.text:
|
||||||
|
if line.visible==0:
|
||||||
|
self.lines.append(x)
|
||||||
|
else:
|
||||||
|
if len(line.text) >maxlen:
|
||||||
|
maxlen =len(line.text)
|
||||||
|
x = x + 1
|
||||||
|
self.len = len(self.lines)
|
||||||
|
self.max_linelength =maxlen
|
||||||
|
|
||||||
|
def SetFontTab(self, fonttab):
|
||||||
|
###############################################################
|
||||||
|
""" Fonttabelle zum schnellen Zugriff """
|
||||||
|
self.ftab = fonttab
|
||||||
|
|
||||||
|
def SetText(self, text = [""]):
|
||||||
|
###############################################################
|
||||||
|
""" Text mittels Liste setzen """
|
||||||
|
self.cx = 0
|
||||||
|
self.cy = 0
|
||||||
|
self.text = []
|
||||||
|
|
||||||
|
for t in text:
|
||||||
|
self.text.append(Line(t))
|
||||||
|
|
||||||
|
for l in range(0,len(text)-1):
|
||||||
|
#self.UpdateSyntax(l)
|
||||||
|
self.OnUpdateHighlight(l)
|
||||||
|
|
||||||
|
self.OnInit()
|
||||||
|
|
||||||
|
self.update = true
|
||||||
|
self.UpdateView(None, true)
|
||||||
|
|
||||||
|
# show new text
|
||||||
|
def GetText(self):
|
||||||
|
###############################################################
|
||||||
|
""" Der gesamte Text als Liste """
|
||||||
|
text = []
|
||||||
|
for line in self.text:
|
||||||
|
text.append(line.text)
|
||||||
|
return text
|
||||||
|
|
||||||
|
def IsEmpty(self):
|
||||||
|
###############################################################
|
||||||
|
"""see if at least one text line is not empty"""
|
||||||
|
for line in self.text:
|
||||||
|
if line.text: return 0
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def IsLine(self, line):
|
||||||
|
###############################################################
|
||||||
|
""" Schauen, ob alles im grünen Bereich ist """
|
||||||
|
return (line>=0) and (line<self.len)
|
||||||
|
|
||||||
|
def IsEditable(self, line):
|
||||||
|
###############################################################
|
||||||
|
return self.text[self.GetLine(line)].editable
|
||||||
|
|
||||||
|
def GetLine(self, line):
|
||||||
|
###############################################################
|
||||||
|
return self.lines[line]
|
||||||
|
|
||||||
|
def GetTextLine(self, line):
|
||||||
|
###############################################################
|
||||||
|
""" Text holen """
|
||||||
|
if self.IsLine(line):
|
||||||
|
return self.text[self.GetLine(line)].text
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def SetTextLine(self, line, text):
|
||||||
|
###############################################################
|
||||||
|
""" Nur den Text ändern """
|
||||||
|
if self.IsLine(line):
|
||||||
|
l = self.GetLine(line)
|
||||||
|
self.text[l].text = text
|
||||||
|
#self.UpdateSyntax(l)
|
||||||
|
self.OnUpdateHighlight(l)
|
||||||
|
self.update = true
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def OnMouseClick(self, event):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Wenn es Click gemacht hat => Cursor setzen
|
||||||
|
"""
|
||||||
|
self.SetFocus()
|
||||||
|
|
||||||
|
self.cy = self.sy + (event.GetY() / self.fh)
|
||||||
|
if self.cy >= self.len: self.cy =max(self.len -1, 0)
|
||||||
|
linelen =len(self.text[self.GetLine(self.cy)].text)
|
||||||
|
self.cx = self.sx + (event.GetX() / self.fw)
|
||||||
|
# allow positioning right behind the last character
|
||||||
|
if self.cx > linelen: self.cx =linelen
|
||||||
|
if event.GetEventType() ==wxEVT_RIGHT_DOWN:
|
||||||
|
self.update = true
|
||||||
|
self.OnFold()
|
||||||
|
self.UpdateView()
|
||||||
|
|
||||||
|
|
||||||
|
def DrawCursor(self, dc = None):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Auch der Cursor muß ja irgendwie gezeichnet werden
|
||||||
|
"""
|
||||||
|
if not dc:
|
||||||
|
dc = wxClientDC(self)
|
||||||
|
|
||||||
|
if (self.len)<self.cy: #-1 ?
|
||||||
|
self.cy = self.len-1
|
||||||
|
s = self.text[self.GetLine(self.cy)].text
|
||||||
|
|
||||||
|
x = self.cx - self.sx
|
||||||
|
y = self.cy - self.sy
|
||||||
|
self.DrawSimpleCursor(x, y, dc)
|
||||||
|
|
||||||
|
|
||||||
|
def DrawSimpleCursor(self, xp, yp, dc = None, old=false):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Auch der Cursor muß ja irgendwie gezeichnet werden
|
||||||
|
"""
|
||||||
|
if not dc:
|
||||||
|
dc = wxClientDC(self)
|
||||||
|
|
||||||
|
if old:
|
||||||
|
xp = self.sco_x
|
||||||
|
yp = self.sco_y
|
||||||
|
|
||||||
|
szx = self.fw
|
||||||
|
szy = self.fh
|
||||||
|
x = xp * szx
|
||||||
|
y = yp * szy
|
||||||
|
dc.Blit(x,y,szx,szy,dc,x,y,wxSRC_INVERT)
|
||||||
|
self.sco_x = xp
|
||||||
|
self.sco_y = yp
|
||||||
|
|
||||||
|
def OnScroll(self, event):
|
||||||
|
dir =event.GetOrientation()
|
||||||
|
evt =event.GetEventType()
|
||||||
|
if dir ==wxHORIZONTAL:
|
||||||
|
if evt ==wxEVT_SCROLLWIN_LINEUP: self.sx =self.sx -1
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_LINEDOWN: self.sx =self.sx +1
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_PAGEUP: self.sx =self.sx -self.sw
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_PAGEDOWN: self.sx =self.sx +self.sw
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_TOP: self.sx =self.cx =0
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_BOTTOM:
|
||||||
|
self.sx =self.max_linelength -self.sw
|
||||||
|
self.cx =self.max_linelength
|
||||||
|
else: self.sx =event.GetPosition()
|
||||||
|
if self.sx >(self.max_linelength -self.sw +1):
|
||||||
|
self.sx =self.max_linelength -self.sw +1
|
||||||
|
if self.sx <0: self.sx =0
|
||||||
|
if self.cx >(self.sx +self.sw -1): self.cx =self.sx +self.sw -1
|
||||||
|
if self.cx <self.sx: self.cx =self.sx
|
||||||
|
else:
|
||||||
|
if evt ==wxEVT_SCROLLWIN_LINEUP: self.sy =self.sy -1
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_LINEDOWN: self.sy =self.sy +1
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_PAGEUP: self.sy =self.sy -self.sh
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_PAGEDOWN: self.sy =self.sy +self.sh
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_TOP: self.sy =self.cy =0
|
||||||
|
elif evt ==wxEVT_SCROLLWIN_BOTTOM:
|
||||||
|
self.sy =self.len -self.sh
|
||||||
|
self.cy =self.len
|
||||||
|
else: self.sy =event.GetPosition()
|
||||||
|
if self.sy >(self.len -self.sh +1):
|
||||||
|
self.sy =self.len -self.sh +1
|
||||||
|
if self.sy <0: self.sy =0
|
||||||
|
if self.cy >(self.sy +self.sh -1): self.cy =self.sy +self.sh -1
|
||||||
|
if self.cy <self.sy: self.cy =self.sy
|
||||||
|
self.UpdateView()
|
||||||
|
|
||||||
|
def AdjustScrollbars(self):
|
||||||
|
# there appears to be endless recursion:
|
||||||
|
# SetScrollbars issue EvtPaint which calls UpdateView
|
||||||
|
# which calls AdjustScrollbars
|
||||||
|
if not self.in_scroll:
|
||||||
|
self.in_scroll =TRUE
|
||||||
|
self.SetScrollbars(self.fw, self.fh, self.max_linelength +1,
|
||||||
|
# it seem to be a bug in scrollbars:
|
||||||
|
# the scrollbar is hidden
|
||||||
|
# even if current position >0
|
||||||
|
max(self.len +1, self.sy +self.sh),
|
||||||
|
self.sx, self.sy)
|
||||||
|
self.in_scroll =FALSE
|
||||||
|
|
||||||
|
# adapts the output to what it should be
|
||||||
|
def UpdateView(self, dc = None, doup=false):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Diese Routine wird immer dann aufgerufen, wenn
|
||||||
|
sich etwas verändert hat
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.CalcLines()
|
||||||
|
|
||||||
|
if not dc:
|
||||||
|
dc = wxClientDC(self)
|
||||||
|
|
||||||
|
self.bw,self.bh = self.GetSizeTuple()
|
||||||
|
self.sw = self.bw / self.fw
|
||||||
|
self.sh = self.bh / self.fh
|
||||||
|
|
||||||
|
if self.cy<self.sy:
|
||||||
|
self.sy = self.cy
|
||||||
|
elif self.cy>(self.sy+self.sh-1):
|
||||||
|
self.sy = self.cy-self.sh+1
|
||||||
|
|
||||||
|
if self.cx<self.sx:
|
||||||
|
self.sx = self.cx
|
||||||
|
elif self.cx>(self.sx+self.sw-1):
|
||||||
|
self.sx = self.cx-self.sw+1
|
||||||
|
|
||||||
|
# left line? change syntax!
|
||||||
|
if self.ocy!=self.cy:
|
||||||
|
self.OnUpdateSyntax(self.ocy)
|
||||||
|
self.ocy = self.cy
|
||||||
|
|
||||||
|
# alles beim alten
|
||||||
|
self.AdjustScrollbars()
|
||||||
|
self.DrawSimpleCursor(0,0,dc, true)
|
||||||
|
# [als] i don't really understand how the following condition works
|
||||||
|
if self.update or doup:
|
||||||
|
self.Draw(dc)
|
||||||
|
self.update = false
|
||||||
|
else:
|
||||||
|
self.DrawCursor(dc)
|
||||||
|
|
||||||
|
self.o_cx = self.cx
|
||||||
|
self.o_cy = self.cy
|
||||||
|
self.o_sx = self.sx
|
||||||
|
self.o_sy = self.sy
|
||||||
|
self.o_line = self.line
|
||||||
|
|
||||||
|
|
||||||
|
def DrawEditText(self, t, x, y, dc = None):
|
||||||
|
###############################################################
|
||||||
|
""" Einfache Hilfsroutine um Text zu schreiben
|
||||||
|
"""
|
||||||
|
if not dc:
|
||||||
|
dc = wxClientDC(self)
|
||||||
|
dc.SetFont(self.font)
|
||||||
|
dc.DrawText(t, x * self.fw, y * self.fh)
|
||||||
|
|
||||||
|
def DrawLine(self, line, dc=None):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Hier wird einfach die Ansicht der ganzen Seite
|
||||||
|
wiederhergestellt.
|
||||||
|
!!! Kann modifiziert werden !!!
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not dc:
|
||||||
|
dc = wxClientDC(self)
|
||||||
|
|
||||||
|
dc.SetBackgroundMode(wxSOLID)
|
||||||
|
dc.SetTextBackground(self.bcol)
|
||||||
|
dc.SetTextForeground(self.fcol)
|
||||||
|
#dc.Clear()
|
||||||
|
|
||||||
|
# delimiter
|
||||||
|
ll = self.sx
|
||||||
|
lr = self.sx + self.sw
|
||||||
|
y = line - self.sy
|
||||||
|
|
||||||
|
# text + syntax
|
||||||
|
if self.IsLine(line):
|
||||||
|
l = self.GetLine(line)
|
||||||
|
t = self.text[l].text
|
||||||
|
syn = self.text[l].syntax
|
||||||
|
|
||||||
|
if not self.text[l].editable:
|
||||||
|
dc.SetTextBackground(self.nedcol)
|
||||||
|
else:
|
||||||
|
dc.SetTextBackground(self.bcol)
|
||||||
|
|
||||||
|
dc.SetTextForeground(self.fcol)
|
||||||
|
|
||||||
|
pos = ll
|
||||||
|
for h in syn:
|
||||||
|
xp, col = h
|
||||||
|
if xp>=ll:
|
||||||
|
self.DrawEditText(t[pos:xp], (pos-ll), y, dc)
|
||||||
|
pos = xp
|
||||||
|
dc.SetTextForeground(self.ftab[col])
|
||||||
|
self.DrawEditText(t[pos:], (pos-ll), y, dc)
|
||||||
|
|
||||||
|
def Draw(self, odc=None):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Hier wird einfach die Ansicht der ganzen Seite
|
||||||
|
wiederhergestellt.
|
||||||
|
!!! Kann modifiziert werden !!!
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not odc:
|
||||||
|
odc = wxClientDC(self)
|
||||||
|
|
||||||
|
dc = self.mdc
|
||||||
|
dc.SelectObject(wxEmptyBitmap(self.bw,self.bh))
|
||||||
|
dc.SetBackgroundMode(wxSOLID)
|
||||||
|
dc.SetTextBackground(self.bcol)
|
||||||
|
dc.SetTextForeground(self.fcol)
|
||||||
|
dc.Clear()
|
||||||
|
for line in range(self.sy, self.sy + self.sh): self.DrawLine(line, dc)
|
||||||
|
odc.Blit(0,0,self.bw,self.bh,dc,0,0,wxCOPY)
|
||||||
|
self.DrawCursor(odc)
|
||||||
|
|
||||||
|
|
||||||
|
def cVert(self, num):
|
||||||
|
###############################################################
|
||||||
|
""" Vertikale Cursorverschiebung
|
||||||
|
"""
|
||||||
|
cy = self.cy + num
|
||||||
|
if cy <0: cy =0
|
||||||
|
elif cy >(self.len -1): cy =self.len -1
|
||||||
|
# scroll when edge hit
|
||||||
|
if cy >(self.sy +self.sh -1): self.sy =cy -self.sh +1
|
||||||
|
elif cy <self.sy: self.sy =cy
|
||||||
|
self.cy =cy
|
||||||
|
# disallow positioning behind the end of the line
|
||||||
|
linelen =len(self.text[self.GetLine(cy)].text)
|
||||||
|
if self.cx >linelen: self.cx =linelen
|
||||||
|
|
||||||
|
def cHoriz(self, num):
|
||||||
|
###############################################################
|
||||||
|
""" Horizontale Cursorverschiebung
|
||||||
|
"""
|
||||||
|
cx = self.cx + num
|
||||||
|
linelen =len(self.text[self.GetLine(self.cy)].text)
|
||||||
|
if cx <0: cx =0
|
||||||
|
elif cx >linelen: cx =linelen
|
||||||
|
# scroll when edge hit
|
||||||
|
if cx >(self.sx +self.sw -2): self.sx =cx -self.sw +2
|
||||||
|
elif cx <self.sx: self.sx =cx
|
||||||
|
self.cx =cx
|
||||||
|
|
||||||
|
def InsertText(self, text):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Simple Routine um Text - auch über mehrere
|
||||||
|
Zeilen - einzufügen
|
||||||
|
"""
|
||||||
|
|
||||||
|
if self.IsEditable(self.cy):
|
||||||
|
tis = split(text, "\n")
|
||||||
|
|
||||||
|
t = self.GetTextLine(self.cy)
|
||||||
|
|
||||||
|
if len(tis)==1:
|
||||||
|
t = t[:self.cx] + text + t[self.cx:]
|
||||||
|
self.SetTextLine(self.cy, t)
|
||||||
|
self.cHoriz(len(text))
|
||||||
|
else:
|
||||||
|
rest = t[self.cx:]
|
||||||
|
t = t[:self.cx] + tis[0]
|
||||||
|
self.SetTextLine(self.cy, t)
|
||||||
|
for i in range(1,len(tis)):
|
||||||
|
self.text.insert(self.GetLine(self.cy)+1, Line())
|
||||||
|
self.lines.insert(self.cy+1,self.GetLine(self.cy)+1)
|
||||||
|
self.cVert(+1)
|
||||||
|
self.SetTextLine(self.cy, tis[i])
|
||||||
|
t = self.GetTextLine(self.cy)
|
||||||
|
self.cx = len(t)
|
||||||
|
t = t + rest
|
||||||
|
self.SetTextLine(self.cy, t)
|
||||||
|
self.update = true
|
||||||
|
#self.UpdateView()
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def RemoveLine(self, line):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def OnChar(self, event):
|
||||||
|
###############################################################
|
||||||
|
"""
|
||||||
|
Wenn eine Taste gedrückt wird,
|
||||||
|
kann an dieser Stelle die Auswertung stattfinden
|
||||||
|
"""
|
||||||
|
|
||||||
|
# get code
|
||||||
|
key = event.KeyCode()
|
||||||
|
|
||||||
|
# if event.ControlDown:
|
||||||
|
# if chr(key)=="k":
|
||||||
|
# print "weg"
|
||||||
|
|
||||||
|
|
||||||
|
# movements
|
||||||
|
if key==WXK_DOWN:
|
||||||
|
self.cVert(+1)
|
||||||
|
elif key==WXK_UP:
|
||||||
|
self.cVert(-1)
|
||||||
|
elif key==WXK_LEFT:
|
||||||
|
self.cHoriz(-1)
|
||||||
|
elif key==WXK_RIGHT:
|
||||||
|
self.cHoriz(+1)
|
||||||
|
|
||||||
|
elif key==WXK_NEXT:
|
||||||
|
self.cVert(self.sh)
|
||||||
|
elif key==WXK_PRIOR:
|
||||||
|
self.cVert(-self.sh)
|
||||||
|
|
||||||
|
elif key==WXK_HOME:
|
||||||
|
self.cx = 0
|
||||||
|
elif key==WXK_END:
|
||||||
|
self.cx = len(self.GetTextLine(self.cy))
|
||||||
|
|
||||||
|
elif key==WXK_BACK:
|
||||||
|
t = self.GetTextLine(self.cy)
|
||||||
|
if self.cx>0:
|
||||||
|
t = t[:self.cx-1] + t[self.cx:]
|
||||||
|
self.SetTextLine(self.cy, t)
|
||||||
|
self.cHoriz(-1)
|
||||||
|
|
||||||
|
elif key==WXK_DELETE:
|
||||||
|
t = self.GetTextLine(self.cy)
|
||||||
|
if self.cx<len(t):
|
||||||
|
t = t[:self.cx] + t[self.cx+1:]
|
||||||
|
self.SetTextLine(self.cy, t)
|
||||||
|
|
||||||
|
elif key==WXK_RETURN:
|
||||||
|
self.InsertText("\n")
|
||||||
|
|
||||||
|
elif key==WXK_TAB:
|
||||||
|
self.OnTabulator(event)
|
||||||
|
|
||||||
|
# clipboard (buggy)
|
||||||
|
elif key==WXK_F10:
|
||||||
|
if wxTheClipboard.Open():
|
||||||
|
data = wxTheClipboard.GetData()
|
||||||
|
wxTheClipboard.Close()
|
||||||
|
print data
|
||||||
|
|
||||||
|
# folding (buggy)
|
||||||
|
elif key==WXK_F12:
|
||||||
|
self.update = true
|
||||||
|
self.OnFold()
|
||||||
|
|
||||||
|
# regular ascii
|
||||||
|
elif (key>31) and (key<256):
|
||||||
|
self.InsertText(chr(key))
|
||||||
|
|
||||||
|
self.UpdateView()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def OnPaint(self, event):
|
||||||
|
dc = wxPaintDC(self)
|
||||||
|
self.bw,self.bh = self.GetSizeTuple()
|
||||||
|
self.UpdateView(dc, true)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def GetIndent(self, line):
|
||||||
|
p = 0
|
||||||
|
for c in line:
|
||||||
|
if c==" ": p = p + 1
|
||||||
|
elif c=="\t": p =(p /self.tabsize +1) *self.tabsize
|
||||||
|
else: break
|
||||||
|
return p
|
||||||
|
|
||||||
|
def Goto(self, pos):
|
||||||
|
self.cVert(pos-self.cy-1)
|
||||||
|
self.UpdateView()
|
||||||
|
|
||||||
|
# --------------------------------------------------------
|
||||||
|
|
||||||
|
# to be overloaded
|
||||||
|
def OnUpdateHighlight(self, line = -1):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def OnUpdateSyntax(self, line = -1):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def OnTabulator(self, event):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def OnInit(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def OnFold(self):
|
||||||
|
pass
|
210
utils/wxPython/lib/editor/py_editor.py
Normal file
210
utils/wxPython/lib/editor/py_editor.py
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
# (C)opyright by Dirk Holtwick, 1999
|
||||||
|
# ----------------------------------
|
||||||
|
# holtwick@spirito.de
|
||||||
|
# http://www.spirito.de/pyde
|
||||||
|
|
||||||
|
from editor import *
|
||||||
|
from string import *
|
||||||
|
from keyword import *
|
||||||
|
from tokenizer import *
|
||||||
|
|
||||||
|
"""
|
||||||
|
This module will be loaded by the main
|
||||||
|
window. It implements some methods that
|
||||||
|
are typical for Python sources.
|
||||||
|
"""
|
||||||
|
|
||||||
|
class wxPyEditor(wxEditor):
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
def __init__(self, parent, id=-1):
|
||||||
|
wxEditor.__init__(self, parent, id)
|
||||||
|
self.SetFontTab([
|
||||||
|
wxNamedColour('black'),
|
||||||
|
wxNamedColour('blue'),
|
||||||
|
wxNamedColour('red'),
|
||||||
|
wxNamedColour('darkgreen'),
|
||||||
|
wxNamedColour('brown')
|
||||||
|
])
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
def OnUpdateHighlight(self, line = -1):
|
||||||
|
if line>=0:
|
||||||
|
t = self.text[line].text
|
||||||
|
syn = []
|
||||||
|
|
||||||
|
toks = Tokenizer(t).tokens()
|
||||||
|
for type, string, begin, end in toks:
|
||||||
|
if type == "KEY":
|
||||||
|
syn.append((begin, 1))
|
||||||
|
syn.append((end, 0))
|
||||||
|
elif type == "COMMENT":
|
||||||
|
syn.append((begin, 2))
|
||||||
|
elif type == "STRING":
|
||||||
|
syn.append((begin, 3))
|
||||||
|
syn.append((end, 0))
|
||||||
|
elif type == "NUMBER":
|
||||||
|
syn.append((begin, 4))
|
||||||
|
syn.append((end, 0))
|
||||||
|
elif type == "NAME":
|
||||||
|
if string=="self":
|
||||||
|
syn.append((begin, 4))
|
||||||
|
syn.append((end, 0))
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
self.text[line].syntax = syn
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
def OnUpdateSyntax(self, line = -1):
|
||||||
|
if line>=0:
|
||||||
|
"""
|
||||||
|
tx, syn, m = self.text[line]
|
||||||
|
pre = 0
|
||||||
|
for i in range(0,len(tx)):
|
||||||
|
if tx[i] != " ":
|
||||||
|
pre = i
|
||||||
|
break
|
||||||
|
t = tx[pre:]
|
||||||
|
|
||||||
|
t = Tokenizer(t).line()
|
||||||
|
|
||||||
|
t = tx[:pre] + t
|
||||||
|
self.text[line] = t, syn, m
|
||||||
|
"""
|
||||||
|
self.OnUpdateHighlight(line)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
def OnTabulator(self, event):
|
||||||
|
add = +1
|
||||||
|
if event.ShiftDown():
|
||||||
|
add = -1
|
||||||
|
t = self.GetTextLine(self.cy)
|
||||||
|
if strip(t):
|
||||||
|
indent = self.GetIndent(t)
|
||||||
|
# print indent
|
||||||
|
t = t[indent:]
|
||||||
|
tabs = indent / self.tabsize
|
||||||
|
# for i in range(0,tabs+add):
|
||||||
|
t = (" " * 4 * (tabs+add)) + t
|
||||||
|
self.SetTextLine(self.cy, t)
|
||||||
|
elif add>0:
|
||||||
|
self.InsertText(" ")
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
def FindQuote(self, lineno, quote_type='"""', direction=1):
|
||||||
|
"""find line containing the matching quote"""
|
||||||
|
l =lineno +direction
|
||||||
|
while (l < len(self.text)-1) and (l >= 0):
|
||||||
|
if find(self.text[l].text, quote_type) >=0: return l
|
||||||
|
l =l +direction
|
||||||
|
return None
|
||||||
|
|
||||||
|
def FindNextLine(self, lineno, direction=1):
|
||||||
|
"""get the next line of code (skipping comment lines and empty lines)"""
|
||||||
|
l =lineno +direction
|
||||||
|
while (l < len(self.text)-1) and (l >= 0):
|
||||||
|
str =lstrip(self.text[l].text)
|
||||||
|
if (len(str) >0) and (str[0] !="#"): return l
|
||||||
|
l =l +direction
|
||||||
|
return None
|
||||||
|
|
||||||
|
def Fold(self):
|
||||||
|
l = self.GetLine(self.cy)
|
||||||
|
line = self.text[l]
|
||||||
|
t = line.text
|
||||||
|
|
||||||
|
# fold ...
|
||||||
|
if line.editable:
|
||||||
|
|
||||||
|
# 3*quotes
|
||||||
|
qpos =find(t, '"""')
|
||||||
|
if qpos >=0: qtype ='"""'
|
||||||
|
else:
|
||||||
|
qpos =find(t, "'''")
|
||||||
|
if qpos >=0: qtype ="'''"
|
||||||
|
|
||||||
|
if (qpos >=0) and (find(t[qpos+3:], qtype) <0):
|
||||||
|
closing_quote =self.FindQuote(l, qtype)
|
||||||
|
if closing_quote !=None:
|
||||||
|
line.editable = not line.editable
|
||||||
|
l =l +1
|
||||||
|
while l <= closing_quote:
|
||||||
|
self.text[l].visible =self.text[l].visible +1
|
||||||
|
l =l +1
|
||||||
|
|
||||||
|
else: # try normal fold on leading whitespace
|
||||||
|
lim = self.GetIndent(t)
|
||||||
|
lnext =self.FindNextLine(l)
|
||||||
|
if (lnext !=None) \
|
||||||
|
and (self.GetIndent(self.text[lnext].text) >lim):
|
||||||
|
line.editable =FALSE
|
||||||
|
lstart =l +1
|
||||||
|
l =self.FindNextLine(l)
|
||||||
|
while (l !=None) \
|
||||||
|
and (self.GetIndent(self.text[l].text) >lim):
|
||||||
|
l =self.FindNextLine(l)
|
||||||
|
if l ==None:
|
||||||
|
# fold till the end
|
||||||
|
l =len(self.text)
|
||||||
|
for line in self.text[lstart:l]:
|
||||||
|
line.visible =line.visible +1
|
||||||
|
|
||||||
|
# ... or unfold
|
||||||
|
else:
|
||||||
|
lim = line.visible + 1
|
||||||
|
line.editable = not line.editable
|
||||||
|
|
||||||
|
l = l + 1
|
||||||
|
line = self.text[l]
|
||||||
|
while (l < (len(self.text) -1)) and (line.visible>=lim):
|
||||||
|
line.visible = line.visible - 1
|
||||||
|
l = l + 1
|
||||||
|
line = self.text[l]
|
||||||
|
|
||||||
|
def FoldAll(self):
|
||||||
|
self.CalcLines()
|
||||||
|
self.cx = 0
|
||||||
|
self.cy = len(self.lines) - 1
|
||||||
|
prev_indent =0
|
||||||
|
# following loop is exited in two cases:
|
||||||
|
# when self.cy becomes 0 (topmost level is not folded by FoldAll)
|
||||||
|
# or when FindNextLine() returns None (all remaining lines till
|
||||||
|
# the beginning of the text are empty or comments)
|
||||||
|
while self.cy:
|
||||||
|
t = self.GetTextLine(self.cy)
|
||||||
|
# indent-based folding
|
||||||
|
indent =self.GetIndent(t)
|
||||||
|
if indent <prev_indent:
|
||||||
|
self.Fold()
|
||||||
|
prev_indent =indent
|
||||||
|
# triple-quote folding
|
||||||
|
qpos =find(t, '"""')
|
||||||
|
if qpos >=0: qtype ='"""'
|
||||||
|
else:
|
||||||
|
qpos =find(t, "'''")
|
||||||
|
if qpos >=0: qtype ="'''"
|
||||||
|
if (qpos >=0) and (find(t[qpos+3:], qtype) <0):
|
||||||
|
closing_quote =self.FindQuote(self.cy, qtype, -1)
|
||||||
|
if closing_quote !=None:
|
||||||
|
# XXX potential bug: unmatched triple quotes
|
||||||
|
self.cy =closing_quote
|
||||||
|
self.Fold()
|
||||||
|
self.cy =self.FindNextLine(self.cy, -1)
|
||||||
|
if self.cy ==None: self.cy =0
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
def OnFold(self):
|
||||||
|
self.Fold()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
def OnInit(self):
|
||||||
|
#self.FoldAll()
|
||||||
|
pass
|
||||||
|
|
60
utils/wxPython/lib/editor/tokenizer.py
Normal file
60
utils/wxPython/lib/editor/tokenizer.py
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
from tokenize import *
|
||||||
|
from keyword import *
|
||||||
|
from string import *
|
||||||
|
|
||||||
|
class Tokenizer:
|
||||||
|
"""
|
||||||
|
Simple class to create a list of token-tuples like:
|
||||||
|
|
||||||
|
(type, string, first, last)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
t = Tokenizer('def hallo(du): # juchee')
|
||||||
|
print t.tokens()
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, text):
|
||||||
|
self.text = text
|
||||||
|
self.toks = []
|
||||||
|
try:
|
||||||
|
tokenize(self.readline, self.get)
|
||||||
|
except TokenError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tokens(self):
|
||||||
|
return self.toks
|
||||||
|
|
||||||
|
def get(self, type, string, begin, end, l):
|
||||||
|
#print begin,end
|
||||||
|
h1, b = begin
|
||||||
|
h2, e = end
|
||||||
|
tname = tok_name[type]
|
||||||
|
if iskeyword(string):
|
||||||
|
tname = "KEY"
|
||||||
|
self.toks.append(tname, string, b, e)
|
||||||
|
|
||||||
|
def readline(self):
|
||||||
|
t = self.text
|
||||||
|
self.text = ""
|
||||||
|
return t
|
||||||
|
|
||||||
|
def line(self):
|
||||||
|
pre = ""
|
||||||
|
out = ""
|
||||||
|
for type, string, begin, end in self.toks:
|
||||||
|
if (pre in ["NAME","KEY"]) and (not string in [".",",","("]):
|
||||||
|
out = out + " "
|
||||||
|
|
||||||
|
if type in ["NAME","KEY"]:
|
||||||
|
out = out + string
|
||||||
|
elif type=="OP":
|
||||||
|
if string in [",",":"]:
|
||||||
|
out = out + string + " "
|
||||||
|
else:
|
||||||
|
out = out + string
|
||||||
|
else:
|
||||||
|
out = out + string
|
||||||
|
pre = type
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
@ -1700,7 +1700,7 @@ static PyObject *_wrap_wxWindow_GetGrandParent(PyObject *self, PyObject *args, P
|
|||||||
}
|
}
|
||||||
|
|
||||||
static long wxWindow_GetHandle(wxWindow *self) {
|
static long wxWindow_GetHandle(wxWindow *self) {
|
||||||
return (long)self->GetHandle();
|
return wxPyGetWinHandle(self); //(long)self->GetHandle();
|
||||||
}
|
}
|
||||||
static PyObject *_wrap_wxWindow_GetHandle(PyObject *self, PyObject *args, PyObject *kwargs) {
|
static PyObject *_wrap_wxWindow_GetHandle(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
PyObject * _resultobj;
|
PyObject * _resultobj;
|
||||||
@ -2476,6 +2476,107 @@ static PyObject *_wrap_wxWindow_IsEnabled(PyObject *self, PyObject *args, PyObje
|
|||||||
return _resultobj;
|
return _resultobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define wxWindow_IsExposed(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->IsExposed(_swigarg0,_swigarg1,_swigarg2,_swigarg3))
|
||||||
|
static PyObject *_wrap_wxWindow_IsExposed(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxWindow * _arg0;
|
||||||
|
int _arg1;
|
||||||
|
int _arg2;
|
||||||
|
int _arg3 = (int ) 0;
|
||||||
|
int _arg4 = (int ) 0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self","x","y","w","h", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii|ii:wxWindow_IsExposed",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3,&_arg4))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_IsExposed. Expected _wxWindow_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
wxPy_BEGIN_ALLOW_THREADS;
|
||||||
|
_result = (bool )wxWindow_IsExposed(_arg0,_arg1,_arg2,_arg3,_arg4);
|
||||||
|
|
||||||
|
wxPy_END_ALLOW_THREADS;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxWindow_IsExposedPoint(_swigobj,_swigarg0) (_swigobj->IsExposed(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxWindow_IsExposedPoint(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxWindow * _arg0;
|
||||||
|
wxPoint * _arg1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
wxPoint temp;
|
||||||
|
PyObject * _obj1 = 0;
|
||||||
|
char *_kwnames[] = { "self","pt", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxWindow_IsExposedPoint",_kwnames,&_argo0,&_obj1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_IsExposedPoint. Expected _wxWindow_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
_arg1 = &temp;
|
||||||
|
if (! wxPoint_helper(_obj1, &_arg1))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
wxPy_BEGIN_ALLOW_THREADS;
|
||||||
|
_result = (bool )wxWindow_IsExposedPoint(_arg0,*_arg1);
|
||||||
|
|
||||||
|
wxPy_END_ALLOW_THREADS;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxWindow_IsExposedRect(_swigobj,_swigarg0) (_swigobj->IsExposed(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxWindow_IsExposedRect(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxWindow * _arg0;
|
||||||
|
wxRect * _arg1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
wxRect temp;
|
||||||
|
PyObject * _obj1 = 0;
|
||||||
|
char *_kwnames[] = { "self","rect", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxWindow_IsExposedRect",_kwnames,&_argo0,&_obj1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_IsExposedRect. Expected _wxWindow_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
_arg1 = &temp;
|
||||||
|
if (! wxRect_helper(_obj1, &_arg1))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
wxPy_BEGIN_ALLOW_THREADS;
|
||||||
|
_result = (bool )wxWindow_IsExposedRect(_arg0,*_arg1);
|
||||||
|
|
||||||
|
wxPy_END_ALLOW_THREADS;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
#define wxWindow_IsRetained(_swigobj) (_swigobj->IsRetained())
|
#define wxWindow_IsRetained(_swigobj) (_swigobj->IsRetained())
|
||||||
static PyObject *_wrap_wxWindow_IsRetained(PyObject *self, PyObject *args, PyObject *kwargs) {
|
static PyObject *_wrap_wxWindow_IsRetained(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
PyObject * _resultobj;
|
PyObject * _resultobj;
|
||||||
@ -8629,6 +8730,9 @@ static PyMethodDef windowscMethods[] = {
|
|||||||
{ "wxWindow_IsTopLevel", (PyCFunction) _wrap_wxWindow_IsTopLevel, METH_VARARGS | METH_KEYWORDS },
|
{ "wxWindow_IsTopLevel", (PyCFunction) _wrap_wxWindow_IsTopLevel, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxWindow_IsShown", (PyCFunction) _wrap_wxWindow_IsShown, METH_VARARGS | METH_KEYWORDS },
|
{ "wxWindow_IsShown", (PyCFunction) _wrap_wxWindow_IsShown, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxWindow_IsRetained", (PyCFunction) _wrap_wxWindow_IsRetained, METH_VARARGS | METH_KEYWORDS },
|
{ "wxWindow_IsRetained", (PyCFunction) _wrap_wxWindow_IsRetained, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxWindow_IsExposedRect", (PyCFunction) _wrap_wxWindow_IsExposedRect, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxWindow_IsExposedPoint", (PyCFunction) _wrap_wxWindow_IsExposedPoint, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxWindow_IsExposed", (PyCFunction) _wrap_wxWindow_IsExposed, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxWindow_IsEnabled", (PyCFunction) _wrap_wxWindow_IsEnabled, METH_VARARGS | METH_KEYWORDS },
|
{ "wxWindow_IsEnabled", (PyCFunction) _wrap_wxWindow_IsEnabled, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxWindow_InitDialog", (PyCFunction) _wrap_wxWindow_InitDialog, METH_VARARGS | METH_KEYWORDS },
|
{ "wxWindow_InitDialog", (PyCFunction) _wrap_wxWindow_InitDialog, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxWindow_Hide", (PyCFunction) _wrap_wxWindow_Hide, METH_VARARGS | METH_KEYWORDS },
|
{ "wxWindow_Hide", (PyCFunction) _wrap_wxWindow_Hide, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
@ -271,6 +271,15 @@ class wxWindowPtr(wxEvtHandlerPtr):
|
|||||||
def IsEnabled(self, *_args, **_kwargs):
|
def IsEnabled(self, *_args, **_kwargs):
|
||||||
val = apply(windowsc.wxWindow_IsEnabled,(self,) + _args, _kwargs)
|
val = apply(windowsc.wxWindow_IsEnabled,(self,) + _args, _kwargs)
|
||||||
return val
|
return val
|
||||||
|
def IsExposed(self, *_args, **_kwargs):
|
||||||
|
val = apply(windowsc.wxWindow_IsExposed,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def IsExposedPoint(self, *_args, **_kwargs):
|
||||||
|
val = apply(windowsc.wxWindow_IsExposedPoint,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def IsExposedRect(self, *_args, **_kwargs):
|
||||||
|
val = apply(windowsc.wxWindow_IsExposedRect,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
def IsRetained(self, *_args, **_kwargs):
|
def IsRetained(self, *_args, **_kwargs):
|
||||||
val = apply(windowsc.wxWindow_IsRetained,(self,) + _args, _kwargs)
|
val = apply(windowsc.wxWindow_IsRetained,(self,) + _args, _kwargs)
|
||||||
return val
|
return val
|
||||||
|
@ -233,6 +233,9 @@ public:
|
|||||||
bool Hide();
|
bool Hide();
|
||||||
void InitDialog();
|
void InitDialog();
|
||||||
bool IsEnabled();
|
bool IsEnabled();
|
||||||
|
bool IsExposed( int x, int y, int w=0, int h=0 );
|
||||||
|
%name(IsExposedPoint) bool IsExposed( const wxPoint& pt );
|
||||||
|
%name(IsExposedRect) bool IsExposed( const wxRect& rect );
|
||||||
bool IsRetained();
|
bool IsRetained();
|
||||||
bool IsShown();
|
bool IsShown();
|
||||||
bool IsTopLevel();
|
bool IsTopLevel();
|
||||||
|
Loading…
Reference in New Issue
Block a user