Added the ActiveGrid IDE as a sample application

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2005-04-08 22:54:02 +00:00
parent 510bb7480c
commit 1f780e48af
42 changed files with 20049 additions and 9 deletions

View File

@@ -61,10 +61,12 @@ wxPython/licence
wxPython/samples
wxPython/samples/StyleEditor
wxPython/samples/docview
wxPython/samples/docview/activegrid
wxPython/samples/docview/activegrid/tool
wxPython/samples/docview/activegrid/tool/data
wxPython/samples/docview/activegrid/tool/images
wxPython/samples/pydocview
wxPython/samples/ide
wxPython/samples/ide/activegrid
wxPython/samples/ide/activegrid/tool
wxPython/samples/ide/activegrid/tool/data
wxPython/samples/ide/activegrid/util
wxPython/samples/doodle
wxPython/samples/embedded
wxPython/samples/frogedit

View File

@@ -409,11 +409,16 @@ Source: "samples\doodle\*.bat"; DestDir: "{app}\samples\doodle";
Source: "samples\doodle\sample.ddl"; DestDir: "{app}\samples\doodle";
Source: "samples\doodle\superdoodle.iss"; DestDir: "{app}\samples\doodle";
Source: "samples\docview\*.py"; DestDir: "{app}\samples\docview";
Source: "samples\docview\activegrid\*.py"; DestDir: "{app}\samples\docview\activegrid";
Source: "samples\docview\activegrid\tool\*.py"; DestDir: "{app}\samples\docview\activegrid\tool";
Source: "samples\docview\activegrid\tool\data\*.txt"; DestDir: "{app}\samples\docview\activegrid\tool\data";
Source: "samples\docview\activegrid\tool\images\*.jpg"; DestDir: "{app}\samples\docview\activegrid\tool\images";
Source: "samples\docview\*.py"; DestDir: "{app}\samples\docview";
Source: "samples\pydocview\*.py"; DestDir: "{app}\samples\pydocview";
Source: "samples\pydocview\*.jpg"; DestDir: "{app}\samples\pydocview";
Source: "samples\pydocview\*.txt"; DestDir: "{app}\samples\pydocview";
Source: "samples\ide\*.py"; DestDir: "{app}\samples\ide";
Source: "samples\ide\activegrid\*.py"; DestDir: "{app}\samples\ide\activegrid";
Source: "samples\ide\activegrid\tool\*.py"; DestDir: "{app}\samples\ide\activegrid\tool";
Source: "samples\ide\activegrid\tool\data\*.txt"; DestDir: "{app}\samples\ide\activegrid\tool\data";
Source: "samples\ide\activegrid\util\*.py"; DestDir: "{app}\samples\ide\activegrid\util";
Source: "samples\embedded\*.py"; DestDir: "{app}\samples\embedded";
Source: "samples\embedded\*.cpp"; DestDir: "{app}\samples\embedded";

View File

@@ -85,6 +85,7 @@ list of top-level windows that currently exist in the application.
Updated docview library modules and sample apps from the ActiveGrid
folks.
Added the ActiveGrid IDE as a sample application.

View File

@@ -0,0 +1,33 @@
#----------------------------------------------------------------------------
# Name: ActiveGridIDE.py
# Purpose:
#
# Author: Lawrence Bruhmuller
#
# Created: 3/30/05
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx.lib.pydocview
import activegrid.tool.IDE
import os
import sys
sys.stdout = sys.stderr
# This is here as the base IDE entry point. Only difference is that -baseide is passed.
sys.argv.append('-baseide');
# Put activegrid dir in path so python files can be found from py2exe
# This code should never do anything when run from the python interpreter
execDir = os.path.dirname(sys.executable)
try:
sys.path.index(execDir)
except ValueError:
sys.path.append(execDir)
app = activegrid.tool.IDE.IDEApplication(redirect = False)
app.GetTopWindow().Raise() # sometimes it shows up beneath other windows. e.g. running self in debugger
app.MainLoop()

View File

@@ -0,0 +1,119 @@
#----------------------------------------------------------------------------
# Name: AboutDialog.py
# Purpose: AboutBox which has copyright notice, license information, and credits
#
# Author: Morgan Hua
#
# Created: 3/22/05
# Copyright: (c) 2005 ActiveGrid, Inc.
# CVS-ID: $Id$
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
from IDE import ACTIVEGRID_BASE_IDE, getSplashBitmap
_ = wx.GetTranslation
#----------------------------------------------------------------------------
# Package License Data for AboutDialog
# Package, License, URL
# If no information is available, put a None as a place holder.
#----------------------------------------------------------------------------
licenseData = [
("ActiveGrid", "ASL 2.0", "http://apache.org/licenses/LICENSE-2.0"),
("Python 2.3", "Python Software Foundation License", "http://www.python.org/2.3/license.html"),
("wxPython 2.5", "wxWidgets 2 - LGPL", "http://wxwidgets.org/newlicen.htm"),
("wxWidgets", "wxWindows Library License 3", "http://www.wxwidgets.org/manuals/2.5.4/wx_wxlicense.html"),
("pychecker", "MetaSlash - BSD", "http://pychecker.sourceforge.net/COPYRIGHT"),
("process.py", "See file", "http://starship.python.net/~tmick/"),
]
if not ACTIVEGRID_BASE_IDE: # add licenses for database connections only if not the base IDE
licenseData += [
("pydb2", "LGPL", "http://sourceforge.net/projects/pydb2"),
("pysqlite", "Python License (CNRI)", "http://sourceforge.net/projects/pysqlite"),
("mysql-python", "GPL, Python License (CNRI), Zope Public License", "http://sourceforge.net/projects/mysql-python"),
("cx_Oracle", "Computronix", "http://http://www.computronix.com/download/License(cxOracle).txt"),
("SQLite", "Public Domain", "http://www.sqlite.org/copyright.html"),
("PyGreSQL", "BSD", "http://www.pygresql.org"),
]
if wx.Platform == '__WXMSW__':
licenseData += [("pywin32", "Python Software Foundation License", "http://sourceforge.net/projects/pywin32/")]
class AboutDialog(wx.Dialog):
def __init__(self, parent):
"""
Initializes the about dialog.
"""
wx.Dialog.__init__(self, parent, -1, _("About ") + wx.GetApp().GetAppName(), style = wx.DEFAULT_DIALOG_STYLE)
nb = wx.Notebook(self, -1)
aboutPage = wx.Panel(nb, -1)
sizer = wx.BoxSizer(wx.VERTICAL)
splash_bmp = getSplashBitmap()
image = wx.StaticBitmap(aboutPage, -1, splash_bmp, (0,0), (splash_bmp.GetWidth(), splash_bmp.GetHeight()))
sizer.Add(image, 0, wx.ALIGN_CENTER|wx.ALL, 0)
sizer.Add(wx.StaticText(aboutPage, -1, wx.GetApp().GetAppName() + _("\nVersion 0.6 Early Access\n\nCopyright (c) 2003-2005 ActiveGrid Incorporated and Contributors. All rights reserved.")), 0, wx.ALIGN_LEFT|wx.ALL, 10)
sizer.Add(wx.StaticText(aboutPage, -1, _("http://www.activegrid.com")), 0, wx.ALIGN_LEFT|wx.LEFT|wx.BOTTOM, 10)
aboutPage.SetSizer(sizer)
nb.AddPage(aboutPage, _("Copyright"))
licensePage = wx.Panel(nb, -1)
grid = wx.grid.Grid(licensePage, -1)
grid.CreateGrid(len(licenseData), 2)
dc = wx.ClientDC(grid)
dc.SetFont(grid.GetLabelFont())
grid.SetColLabelValue(0, _("License"))
grid.SetColLabelValue(1, _("URL"))
w, maxHeight = dc.GetTextExtent(_("License"))
w, h = dc.GetTextExtent(_("URL"))
if h > maxHeight:
maxHeight = h
grid.SetColLabelSize(maxHeight + 6) # add a 6 pixel margin
for row, data in enumerate(licenseData):
package = data[0]
license = data[1]
url = data[2]
if package:
grid.SetRowLabelValue(row, package)
if license:
grid.SetCellValue(row, 0, license)
if url:
grid.SetCellValue(row, 1, url)
grid.EnableEditing(False)
grid.EnableDragGridSize(False)
grid.EnableDragColSize(False)
grid.EnableDragRowSize(False)
grid.SetRowLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_CENTRE)
grid.SetLabelBackgroundColour(wx.WHITE)
grid.AutoSizeColumn(0, 100)
grid.AutoSizeColumn(1, 100)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(grid, 1, wx.EXPAND|wx.ALL, 10)
licensePage.SetSizer(sizer)
nb.AddPage(licensePage, _("Licenses"))
creditsPage = wx.Panel(nb, -1)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(wx.StaticText(creditsPage, -1, _("ActiveGrid Development Team:\n\nLawrence Bruhmuller\nEric Chu\nMatt Fryer\nJoel Hare\nMorgan Hua\nAlan Mullendore\nJeff Norton\nKevin Wang\nPeter Yared")), 0, wx.ALIGN_LEFT|wx.ALL, 10)
creditsPage.SetSizer(sizer)
nb.AddPage(creditsPage, _("Credits"))
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(nb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
btn = wx.Button(self, wx.ID_OK)
sizer.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
self.SetSizer(sizer)
self.SetAutoLayout(True)
sizer.Fit(self)

View File

@@ -0,0 +1,641 @@
#----------------------------------------------------------------------------
# Name: AbstractEditor.py
# Purpose: Non-text editor for DataModel and Process
#
# Author: Peter Yared, Morgan Hua
#
# Created: 7/28/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.lib.docview
import wx.lib.ogl as ogl
import PropertyService
_ = wx.GetTranslation
SELECT_BRUSH = wx.Brush("BLUE", wx.SOLID)
SHAPE_BRUSH = wx.Brush("WHEAT", wx.SOLID)
LINE_BRUSH = wx.BLACK_BRUSH
def GetRawModel(model):
if hasattr(model, "GetRawModel"):
rawModel = model.GetRawModel()
else:
rawModel = model
return rawModel
class CanvasView(wx.lib.docview.View):
#----------------------------------------------------------------------------
# Overridden methods
#----------------------------------------------------------------------------
def __init__(self, brush = SHAPE_BRUSH):
wx.lib.docview.View.__init__(self)
self._brush = brush
self._canvas = None
self._pt1 = None
self._pt2 = None
self._needEraseLasso = False
self._propShape = None
def OnCreate(self, doc, flags):
frame = wx.GetApp().CreateDocumentFrame(self, doc, flags)
frame.Show()
sizer = wx.BoxSizer()
self._CreateCanvas(frame)
sizer.Add(self._canvas, 1, wx.EXPAND, 0)
frame.SetSizer(sizer)
frame.Layout()
self.Activate()
return True
def OnActivateView(self, activate, activeView, deactiveView):
if activate and self._canvas:
# In MDI mode just calling set focus doesn't work and in SDI mode using CallAfter causes an endless loop
if self.GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
self._canvas.SetFocus()
else:
wx.CallAfter(self._canvas.SetFocus)
def OnClose(self, deleteWindow = True):
statusC = wx.GetApp().CloseChildDocuments(self.GetDocument())
statusP = wx.lib.docview.View.OnClose(self, deleteWindow = deleteWindow)
if hasattr(self, "ClearOutline"):
wx.CallAfter(self.ClearOutline) # need CallAfter because when closing the document, it is Activated and then Close, so need to match OnActivateView's CallAfter
if not (statusC and statusP):
return False
self.Activate(False)
if deleteWindow and self.GetFrame():
self.GetFrame().Destroy()
return True
def _CreateCanvas(self, parent):
self._canvas = ogl.ShapeCanvas(parent)
wx.EVT_LEFT_DOWN(self._canvas, self.OnLeftClick)
wx.EVT_LEFT_UP(self._canvas, self.OnLeftUp)
wx.EVT_MOTION(self._canvas, self.OnLeftDrag)
wx.EVT_LEFT_DCLICK(self._canvas, self.OnLeftDoubleClick)
wx.EVT_KEY_DOWN(self._canvas, self.OnKeyPressed)
maxWidth = 2000
maxHeight = 16000
self._canvas.SetScrollbars(20, 20, maxWidth / 20, maxHeight / 20)
self._canvas.SetBackgroundColour(wx.WHITE)
self._diagram = ogl.Diagram()
self._canvas.SetDiagram(self._diagram)
self._diagram.SetCanvas(self._canvas)
def OnKeyPressed(self, event):
key = event.KeyCode()
if key == wx.WXK_DELETE:
self.OnClear(event)
else:
event.Skip()
def OnLeftClick(self, event):
self.EraseRubberBand()
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
# keep track of mouse down for group select
self._pt1 = event.GetLogicalPosition(dc) # this takes into account scrollbar offset
self._pt2 = None
shape = self._canvas.FindShape(self._pt1[0], self._pt1[1])[0]
if shape:
self.BringToFront(shape)
self._pt1 = None
event.Skip() # pass on event to shape handler to take care of selection
return
elif event.ControlDown() or event.ShiftDown(): # extend select, don't deselect
pass
else:
# click on empty part of canvas, deselect everything
needRefresh = False
for shape in self._diagram.GetShapeList():
if hasattr(shape, "GetModel"):
if shape.Selected():
needRefresh = True
shape.Select(False, dc)
if needRefresh:
self._canvas.Redraw(dc)
self.SetPropertyModel(None)
if len(self.GetSelection()) == 0:
self.SetPropertyShape(None)
def OnLeftDoubleClick(self, event):
propertyService = wx.GetApp().GetService(PropertyService.PropertyService)
if propertyService:
propertyService.ShowWindow()
def OnLeftDrag(self, event):
# draw lasso for group select
if self._pt1 and event.LeftIsDown(): # we are in middle of lasso selection
self.EraseRubberBand()
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
self._pt2 = event.GetLogicalPosition(dc) # this takes into account scrollbar offset
self.DrawRubberBand()
else:
event.Skip()
def OnLeftUp(self, event):
# do group select
if self._needEraseLasso:
self.EraseRubberBand()
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
x1, y1 = self._pt1
x2, y2 = event.GetLogicalPosition(dc) # this takes into account scrollbar offset
tol = self._diagram.GetMouseTolerance()
if abs(x1 - x2) > tol or abs(y1 - y2) > tol:
# make sure x1 < x2 and y1 < y2 to make comparison test easier
if x1 > x2:
temp = x1
x1 = x2
x2 = temp
if y1 > y2:
temp = y1
y1 = y2
y2 = temp
for shape in self._diagram.GetShapeList():
if not shape.GetParent() and hasattr(shape, "GetModel"): # if part of a composite, don't select it
x, y = shape.GetX(), shape.GetY()
width, height = shape.GetBoundingBoxMax()
selected = x1 < x - width/2 and x2 > x + width/2 and y1 < y - height/2 and y2 > y + height/2
if event.ControlDown() or event.ShiftDown(): # extend select, don't deselect
if selected:
shape.Select(selected, dc)
else: # select items in lasso and deselect items out of lasso
shape.Select(selected, dc)
self._canvas.Redraw(dc)
else:
event.Skip()
else:
event.Skip()
def EraseRubberBand(self):
if self._needEraseLasso:
self._needEraseLasso = False
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
dc.SetLogicalFunction(wx.XOR)
pen = wx.Pen(wx.Colour(200, 200, 200), 1, wx.SHORT_DASH)
dc.SetPen(pen)
brush = wx.Brush(wx.Colour(255, 255, 255), wx.TRANSPARENT)
dc.SetBrush(brush)
dc.ResetBoundingBox()
dc.BeginDrawing()
x1, y1 = self._pt1
x2, y2 = self._pt2
# make sure x1 < x2 and y1 < y2
# this will make (x1, y1) = upper left corner
if x1 > x2:
temp = x1
x1 = x2
x2 = temp
if y1 > y2:
temp = y1
y1 = y2
y2 = temp
# erase previous outline
dc.SetClippingRegion(x1, y1, x2 - x1, y2 - y1)
dc.DrawRectangle(x1, y1, x2 - x1, y2 - y1)
dc.EndDrawing()
def DrawRubberBand(self):
self._needEraseLasso = True
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
dc.SetLogicalFunction(wx.XOR)
pen = wx.Pen(wx.Colour(200, 200, 200), 1, wx.SHORT_DASH)
dc.SetPen(pen)
brush = wx.Brush(wx.Colour(255, 255, 255), wx.TRANSPARENT)
dc.SetBrush(brush)
dc.ResetBoundingBox()
dc.BeginDrawing()
x1, y1 = self._pt1
x2, y2 = self._pt2
# make sure x1 < x2 and y1 < y2
# this will make (x1, y1) = upper left corner
if x1 > x2:
temp = x1
x1 = x2
x2 = temp
if y1 > y2:
temp = y1
y1 = y2
y2 = temp
# draw outline
dc.SetClippingRegion(x1, y1, x2 - x1, y2 - y1)
dc.DrawRectangle(x1, y1, x2 - x1, y2 - y1)
dc.EndDrawing()
def FindParkingSpot(self, width, height):
""" given a width and height, find a upper left corner where shape can be parked without overlapping other shape """
offset = 30 # space between shapes
x = offset
y = offset
maxX = 700 # max distance to the right where we'll place tables
noParkingSpot = True
while noParkingSpot:
point = self.isSpotOccupied(x, y, width, height)
if point:
x = point[0] + offset
if x > maxX:
x = offset
y = point[1] + offset
else:
noParkingSpot = False
return x, y
def isSpotOccupied(self, x, y, width, height):
""" returns None if at x,y,width,height no object occupies that rectangle,
otherwise returns lower right corner of object that occupies given x,y position
"""
x2 = x + width
y2 = y + height
for shape in self._diagram.GetShapeList():
if isinstance(shape, ogl.RectangleShape) or isinstance(shape, ogl.EllipseShape):
if shape.GetParent() and isinstance(shape.GetParent(), ogl.CompositeShape):
# skip, part of a composite shape
continue
if hasattr(shape, "GetModel"):
other_x, other_y, other_width, other_height = shape.GetModel().getEditorBounds()
other_x2 = other_x + other_width
other_y2 = other_y + other_height
else:
# shapes x,y are at the center of the shape, need to transform to upper left coordinate
other_width, other_height = shape.GetBoundingBoxMax()
other_x = shape.GetX() - other_width/2
other_y = shape.GetY() - other_height/2
other_x2 = other_x + other_width
other_y2 = other_y + other_height
# intersection check
if ((other_x2 < other_x or other_x2 > x) and
(other_y2 < other_y or other_y2 > y) and
(x2 < x or x2 > other_x) and
(y2 < y or y2 > other_y)):
return (other_x2, other_y2)
return None
#----------------------------------------------------------------------------
# Canvas methods
#----------------------------------------------------------------------------
def AddShape(self, shape, x = None, y = None, pen = None, brush = None, text = None, eventHandler = None):
if isinstance(shape, ogl.CompositeShape):
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
shape.Move(dc, x, y)
else:
shape.SetDraggable(True, True)
shape.SetCanvas(self._canvas)
if x:
shape.SetX(x)
if y:
shape.SetY(y)
shape.SetCentreResize(False)
if pen:
shape.SetPen(pen)
if brush:
shape.SetBrush(brush)
if text:
shape.AddText(text)
shape.SetShadowMode(ogl.SHADOW_RIGHT)
self._diagram.AddShape(shape)
shape.Show(True)
if not eventHandler:
eventHandler = EditorCanvasShapeEvtHandler(self)
eventHandler.SetShape(shape)
eventHandler.SetPreviousHandler(shape.GetEventHandler())
shape.SetEventHandler(eventHandler)
return shape
def RemoveShape(self, model = None, shape = None):
if not model and not shape:
return
if not shape:
shape = self.GetShape(model)
if shape:
shape.Select(False)
self._diagram.RemoveShape(shape)
if isinstance(shape, ogl.CompositeShape):
shape.RemoveFromCanvas(self._canvas)
def UpdateShape(self, model):
for shape in self._diagram.GetShapeList():
if hasattr(shape, "GetModel") and shape.GetModel() == model:
x, y, w, h = model.getEditorBounds()
newX = x + w / 2
newY = y + h / 2
changed = False
if isinstance(shape, ogl.CompositeShape):
if shape.GetX() != newX or shape.GetY() != newY:
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
shape.SetSize(w, h, True) # wxBug: SetSize must be before Move because links won't go to the right place
shape.Move(dc, newX, newY) # wxBug: Move must be before SetSize because links won't go to the right place
changed = True
else:
oldw, oldh = shape.GetBoundingBoxMax()
oldx = shape.GetX()
oldy = shape.GetY()
if oldw != w or oldh != h or oldx != newX or oldy != newY:
shape.SetSize(w, h)
shape.SetX(newX)
shape.SetY(newY)
changed = True
if changed:
shape.ResetControlPoints()
self._canvas.Refresh()
break
def GetShape(self, model):
for shape in self._diagram.GetShapeList():
if hasattr(shape, "GetModel") and shape.GetModel() == model:
return shape
return None
def GetSelection(self):
return filter(lambda shape: shape.Selected(), self._diagram.GetShapeList())
def SetSelection(self, models, extendSelect = False):
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
update = False
if not isinstance(models, type([])) and not isinstance(models, type(())):
models = [models]
for shape in self._diagram.GetShapeList():
if hasattr(shape, "GetModel"):
if shape.Selected() and not shape.GetModel() in models: # was selected, but not in new list, so deselect, unless extend select
if not extendSelect:
shape.Select(False, dc)
update = True
elif not shape.Selected() and shape.GetModel() in models: # was not selected and in new list, so select
shape.Select(True, dc)
update = True
elif extendSelect and shape.Selected() and shape.GetModel() in models: # was selected, but extend select means to deselect
shape.Select(False, dc)
update = True
if update:
self._canvas.Redraw(dc)
def BringToFront(self, shape):
if shape.GetParent() and isinstance(shape.GetParent(), ogl.CompositeShape):
self._diagram.RemoveShape(shape.GetParent())
self._diagram.AddShape(shape.GetParent())
else:
self._diagram.RemoveShape(shape)
self._diagram.AddShape(shape)
def SendToBack(self, shape):
if shape.GetParent() and isinstance(shape.GetParent(), ogl.CompositeShape):
self._diagram.RemoveShape(shape.GetParent())
self._diagram.InsertShape(shape.GetParent())
else:
self._diagram.RemoveShape(shape)
self._diagram.InsertShape(shape)
def ScrollVisible(self, shape):
xUnit, yUnit = shape._canvas.GetScrollPixelsPerUnit()
scrollX, scrollY = self._canvas.GetViewStart() # in scroll units
scrollW, scrollH = self._canvas.GetSize() # in pixels
w, h = shape.GetBoundingBoxMax() # in pixels
x = shape.GetX() - w/2 # convert to upper left coordinate from center
y = shape.GetY() - h/2 # convert to upper left coordinate from center
if x >= scrollX*xUnit and x <= scrollX*xUnit + scrollW: # don't scroll if already visible
x = -1
else:
x = x/xUnit
if y >= scrollY*yUnit and y <= scrollY*yUnit + scrollH: # don't scroll if already visible
y = -1
else:
y = y/yUnit
self._canvas.Scroll(x, y) # in scroll units
def SetPropertyShape(self, shape):
# no need to highlight if no PropertyService is running
propertyService = wx.GetApp().GetService(PropertyService.PropertyService)
if not propertyService:
return
if shape == self._propShape:
return
if hasattr(shape, "GetPropertyShape"):
shape = shape.GetPropertyShape()
dc = wx.ClientDC(self._canvas)
self._canvas.PrepareDC(dc)
dc.BeginDrawing()
# erase old selection if it still exists
if self._propShape and self._propShape in self._diagram.GetShapeList():
self._propShape.SetBrush(self._brush)
if (self._propShape._textColourName in ["BLACK", "WHITE"]): # Would use GetTextColour() but it is broken
self._propShape.SetTextColour("BLACK", 0)
self._propShape.Draw(dc)
# set new selection
self._propShape = shape
# draw new selection
if self._propShape and self._propShape in self._diagram.GetShapeList():
self._propShape.SetBrush(SELECT_BRUSH)
if (self._propShape._textColourName in ["BLACK", "WHITE"]): # Would use GetTextColour() but it is broken
self._propShape.SetTextColour("WHITE", 0)
self._propShape.Draw(dc)
dc.EndDrawing()
#----------------------------------------------------------------------------
# Property Service methods
#----------------------------------------------------------------------------
def GetPropertyModel(self):
if hasattr(self, "_propModel"):
return self._propModel
return None
def SetPropertyModel(self, model):
# no need to set the model if no PropertyService is running
propertyService = wx.GetApp().GetService(PropertyService.PropertyService)
if not propertyService:
return
if hasattr(self, "_propModel") and model == self._propModel:
return
self._propModel = model
propertyService.LoadProperties(self._propModel, self.GetDocument())
class EditorCanvasShapeMixin:
def GetModel(self):
return self._model
def SetModel(self, model):
self._model = model
class EditorCanvasShapeEvtHandler(ogl.ShapeEvtHandler):
""" wxBug: Bug in OLG package. With wxShape.SetShadowMode() turned on, when we set the size,
the width/height is larger by 6 pixels. Need to subtract this value from width and height when we
resize the object.
"""
SHIFT_KEY = 1
CONTROL_KEY = 2
def __init__(self, view):
ogl.ShapeEvtHandler.__init__(self)
self._view = view
def OnLeftClick(self, x, y, keys = 0, attachment = 0):
shape = self.GetShape()
if hasattr(shape, "GetModel"): # Workaround, on drag, we should deselect all other objects and select the clicked on object
model = shape.GetModel()
else:
shape = shape.GetParent()
if shape:
model = shape.GetModel()
self._view.SetSelection(model, keys == self.SHIFT_KEY or keys == self.CONTROL_KEY)
self._view.SetPropertyShape(shape)
self._view.SetPropertyModel(model)
def OnEndDragLeft(self, x, y, keys = 0, attachment = 0):
ogl.ShapeEvtHandler.OnEndDragLeft(self, x, y, keys, attachment)
shape = self.GetShape()
if hasattr(shape, "GetModel"): # Workaround, on drag, we should deselect all other objects and select the clicked on object
model = shape.GetModel()
else:
parentShape = shape.GetParent()
if parentShape:
model = parentShape.GetModel()
self._view.SetSelection(model, keys == self.SHIFT_KEY or keys == self.CONTROL_KEY)
def OnMovePost(self, dc, x, y, oldX, oldY, display):
if x == oldX and y == oldY:
return
if not self._view.GetDocument():
return
shape = self.GetShape()
if isinstance(shape, EditorCanvasShapeMixin) and shape.Draggable():
model = shape.GetModel()
if hasattr(model, "getEditorBounds") and model.getEditorBounds():
x, y, w, h = model.getEditorBounds()
newX = shape.GetX() - shape.GetBoundingBoxMax()[0] / 2
newY = shape.GetY() - shape.GetBoundingBoxMax()[1] / 2
newWidth = shape.GetBoundingBoxMax()[0]
newHeight = shape.GetBoundingBoxMax()[1]
if shape._shadowMode != ogl.SHADOW_NONE:
newWidth -= shape._shadowOffsetX
newHeight -= shape._shadowOffsetY
newbounds = (newX, newY, newWidth, newHeight)
if x != newX or y != newY or w != newWidth or h != newHeight:
self._view.GetDocument().GetCommandProcessor().Submit(EditorCanvasUpdateShapeBoundariesCommand(self._view.GetDocument(), model, newbounds))
def Draw(self, dc):
pass
class EditorCanvasUpdateShapeBoundariesCommand(wx.lib.docview.Command):
def __init__(self, canvasDocument, model, newbounds):
wx.lib.docview.Command.__init__(self, canUndo = True)
self._canvasDocument = canvasDocument
self._model = model
self._oldbounds = model.getEditorBounds()
self._newbounds = newbounds
def GetName(self):
name = self._canvasDocument.GetNameForObject(self._model)
if not name:
name = ""
print "ERROR: AbstractEditor.EditorCanvasUpdateShapeBoundariesCommand.GetName: unable to get name for ", self._model
return _("Move/Resize %s") % name
def Do(self):
return self._canvasDocument.UpdateEditorBoundaries(self._model, self._newbounds)
def Undo(self):
return self._canvasDocument.UpdateEditorBoundaries(self._model, self._oldbounds)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,690 @@
#----------------------------------------------------------------------------
# Name: DebuggerHarness.py
# Purpose:
#
# Author: Matt Fryer
#
# Created: 7/28/04
# CVS-ID: $Id$
# Copyright: (c) 2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import bdb
import sys
import SimpleXMLRPCServer
import threading
import xmlrpclib
import os
import types
import Queue
import traceback
import inspect
from xml.dom.minidom import getDOMImplementation
import atexit
import pickle
if sys.platform.startswith("win"):
import win32api
_WINDOWS = True
else:
_WINDOWS = False
_VERBOSE = False
_DEBUG_DEBUGGER = False
class Adb(bdb.Bdb):
def __init__(self, harness, queue):
bdb.Bdb.__init__(self)
self._harness = harness
self._userBreak = False
self._queue = queue
self._knownCantExpandFiles = {}
self._knownExpandedFiles = {}
def getLongName(self, filename):
if not _WINDOWS:
return filename
if self._knownCantExpandFiles.get(filename):
return filename
if self._knownExpandedFiles.get(filename):
return self._knownExpandedFiles.get(filename)
try:
newname = win32api.GetLongPathName(filename)
self._knownExpandedFiles[filename] = newname
return newname
except:
self._knownCantExpandFiles[filename] = filename
return filename
def canonic(self, orig_filename):
if orig_filename == "<" + orig_filename[1:-1] + ">":
return orig_filename
filename = self.getLongName(orig_filename)
canonic = self.fncache.get(filename)
if not canonic:
canonic = os.path.abspath(filename)
canonic = os.path.normcase(canonic)
self.fncache[filename] = canonic
return canonic
# Overriding this so that we continue to trace even if no breakpoints are set.
def set_continue(self):
self.stopframe = self.botframe
self.returnframe = None
self.quitting = 0
def do_clear(self, arg):
bdb.Breakpoint.bpbynumber[int(arg)].deleteMe()
def user_line(self, frame):
if self.in_debugger_code(frame):
self.set_step()
return
message = self.__frame2message(frame)
self._harness.interaction(message, frame, "")
def user_call(self, frame, argument_list):
if self.in_debugger_code(frame):
self.set_step()
return
if self.stop_here(frame):
message = self.__frame2message(frame)
self._harness.interaction(message, frame, "")
def user_return(self, frame, return_value):
if self.in_debugger_code(frame):
self.set_step()
return
message = self.__frame2message(frame)
self._harness.interaction(message, frame, "")
def user_exception(self, frame, (exc_type, exc_value, exc_traceback)):
frame.f_locals['__exception__'] = exc_type, exc_value
if type(exc_type) == type(''):
exc_type_name = exc_type
else:
exc_type_name = exc_type.__name__
message = "Exception occured: " + repr(exc_type_name) + " See locals.__exception__ for details."
traceback.print_exception(exc_type, exc_value, exc_traceback)
self._harness.interaction(message, frame, message)
def in_debugger_code(self, frame):
if _DEBUG_DEBUGGER: return False
message = self.__frame2message(frame)
return message.count('DebuggerHarness') > 0
def frame2message(self, frame):
return self.__frame2message(frame)
def __frame2message(self, frame):
code = frame.f_code
filename = code.co_filename
lineno = frame.f_lineno
basename = os.path.basename(filename)
message = "%s:%s" % (basename, lineno)
if code.co_name != "?":
message = "%s: %s()" % (message, code.co_name)
return message
def runFile(self, fileName):
self.reset()
#global_dict = {}
#global_dict['__name__'] = '__main__'
try:
fileToRun = open(fileName, mode='r')
if _VERBOSE: print "Running file ", fileName
sys.settrace(self.trace_dispatch)
import __main__
exec fileToRun in __main__.__dict__,__main__.__dict__
except SystemExit:
pass
except:
tp, val, tb = sys.exc_info()
traceback.print_exception(tp, val, tb)
sys.settrace(None)
self.quitting = 1
#global_dict.clear()
def trace_dispatch(self, frame, event, arg):
if self.quitting:
return # None
# Check for ui events
self.readQueue()
if event == 'line':
return self.dispatch_line(frame)
if event == 'call':
return self.dispatch_call(frame, arg)
if event == 'return':
return self.dispatch_return(frame, arg)
if event == 'exception':
return self.dispatch_exception(frame, arg)
print 'Adb.dispatch: unknown debugging event:', `event`
return self.trace_dispatch
def readQueue(self):
while self._queue.qsize():
try:
item = self._queue.get_nowait()
if item.kill():
self._harness.do_exit(kill=True)
elif item.breakHere():
self._userBreak = True
elif item.hasBreakpoints():
self.set_all_breakpoints(item.getBreakpoints())
except Queue.Empty:
pass
def set_all_breakpoints(self, dict):
self.clear_all_breaks()
for fileName in dict.keys():
lineList = dict[fileName]
for lineNumber in lineList:
if _VERBOSE: print "Setting break at line ", str(lineNumber), " in file ", self.canonic(fileName)
self.set_break(fileName, int(lineNumber))
return ""
def stop_here(self, frame):
if( self._userBreak ):
return True
# (CT) stopframe may now also be None, see dispatch_call.
# (CT) the former test for None is therefore removed from here.
if frame is self.stopframe:
return True
while frame is not None and frame is not self.stopframe:
if frame is self.botframe:
return True
frame = frame.f_back
return False
class BreakNotify(object):
def __init__(self, bps=None, break_here=False, kill=False):
self._bps = bps
self._break_here = break_here
self._kill = kill
def breakHere(self):
return self._break_here
def kill(self):
return self._kill
def getBreakpoints(self):
return self._bps
def hasBreakpoints(self):
return (self._bps != None)
class AGXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):
def __init__(self, address, logRequests=0):
SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, address, logRequests=logRequests)
class BreakListenerThread(threading.Thread):
def __init__(self, host, port, queue):
threading.Thread.__init__(self)
self._host = host
self._port = int(port)
self._keepGoing = True
self._queue = queue
self._server = AGXMLRPCServer((self._host, self._port), logRequests=0)
self._server.register_function(self.update_breakpoints)
self._server.register_function(self.break_requested)
self._server.register_function(self.die)
def break_requested(self):
bn = BreakNotify(break_here=True)
self._queue.put(bn)
return ""
def update_breakpoints(self, pickled_Binary_bpts):
dict = pickle.loads(pickled_Binary_bpts.data)
bn = BreakNotify(bps=dict)
self._queue.put(bn)
return ""
def die(self):
bn = BreakNotify(kill=True)
self._queue.put(bn)
return ""
def run(self):
while self._keepGoing:
try:
self._server.handle_request()
except:
if _VERBOSE:
tp, val, tb = sys.exc_info()
print "Exception in BreakListenerThread.run():", str(tp), str(val)
self._keepGoing = False
def AskToStop(self):
self._keepGoing = False
if type(self._server) is not types.NoneType:
if _VERBOSE: print "Before calling server close on breakpoint server"
self._server.server_close()
if _VERBOSE: print "Calling server close on breakpoint server"
class DebuggerHarness(object):
def __init__(self):
# Host and port for debugger-side RPC server
self._hostname = sys.argv[1]
self._portNumber = int(sys.argv[2])
# Name the gui proxy object is registered under
self._breakPortNumber = int(sys.argv[3])
# Host and port where the gui proxy can be found.
self._guiHost = sys.argv[4]
self._guiPort = int(sys.argv[5])
# Command to debug.
self._command = sys.argv[6]
# Strip out the harness' arguments so that the process we run will see argv as if
# it was called directly.
sys.argv = sys.argv[6:]
self._currentFrame = None
self._wait = False
# Connect to the gui-side RPC server.
self._guiServerUrl = 'http://' + self._guiHost + ':' + str(self._guiPort) + '/'
if _VERBOSE: print "Connecting to gui server at ", self._guiServerUrl
self._guiServer = xmlrpclib.ServerProxy(self._guiServerUrl,allow_none=1)
# Start the break listener
self._breakQueue = Queue.Queue(50)
self._breakListener = BreakListenerThread(self._hostname, self._breakPortNumber, self._breakQueue)
self._breakListener.start()
# Create the debugger.
self._adb = Adb(self, self._breakQueue)
# Create the debugger-side RPC Server and register functions for remote calls.
self._server = AGXMLRPCServer((self._hostname, self._portNumber), logRequests=0)
self._server.register_function(self.set_step)
self._server.register_function(self.set_continue)
self._server.register_function(self.set_next)
self._server.register_function(self.set_return)
self._server.register_function(self.set_breakpoint)
self._server.register_function(self.clear_breakpoint)
self._server.register_function(self.set_all_breakpoints)
self._server.register_function(self.attempt_introspection)
self._server.register_function(self.add_watch)
self.message_frame_dict = {}
self.introspection_list = []
atexit.register(self.do_exit)
def run(self):
self._adb.runFile(self._command)
self.do_exit(kill=True)
def do_exit(self, kill=False):
self._adb.set_quit()
self._breakListener.AskToStop()
self._server.server_close()
try:
self._guiServer.quit()
except:
pass
if kill:
try:
sys.exit()
except:
pass
def set_breakpoint(self, fileName, lineNo):
self._adb.set_break(fileName, lineNo)
return ""
def set_all_breakpoints(self, dict):
self._adb.clear_all_breaks()
for fileName in dict.keys():
lineList = dict[fileName]
for lineNumber in lineList:
self._adb.set_break(fileName, int(lineNumber))
if _VERBOSE: print "Setting break at ", str(lineNumber), " in file ", fileName
return ""
def clear_breakpoint(self, fileName, lineNo):
self._adb.clear_break(fileName, lineNo)
return ""
def add_watch(self, name, text, frame_message, run_once):
if len(frame_message) > 0:
frame = self.message_frame_dict[frame_message]
try:
item = eval(text, frame.f_globals, frame.f_locals)
return self.get_watch_document(item, name)
except:
tp, val, tb = sys.exc_info()
return self.get_exception_document(tp, val, tb)
return ""
def attempt_introspection(self, frame_message, chain):
try:
frame = self.message_frame_dict[frame_message]
if frame:
name = chain.pop(0)
if name == 'globals':
item = frame.f_globals
elif name == 'locals':
item = frame.f_locals
for name in chain:
item = self.getNextItem(item, name)
return self.get_introspection_document(item, name)
except:
tp, val, tb = sys.exc_info()
traceback.print_exception(tp, val, tb)
return self.get_empty_introspection_document()
def getNextItem(self, link, identifier):
tp = type(link)
if self.isTupleized(identifier):
return self.deTupleize(link, identifier)
else:
if tp == types.DictType or tp == types.DictProxyType:
return link[identifier]
else:
if hasattr(link, identifier):
return getattr(link, identifier)
if _VERBOSE or True: print "Failed to find link ", identifier, " on thing: ", self.saferepr(link), " of type ", repr(type(link))
return None
def isPrimitive(self, item):
tp = type(item)
return tp is types.IntType or tp is types.LongType or tp is types.FloatType \
or tp is types.BooleanType or tp is types.ComplexType \
or tp is types.StringType
def isTupleized(self, value):
return value.count('[')
def deTupleize(self, link, string1):
try:
start = string1.find('[')
end = string1.find(']')
num = int(string1[start+1:end])
return link[num]
except:
tp,val,tb = sys.exc_info()
if _VERBOSE: print "Got exception in deTupleize: ", val
return None
def wrapAndCompress(self, stringDoc):
import bz2
return xmlrpclib.Binary(bz2.compress(stringDoc))
def get_empty_introspection_document(self):
doc = getDOMImplementation().createDocument(None, "replacement", None)
return self.wrapAndCompress(doc.toxml())
def get_watch_document(self, item, identifier):
doc = getDOMImplementation().createDocument(None, "watch", None)
top_element = doc.documentElement
self.addAny(top_element, identifier, item, doc, 2)
return self.wrapAndCompress(doc.toxml())
def get_introspection_document(self, item, identifier):
doc = getDOMImplementation().createDocument(None, "replacement", None)
top_element = doc.documentElement
self.addAny(top_element, identifier, item, doc, 2)
return self.wrapAndCompress(doc.toxml())
def get_exception_document(self, name, tp, val, tb):
stack = traceback.format_exception(tp, val, tb)
wholeStack = ""
for line in stack:
wholeStack += line
doc = getDOMImplementation().createDocument(None, "watch", None)
top_element = doc.documentElement
item_node = doc.createElement("dict_nv_element")
item_node.setAttribute('value', wholeStack)
item_node.setAttribute('name', str(name))
top_element.appendChild(item_node)
def addAny(self, top_element, name, item, doc, ply):
tp = type(item)
if ply < 1:
self.addNode(top_element,name, self.saferepr(item), doc)
elif tp is types.TupleType or tp is types.ListType:
self.addTupleOrList(top_element, name, item, doc, ply - 1)
elif tp is types.DictType or tp is types.DictProxyType:
self.addDict(top_element, name, item, doc, ply -1)
elif inspect.ismodule(item):
self.addModule(top_element, name, item, doc, ply -1)
elif inspect.isclass(item) or tp is types.InstanceType:
self.addClass(top_element, name, item, doc, ply -1)
#elif hasattr(item, '__dict__'):
# self.addDictAttr(top_element, name, item, doc, ply -1)
elif hasattr(item, '__dict__'):
self.addDict(top_element, name, item.__dict__, doc, ply -1)
else:
self.addNode(top_element,name, self.saferepr(item), doc)
def addTupleOrList(self, top_node, name, tupple, doc, ply):
tupleNode = doc.createElement('tuple')
tupleNode.setAttribute('name', str(name))
tupleNode.setAttribute('value', str(type(tupple)))
top_node.appendChild(tupleNode)
count = 0
for item in tupple:
self.addAny(tupleNode, name +'[' + str(count) + ']',item, doc, ply -1)
count += 1
def getFrameXML(self, base_frame):
doc = getDOMImplementation().createDocument(None, "stack", None)
top_element = doc.documentElement
stack = []
frame = base_frame
while frame is not None:
if((frame.f_code.co_filename.count('DebuggerHarness.py') == 0) or _DEBUG_DEBUGGER):
stack.append(frame)
frame = frame.f_back
stack.reverse()
self.message_frame_dict = {}
for f in stack:
self.addFrame(f,top_element, doc)
return doc.toxml()
def addFrame(self, frame, root_element, document):
frameNode = document.createElement('frame')
root_element.appendChild(frameNode)
code = frame.f_code
filename = code.co_filename
frameNode.setAttribute('file', str(filename))
frameNode.setAttribute('line', str(frame.f_lineno))
message = self._adb.frame2message(frame)
frameNode.setAttribute('message', message)
#print "Frame: %s %s %s" %(message, frame.f_lineno, filename)
self.message_frame_dict[message] = frame
self.addDict(frameNode, "locals", frame.f_locals, document, 2)
self.addNode(frameNode, "globals", "", document)
def getRepr(self, varName, globals, locals):
try:
return repr(eval(varName, globals, locals))
except:
return 'Error: Could not recover value.'
def addNode(self, parent_node, name, value, document):
item_node = document.createElement("dict_nv_element")
item_node.setAttribute('value', self.saferepr(value))
item_node.setAttribute('name', str(name))
parent_node.appendChild(item_node)
def addDictAttr(self, root_node, name, thing, document, ply):
dict_node = document.createElement('thing')
root_node.setAttribute('name', name)
root_node.setAttribute('value', str(type(dict)) + " add attr")
self.addDict(root_node, name, thing.__dict__, document, ply) # Not decreminting ply
def saferepr(self, thing):
try:
return repr(thing)
except:
tp, val, tb = sys.exc_info()
return repr(val)
def addDict(self, root_node, name, dict, document, ply):
dict_node = document.createElement('dict')
dict_node.setAttribute('name', name)
dict_node.setAttribute('value', str(type(dict)) + " add dict")
root_node.appendChild(dict_node)
for key in dict.keys():
strkey = str(key)
try:
self.addAny(dict_node, strkey, dict[key], document, ply-1)
except:
tp,val,tb=sys.exc_info()
if _VERBOSE:
print "Error recovering key: ", str(key), " from node ", str(name), " Val = ", str(val)
traceback.print_exception(tp, val, tb)
self.addAny(dict_node, strkey, "Exception getting " + str(name) + "[" + strkey + "]: " + str(val), document, ply -1)
def addClass(self, root_node, name, class_item, document, ply):
item_node = document.createElement('class')
item_node.setAttribute('name', str(name))
root_node.appendChild(item_node)
try:
if hasattr(class_item, '__dict__'):
self.addAny(item_node, '__dict__', class_item.__dict__, document, ply -1)
except:
tp,val,tb=sys.exc_info()
if _VERBOSE:
traceback.print_exception(tp, val, tb)
self.addAny(item_node, '__dict__', "Exception getting __dict__: " + str(val), document, ply -1)
try:
if hasattr(class_item, '__name__'):
self.addAny(item_node,'__name__',class_item.__name__, document, ply -1)
except:
tp,val,tb=sys.exc_info()
if _VERBOSE:
traceback.print_exception(tp, val, tb)
self.addAny(item_node,'__name__',"Exception getting class.__name__: " + val, document, ply -1)
try:
if hasattr(class_item, '__module__'):
self.addAny(item_node, '__module__', class_item.__module__, document, ply -1)
except:
tp,val,tb=sys.exc_info()
if _VERBOSE:
traceback.print_exception(tp, val, tb)
self.addAny(item_node, '__module__', "Exception getting class.__module__: " + val, document, ply -1)
try:
if hasattr(class_item, '__doc__'):
self.addAny(item_node, '__doc__', class_item.__doc__, document, ply -1)
except:
tp,val,tb=sys.exc_info()
if _VERBOSE:
traceback.print_exception(tp, val, tb)
self.addAny(item_node, '__doc__', "Exception getting class.__doc__: " + val, document, ply -1)
try:
if hasattr(class_item, '__bases__'):
self.addAny(item_node, '__bases__', class_item.__bases__, document, ply -1)
except:
tp,val,tb=sys.exc_info()
if _VERBOSE:
traceback.print_exception(tp, val, tb)
self.addAny(item_node, '__bases__', "Exception getting class.__bases__: " + val, document, ply -1)
def addModule(self, root_node, name, module_item, document, ply):
item_node = document.createElement('module')
item_node.setAttribute('name', str(name))
root_node.appendChild(item_node)
try:
if hasattr(module_item, '__file__'):
self.addAny(item_node, '__file__', module_item.__file__, document, ply -1)
except:
pass
try:
if hasattr(module_item, '__doc__'):
self.addAny(item_node,'__doc__', module_item.__doc__, document, ply -1)
except:
pass
# The debugger calls this method when it reaches a breakpoint.
def interaction(self, message, frame, info):
if _VERBOSE:
print 'hit debug side interaction'
self._userBreak = False
self._currentFrame = frame
done = False
while not done:
try:
import bz2
xml = self.getFrameXML(frame)
arg = xmlrpclib.Binary(bz2.compress(xml))
if _VERBOSE:
print '============== calling gui side interaction============'
self._guiServer.interaction(xmlrpclib.Binary(message), arg, info)
if _VERBOSE:
print 'after interaction'
done = True
except:
tp, val, tb = sys.exc_info()
if True or _VERBOSE:
print 'Error contacting GUI server!: '
try:
traceback.print_exception(tp, val, tb)
except:
print "Exception printing traceback",
tp, val, tb = sys.exc_info()
traceback.print_exception(tp, val, tb)
done = False
# Block while waiting to be called back from the GUI. Eventually, self._wait will
# be set false by a function on this side. Seems pretty lame--I'm surprised it works.
self.waitForRPC()
def waitForRPC(self):
self._wait = True
while self._wait :
try:
if _VERBOSE:
print "+++ in harness wait for rpc, before handle_request"
self._server.handle_request()
if _VERBOSE:
print "+++ in harness wait for rpc, after handle_request"
except:
if _VERBOSE:
tp, val, tb = sys.exc_info()
print "Got waitForRpc exception : ", repr(tp), ": ", val
#time.sleep(0.1)
def set_step(self):
self._adb.set_step()
self._wait = False
return ""
def set_continue(self):
self._adb.set_continue()
self._wait = False
return ""
def set_next(self):
self._adb.set_next(self._currentFrame)
self._wait = False
return ""
def set_return(self):
self._adb.set_return(self._currentFrame)
self._wait = False
return ""
if __name__ == '__main__':
try:
harness = DebuggerHarness()
harness.run()
except SystemExit:
print "Exiting..."
except:
tp, val, tb = sys.exc_info()
traceback.print_exception(tp, val, tb)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,446 @@
#----------------------------------------------------------------------------
# Name: IDEFindService.py
# Purpose: Find Service for pydocview
#
# Author: Morgan Hua
#
# Created: 8/15/03
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.lib.docview
import os
from os.path import join
import re
import ProjectEditor
import MessageService
import FindService
import OutlineService
_ = wx.GetTranslation
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
FILENAME_MARKER = _("Found in file: ")
PROJECT_MARKER = _("Searching project: ")
FIND_MATCHDIR = "FindMatchDir"
FIND_MATCHDIRSUBFOLDERS = "FindMatchDirSubfolders"
SPACE = 10
HALF_SPACE = 5
class FindInDirService(FindService.FindService):
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
FINDALL_ID = wx.NewId() # for bringing up Find All dialog box
FINDDIR_ID = wx.NewId() # for bringing up Find Dir dialog box
def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
FindService.FindService.InstallControls(self, frame, menuBar, toolBar, statusBar, document)
editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
wx.EVT_MENU(frame, FindInDirService.FINDALL_ID, self.ProcessEvent)
wx.EVT_UPDATE_UI(frame, FindInDirService.FINDALL_ID, self.ProcessUpdateUIEvent)
editMenu.Append(FindInDirService.FINDALL_ID, _("Find in Project...\tCtrl+Shift+F"), _("Searches for the specified text in all the files in the project"))
wx.EVT_MENU(frame, FindInDirService.FINDDIR_ID, self.ProcessEvent)
wx.EVT_UPDATE_UI(frame, FindInDirService.FINDDIR_ID, self.ProcessUpdateUIEvent)
editMenu.Append(FindInDirService.FINDDIR_ID, _("Find in Directory..."), _("Searches for the specified text in all the files in the directory"))
def ProcessEvent(self, event):
id = event.GetId()
if id == FindInDirService.FINDALL_ID:
self.ShowFindAllDialog()
return True
elif id == FindInDirService.FINDDIR_ID:
self.ShowFindDirDialog()
return True
else:
return FindService.FindService.ProcessEvent(self, event)
def ProcessUpdateUIEvent(self, event):
id = event.GetId()
if id == FindInDirService.FINDALL_ID:
projectService = wx.GetApp().GetService(ProjectEditor.ProjectService)
view = projectService.GetView()
if view and view.GetDocument() and view.GetDocument().GetFiles():
event.Enable(True)
else:
event.Enable(False)
return True
elif id == FindInDirService.FINDDIR_ID:
event.Enable(True)
else:
return FindService.FindService.ProcessUpdateUIEvent(self, event)
def ShowFindDirDialog(self):
config = wx.ConfigBase_Get()
frame = wx.Dialog(None, -1, _("Find in Directory"), size= (320,200))
borderSizer = wx.BoxSizer(wx.HORIZONTAL)
contentSizer = wx.BoxSizer(wx.VERTICAL)
lineSizer = wx.BoxSizer(wx.HORIZONTAL)
lineSizer.Add(wx.StaticText(frame, -1, _("Directory:")), 0, wx.ALIGN_CENTER | wx.RIGHT, HALF_SPACE)
dirCtrl = wx.TextCtrl(frame, -1, config.Read(FIND_MATCHDIR, ""), size=(200,-1))
dirCtrl.SetToolTipString(dirCtrl.GetValue())
lineSizer.Add(dirCtrl, 0, wx.LEFT, HALF_SPACE)
findDirButton = wx.Button(frame, -1, "Browse...")
lineSizer.Add(findDirButton, 0, wx.LEFT, HALF_SPACE)
contentSizer.Add(lineSizer, 0, wx.BOTTOM, SPACE)
def OnBrowseButton(event):
dlg = wx.DirDialog(frame, _("Choose a directory:"), style=wx.DD_DEFAULT_STYLE)
dir = dirCtrl.GetValue()
if len(dir):
dlg.SetPath(dir)
if dlg.ShowModal() == wx.ID_OK:
dirCtrl.SetValue(dlg.GetPath())
dirCtrl.SetToolTipString(dirCtrl.GetValue())
dirCtrl.SetInsertionPointEnd()
dlg.Destroy()
wx.EVT_BUTTON(findDirButton, -1, OnBrowseButton)
subfolderCtrl = wx.CheckBox(frame, -1, _("Search in subfolders"))
subfolderCtrl.SetValue(config.ReadInt(FIND_MATCHDIRSUBFOLDERS, True))
contentSizer.Add(subfolderCtrl, 0, wx.BOTTOM, SPACE)
lineSizer = wx.BoxSizer(wx.VERTICAL) # let the line expand horizontally without vertical expansion
lineSizer.Add(wx.StaticLine(frame, -1, size = (10,-1)), 0, flag=wx.EXPAND)
contentSizer.Add(lineSizer, flag=wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.BOTTOM, border=HALF_SPACE)
lineSizer = wx.BoxSizer(wx.HORIZONTAL)
lineSizer.Add(wx.StaticText(frame, -1, _("Find what:")), 0, wx.ALIGN_CENTER | wx.RIGHT, HALF_SPACE)
findCtrl = wx.TextCtrl(frame, -1, config.Read(FindService.FIND_MATCHPATTERN, ""), size=(200,-1))
lineSizer.Add(findCtrl, 0, wx.LEFT, HALF_SPACE)
contentSizer.Add(lineSizer, 0, wx.BOTTOM, SPACE)
wholeWordCtrl = wx.CheckBox(frame, -1, _("Match whole word only"))
wholeWordCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHWHOLEWORD, False))
matchCaseCtrl = wx.CheckBox(frame, -1, _("Match case"))
matchCaseCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHCASE, False))
regExprCtrl = wx.CheckBox(frame, -1, _("Regular expression"))
regExprCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHREGEXPR, False))
contentSizer.Add(wholeWordCtrl, 0, wx.BOTTOM, SPACE)
contentSizer.Add(matchCaseCtrl, 0, wx.BOTTOM, SPACE)
contentSizer.Add(regExprCtrl, 0, wx.BOTTOM, SPACE)
borderSizer.Add(contentSizer, 0, wx.TOP | wx.BOTTOM | wx.LEFT, SPACE)
buttonSizer = wx.BoxSizer(wx.VERTICAL)
findBtn = wx.Button(frame, wx.ID_OK, _("Find"))
findBtn.SetDefault()
buttonSizer.Add(findBtn, 0, wx.BOTTOM, HALF_SPACE)
buttonSizer.Add(wx.Button(frame, wx.ID_CANCEL, _("Cancel")), 0)
borderSizer.Add(buttonSizer, 0, wx.ALL, SPACE)
frame.SetSizer(borderSizer)
frame.Fit()
status = frame.ShowModal()
passedCheck = False
while status == wx.ID_OK and not passedCheck:
if not os.path.exists(dirCtrl.GetValue()):
dlg = wx.MessageDialog(frame,
_("'%s' does not exist.") % dirCtrl.GetValue(),
_("Find in Directory"),
wx.OK | wx.ICON_EXCLAMATION
)
dlg.ShowModal()
dlg.Destroy()
status = frame.ShowModal()
elif len(findCtrl.GetValue()) == 0:
dlg = wx.MessageDialog(frame,
_("'Find what:' cannot be empty."),
_("Find in Directory"),
wx.OK | wx.ICON_EXCLAMATION
)
dlg.ShowModal()
dlg.Destroy()
status = frame.ShowModal()
else:
passedCheck = True
# save user choice state for this and other Find Dialog Boxes
dirString = dirCtrl.GetValue()
searchSubfolders = subfolderCtrl.IsChecked()
self.SaveFindDirConfig(dirString, searchSubfolders)
findString = findCtrl.GetValue()
matchCase = matchCaseCtrl.IsChecked()
wholeWord = wholeWordCtrl.IsChecked()
regExpr = regExprCtrl.IsChecked()
self.SaveFindConfig(findString, wholeWord, matchCase, regExpr)
if status == wx.ID_OK:
frame.Destroy()
messageService = wx.GetApp().GetService(MessageService.MessageService)
messageService.ShowWindow()
view = messageService.GetView()
if view:
wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
view.ClearLines()
view.SetCallback(self.OnJumpToFoundLine)
view.AddLines(_("Searching for '%s' in '%s'\n\n") % (findString, dirString))
if os.path.isfile(dirString):
try:
docFile = file(dirString, 'r')
lineNum = 1
needToDisplayFilename = True
line = docFile.readline()
while line:
count, foundStart, foundEnd, newText = self.DoFind(findString, None, line, 0, 0, True, matchCase, wholeWord, regExpr)
if count != -1:
if needToDisplayFilename:
view.AddLines(FILENAME_MARKER + dirString + "\n")
needToDisplayFilename = False
line = repr(lineNum).zfill(4) + ":" + line
view.AddLines(line)
line = docFile.readline()
lineNum += 1
if not needToDisplayFilename:
view.AddLines("\n")
except IOError, (code, message):
print _("Warning, unable to read file: '%s'. %s") % (dirString, message)
else:
# do search in files on disk
for root, dirs, files in os.walk(dirString):
if not searchSubfolders and root != dirString:
break
for name in files:
filename = os.path.join(root, name)
try:
docFile = file(filename, 'r')
except IOError, (code, message):
print _("Warning, unable to read file: '%s'. %s") % (filename, message)
continue
lineNum = 1
needToDisplayFilename = True
line = docFile.readline()
while line:
count, foundStart, foundEnd, newText = self.DoFind(findString, None, line, 0, 0, True, matchCase, wholeWord, regExpr)
if count != -1:
if needToDisplayFilename:
view.AddLines(FILENAME_MARKER + filename + "\n")
needToDisplayFilename = False
line = repr(lineNum).zfill(4) + ":" + line
view.AddLines(line)
line = docFile.readline()
lineNum += 1
if not needToDisplayFilename:
view.AddLines("\n")
view.AddLines(_("Search completed."))
wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
return True
else:
frame.Destroy()
return False
def SaveFindDirConfig(self, dirString, searchSubfolders):
""" Save search dir patterns and flags to registry.
dirString = search directory
searchSubfolders = Search subfolders
"""
config = wx.ConfigBase_Get()
config.Write(FIND_MATCHDIR, dirString)
config.WriteInt(FIND_MATCHDIRSUBFOLDERS, searchSubfolders)
def ShowFindAllDialog(self):
config = wx.ConfigBase_Get()
frame = wx.Dialog(None, -1, _("Find in Project"), size= (320,200))
borderSizer = wx.BoxSizer(wx.HORIZONTAL)
contentSizer = wx.BoxSizer(wx.VERTICAL)
lineSizer = wx.BoxSizer(wx.HORIZONTAL)
lineSizer.Add(wx.StaticText(frame, -1, _("Find what:")), 0, wx.ALIGN_CENTER | wx.RIGHT, HALF_SPACE)
findCtrl = wx.TextCtrl(frame, -1, config.Read(FindService.FIND_MATCHPATTERN, ""), size=(200,-1))
lineSizer.Add(findCtrl, 0, wx.LEFT, HALF_SPACE)
contentSizer.Add(lineSizer, 0, wx.BOTTOM, SPACE)
wholeWordCtrl = wx.CheckBox(frame, -1, _("Match whole word only"))
wholeWordCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHWHOLEWORD, False))
matchCaseCtrl = wx.CheckBox(frame, -1, _("Match case"))
matchCaseCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHCASE, False))
regExprCtrl = wx.CheckBox(frame, -1, _("Regular expression"))
regExprCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHREGEXPR, False))
contentSizer.Add(wholeWordCtrl, 0, wx.BOTTOM, SPACE)
contentSizer.Add(matchCaseCtrl, 0, wx.BOTTOM, SPACE)
contentSizer.Add(regExprCtrl, 0, wx.BOTTOM, SPACE)
borderSizer.Add(contentSizer, 0, wx.TOP | wx.BOTTOM | wx.LEFT, SPACE)
buttonSizer = wx.BoxSizer(wx.VERTICAL)
findBtn = wx.Button(frame, wx.ID_OK, _("Find"))
findBtn.SetDefault()
buttonSizer.Add(findBtn, 0, wx.BOTTOM, HALF_SPACE)
buttonSizer.Add(wx.Button(frame, wx.ID_CANCEL, _("Cancel")), 0)
borderSizer.Add(buttonSizer, 0, wx.ALL, SPACE)
frame.SetSizer(borderSizer)
frame.Fit()
status = frame.ShowModal()
# save user choice state for this and other Find Dialog Boxes
findString = findCtrl.GetValue()
matchCase = matchCaseCtrl.IsChecked()
wholeWord = wholeWordCtrl.IsChecked()
regExpr = regExprCtrl.IsChecked()
self.SaveFindConfig(findString, wholeWord, matchCase, regExpr)
if status == wx.ID_OK:
frame.Destroy()
messageService = wx.GetApp().GetService(MessageService.MessageService)
messageService.ShowWindow()
view = messageService.GetView()
if view:
view.ClearLines()
view.SetCallback(self.OnJumpToFoundLine)
projectService = wx.GetApp().GetService(ProjectEditor.ProjectService)
projectFilenames = projectService.GetFilesFromCurrentProject()
projView = projectService.GetView()
if projView:
projName = wx.lib.docview.FileNameFromPath(projView.GetDocument().GetFilename())
view.AddLines(PROJECT_MARKER + projName + "\n\n")
# do search in open files first, open files may have been modified and different from disk because it hasn't been saved
openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
openDocsInProject = filter(lambda openDoc: openDoc.GetFilename() in projectFilenames, openDocs)
for openDoc in openDocsInProject:
if isinstance(openDoc, ProjectEditor.ProjectDocument): # don't search project model
continue
openDocView = openDoc.GetFirstView()
# some views don't have a in memory text object to search through such as the PM and the DM
# even if they do have a non-text searchable object, how do we display it in the message window?
if not hasattr(openDocView, "GetValue"):
continue
text = openDocView.GetValue()
lineNum = 1
needToDisplayFilename = True
start = 0
end = 0
count = 0
while count != -1:
count, foundStart, foundEnd, newText = self.DoFind(findString, None, text, start, end, True, matchCase, wholeWord, regExpr)
if count != -1:
if needToDisplayFilename:
view.AddLines(FILENAME_MARKER + openDoc.GetFilename() + "\n")
needToDisplayFilename = False
lineNum = openDocView.LineFromPosition(foundStart)
line = repr(lineNum).zfill(4) + ":" + openDocView.GetLine(lineNum)
view.AddLines(line)
start = text.find("\n", foundStart)
if start == -1:
break
end = start
if not needToDisplayFilename:
view.AddLines("\n")
openDocNames = map(lambda openDoc: openDoc.GetFilename(), openDocs)
# do search in closed files, skipping the open ones we already searched
filenames = filter(lambda filename: filename not in openDocNames, projectFilenames)
for filename in filenames:
try:
docFile = file(filename, 'r')
except IOError, (code, message):
print _("Warning, unable to read file: '%s'. %s") % (filename, message)
continue
lineNum = 1
needToDisplayFilename = True
line = docFile.readline()
while line:
count, foundStart, foundEnd, newText = self.DoFind(findString, None, line, 0, 0, True, matchCase, wholeWord, regExpr)
if count != -1:
if needToDisplayFilename:
view.AddLines(FILENAME_MARKER + filename + "\n")
needToDisplayFilename = False
line = repr(lineNum).zfill(4) + ":" + line
view.AddLines(line)
line = docFile.readline()
lineNum += 1
if not needToDisplayFilename:
view.AddLines("\n")
view.AddLines(_("Search for '%s' completed.") % findString)
return True
else:
frame.Destroy()
return False
def OnJumpToFoundLine(self, event):
messageService = wx.GetApp().GetService(MessageService.MessageService)
lineText, pos = messageService.GetView().GetCurrLine()
if lineText == "\n" or lineText.find(FILENAME_MARKER) != -1 or lineText.find(PROJECT_MARKER) != -1:
return
lineEnd = lineText.find(":")
if lineEnd == -1:
return
else:
lineNum = int(lineText[0:lineEnd])
text = messageService.GetView().GetText()
curPos = messageService.GetView().GetCurrentPos()
startPos = text.rfind(FILENAME_MARKER, 0, curPos)
endPos = text.find("\n", startPos)
filename = text[startPos + len(FILENAME_MARKER):endPos]
foundView = None
openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
for openDoc in openDocs:
if openDoc.GetFilename() == filename:
foundView = openDoc.GetFirstView()
break
if not foundView:
doc = wx.GetApp().GetDocumentManager().CreateDocument(filename, wx.lib.docview.DOC_SILENT)
foundView = doc.GetFirstView()
if foundView:
foundView.GetFrame().SetFocus()
foundView.Activate()
if hasattr(foundView, "GotoLine"):
foundView.GotoLine(lineNum)
startPos = foundView.PositionFromLine(lineNum)
# wxBug: Need to select in reverse order, (end, start) to put cursor at head of line so positioning is correct
# Also, if we use the correct positioning order (start, end), somehow, when we open a edit window for the first
# time, we don't see the selection, it is scrolled off screen
foundView.SetSelection(startPos - 1 + len(lineText[lineEnd:].rstrip("\n")), startPos)
wx.GetApp().GetService(OutlineService.OutlineService).LoadOutline(foundView, position=startPos)

View File

@@ -0,0 +1,521 @@
#----------------------------------------------------------------------------
# Name: FindService.py
# Purpose: Find Service for pydocview
#
# Author: Peter Yared, Morgan Hua
#
# Created: 8/15/03
# CVS-ID: $Id$
# Copyright: (c) 2003-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.lib.docview
import wx.lib.pydocview
import re
_ = wx.GetTranslation
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
FIND_MATCHPATTERN = "FindMatchPattern"
FIND_MATCHREPLACE = "FindMatchReplace"
FIND_MATCHCASE = "FindMatchCase"
FIND_MATCHWHOLEWORD = "FindMatchWholeWordOnly"
FIND_MATCHREGEXPR = "FindMatchRegularExpr"
FIND_MATCHWRAP = "FindMatchWrap"
FIND_MATCHUPDOWN = "FindMatchUpDown"
FIND_SYNTAXERROR = -2
SPACE = 10
HALF_SPACE = 5
#----------------------------------------------------------------------------
# Classes
#----------------------------------------------------------------------------
class FindService(wx.lib.pydocview.DocService):
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
FIND_ID = wx.NewId() # for bringing up Find dialog box
FINDONE_ID = wx.NewId() # for doing Find
FIND_PREVIOUS_ID = wx.NewId() # for doing Find Next
FIND_NEXT_ID = wx.NewId() # for doing Find Prev
REPLACE_ID = wx.NewId() # for bringing up Replace dialog box
REPLACEONE_ID = wx.NewId() # for doing a Replace
REPLACEALL_ID = wx.NewId() # for doing Replace All
GOTO_LINE_ID = wx.NewId() # for bringing up Goto dialog box
# Extending bitmasks: wx.FR_WHOLEWORD, wx.FR_MATCHCASE, and wx.FR_DOWN
FR_REGEXP = max([wx.FR_WHOLEWORD, wx.FR_MATCHCASE, wx.FR_DOWN]) << 1
FR_WRAP = FR_REGEXP << 1
def __init__(self):
self._replaceDialog = None
self._findDialog = None
self._findReplaceData = wx.FindReplaceData()
self._findReplaceData.SetFlags(wx.FR_DOWN)
def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
""" Install Find Service Menu Items """
editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
editMenu.AppendSeparator()
editMenu.Append(FindService.FIND_ID, _("&Find...\tCtrl+F"), _("Finds the specified text"))
wx.EVT_MENU(frame, FindService.FIND_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, FindService.FIND_ID, frame.ProcessUpdateUIEvent)
editMenu.Append(FindService.FIND_PREVIOUS_ID, _("Find &Previous\tShift+F3"), _("Finds the specified text"))
wx.EVT_MENU(frame, FindService.FIND_PREVIOUS_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, FindService.FIND_PREVIOUS_ID, frame.ProcessUpdateUIEvent)
editMenu.Append(FindService.FIND_NEXT_ID, _("Find &Next\tF3"), _("Finds the specified text"))
wx.EVT_MENU(frame, FindService.FIND_NEXT_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, FindService.FIND_NEXT_ID, frame.ProcessUpdateUIEvent)
editMenu.Append(FindService.REPLACE_ID, _("R&eplace...\tCtrl+H"), _("Replaces specific text with different text"))
wx.EVT_MENU(frame, FindService.REPLACE_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, FindService.REPLACE_ID, frame.ProcessUpdateUIEvent)
editMenu.Append(FindService.GOTO_LINE_ID, _("&Go to Line...\tCtrl+G"), _("Goes to a certain line in the file"))
wx.EVT_MENU(frame, FindService.GOTO_LINE_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, FindService.GOTO_LINE_ID, frame.ProcessUpdateUIEvent)
# wxBug: wxToolBar::GetToolPos doesn't exist, need it to find cut tool and then insert find in front of it.
toolBar.InsertTool(6, FindService.FIND_ID, getFindBitmap(), shortHelpString = _("Find"), longHelpString = _("Finds the specified text"))
toolBar.InsertSeparator(6)
toolBar.Realize()
frame.Bind(wx.EVT_FIND, frame.ProcessEvent)
frame.Bind(wx.EVT_FIND_NEXT, frame.ProcessEvent)
frame.Bind(wx.EVT_FIND_REPLACE, frame.ProcessEvent)
frame.Bind(wx.EVT_FIND_REPLACE_ALL, frame.ProcessEvent)
def ProcessUpdateUIEvent(self, event):
id = event.GetId()
if id == FindService.FIND_ID:
event.Enable(False)
return True
elif id == FindService.FIND_PREVIOUS_ID:
event.Enable(False)
return True
elif id == FindService.FIND_NEXT_ID:
event.Enable(False)
return True
elif id == FindService.REPLACE_ID:
event.Enable(False)
return True
elif id == FindService.GOTO_LINE_ID:
event.Enable(False)
return True
else:
return False
def ShowFindReplaceDialog(self, findString="", replace = False):
""" Display find/replace dialog box.
Parameters: findString is the default value shown in the find/replace dialog input field.
If replace is True, the replace dialog box is shown, otherwise only the find dialog box is shown.
"""
if replace:
if self._findDialog != None:
# No reason to have both find and replace dialogs up at the same time
self._findDialog.DoClose()
self._findDialog = None
self._replaceDialog = FindReplaceDialog(self.GetDocumentManager().FindSuitableParent(), -1, _("Replace"), size=(320,200), findString=findString)
self._replaceDialog.Show(True)
else:
if self._replaceDialog != None:
# No reason to have both find and replace dialogs up at the same time
self._replaceDialog.DoClose()
self._replaceDialog = None
self._findDialog = FindDialog(self.GetDocumentManager().FindSuitableParent(), -1, _("Find"), size=(320,200), findString=findString)
self._findDialog.Show(True)
def OnFindClose(self, event):
""" Cleanup handles when find/replace dialog is closed """
if self._findDialog != None:
self._findDialog = None
elif self._replaceDialog != None:
self._replaceDialog = None
def GetCurrentDialog(self):
""" return handle to either the find or replace dialog """
if self._findDialog != None:
return self._findDialog
return self._replaceDialog
def GetLineNumber(self, parent):
""" Display Goto Line Number dialog box """
line = -1
dialog = wx.TextEntryDialog(parent, _("Enter line number to go to:"), _("Go to Line"))
if dialog.ShowModal() == wx.ID_OK:
try:
line = int(dialog.GetValue())
if line > 65535:
line = 65535
except:
pass
dialog.Destroy()
# This one is ugly: wx.GetNumberFromUser("", _("Enter line number to go to:"), _("Go to Line"), 1, min = 1, max = 65535, parent = parent)
return line
def DoFind(self, findString, replaceString, text, startLoc, endLoc, down, matchCase, wholeWord, regExpr = False, replace = False, replaceAll = False, wrap = False):
""" Do the actual work of the find/replace.
Returns the tuple (count, start, end, newText).
count = number of string replacements
start = start position of found string
end = end position of found string
newText = new replaced text
"""
flags = 0
if regExpr:
pattern = findString
else:
pattern = re.escape(findString) # Treat the strings as a literal string
if not matchCase:
flags = re.IGNORECASE
if wholeWord:
pattern = r"\b%s\b" % pattern
try:
reg = re.compile(pattern, flags)
except:
# syntax error of some sort
import sys
msgTitle = wx.GetApp().GetAppName()
if not msgTitle:
msgTitle = _("Regular Expression Search")
wx.MessageBox(_("Invalid regular expression \"%s\". %s") % (pattern, sys.exc_value),
msgTitle,
wx.OK | wx.ICON_EXCLAMATION,
self.GetView())
return FIND_SYNTAXERROR, None, None, None
if replaceAll:
newText, count = reg.subn(replaceString, text)
if count == 0:
return -1, None, None, None
else:
return count, None, None, newText
start = -1
if down:
match = reg.search(text, endLoc)
if match == None:
if wrap: # try again, but this time from top of file
match = reg.search(text, 0)
if match == None:
return -1, None, None, None
else:
return -1, None, None, None
start = match.start()
end = match.end()
else:
match = reg.search(text)
if match == None:
return -1, None, None, None
found = None
i, j = match.span()
while i < startLoc and j <= startLoc:
found = match
if i == j:
j = j + 1
match = reg.search(text, j)
if match == None:
break
i, j = match.span()
if found == None:
if wrap: # try again, but this time from bottom of file
match = reg.search(text, startLoc)
if match == None:
return -1, None, None, None
found = None
i, j = match.span()
end = len(text)
while i < end and j <= end:
found = match
if i == j:
j = j + 1
match = reg.search(text, j)
if match == None:
break
i, j = match.span()
if found == None:
return -1, None, None, None
else:
return -1, None, None, None
start = found.start()
end = found.end()
if replace and start != -1:
newText, count = reg.subn(replaceString, text, 1)
return count, start, end, newText
return 0, start, end, None
def SaveFindConfig(self, findString, wholeWord, matchCase, regExpr = None, wrap = None, upDown = None, replaceString = None):
""" Save find/replace patterns and search flags to registry.
findString = search pattern
wholeWord = match whole word only
matchCase = match case
regExpr = use regular expressions in search pattern
wrap = return to top/bottom of file on search
upDown = search up or down from current cursor position
replaceString = replace string
"""
config = wx.ConfigBase_Get()
config.Write(FIND_MATCHPATTERN, findString)
config.WriteInt(FIND_MATCHCASE, matchCase)
config.WriteInt(FIND_MATCHWHOLEWORD, wholeWord)
if replaceString != None:
config.Write(FIND_MATCHREPLACE, replaceString)
if regExpr != None:
config.WriteInt(FIND_MATCHREGEXPR, regExpr)
if wrap != None:
config.WriteInt(FIND_MATCHWRAP, wrap)
if upDown != None:
config.WriteInt(FIND_MATCHUPDOWN, upDown)
def GetFindString(self):
""" Load the search pattern from registry """
return wx.ConfigBase_Get().Read(FIND_MATCHPATTERN, "")
def GetReplaceString(self):
""" Load the replace pattern from registry """
return wx.ConfigBase_Get().Read(FIND_MATCHREPLACE, "")
def GetFlags(self):
""" Load search parameters from registry """
config = wx.ConfigBase_Get()
flags = 0
if config.ReadInt(FIND_MATCHWHOLEWORD, False):
flags = flags | wx.FR_WHOLEWORD
if config.ReadInt(FIND_MATCHCASE, False):
flags = flags | wx.FR_MATCHCASE
if config.ReadInt(FIND_MATCHUPDOWN, False):
flags = flags | wx.FR_DOWN
if config.ReadInt(FIND_MATCHREGEXPR, False):
flags = flags | FindService.FR_REGEXP
if config.ReadInt(FIND_MATCHWRAP, False):
flags = flags | FindService.FR_WRAP
return flags
class FindDialog(wx.Dialog):
""" Find Dialog with regular expression matching and wrap to top/bottom of file. """
def __init__(self, parent, id, title, size, findString=None):
wx.Dialog.__init__(self, parent, id, title, size=size)
config = wx.ConfigBase_Get()
borderSizer = wx.BoxSizer(wx.VERTICAL)
gridSizer = wx.GridBagSizer(SPACE, SPACE)
lineSizer = wx.BoxSizer(wx.HORIZONTAL)
lineSizer.Add(wx.StaticText(self, -1, _("Find what:")), 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, SPACE)
if not findString:
findString = config.Read(FIND_MATCHPATTERN, "")
self._findCtrl = wx.TextCtrl(self, -1, findString, size=(200,-1))
lineSizer.Add(self._findCtrl, 0)
gridSizer.Add(lineSizer, pos=(0,0), span=(1,2))
choiceSizer = wx.BoxSizer(wx.VERTICAL)
self._wholeWordCtrl = wx.CheckBox(self, -1, _("Match whole word only"))
self._wholeWordCtrl.SetValue(config.ReadInt(FIND_MATCHWHOLEWORD, False))
self._matchCaseCtrl = wx.CheckBox(self, -1, _("Match case"))
self._matchCaseCtrl.SetValue(config.ReadInt(FIND_MATCHCASE, False))
self._regExprCtrl = wx.CheckBox(self, -1, _("Regular expression"))
self._regExprCtrl.SetValue(config.ReadInt(FIND_MATCHREGEXPR, False))
self._wrapCtrl = wx.CheckBox(self, -1, _("Wrap"))
self._wrapCtrl.SetValue(config.ReadInt(FIND_MATCHWRAP, False))
choiceSizer.Add(self._wholeWordCtrl, 0, wx.BOTTOM, SPACE)
choiceSizer.Add(self._matchCaseCtrl, 0, wx.BOTTOM, SPACE)
choiceSizer.Add(self._regExprCtrl, 0, wx.BOTTOM, SPACE)
choiceSizer.Add(self._wrapCtrl, 0)
gridSizer.Add(choiceSizer, pos=(1,0), span=(2,1))
self._radioBox = wx.RadioBox(self, -1, _("Direction"), choices = ["Up", "Down"])
self._radioBox.SetSelection(config.ReadInt(FIND_MATCHUPDOWN, 1))
gridSizer.Add(self._radioBox, pos=(1,1), span=(2,1))
buttonSizer = wx.BoxSizer(wx.VERTICAL)
findBtn = wx.Button(self, FindService.FINDONE_ID, _("Find Next"))
findBtn.SetDefault()
wx.EVT_BUTTON(self, FindService.FINDONE_ID, self.OnActionEvent)
cancelBtn = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
wx.EVT_BUTTON(self, wx.ID_CANCEL, self.OnClose)
buttonSizer.Add(findBtn, 0, wx.BOTTOM, HALF_SPACE)
buttonSizer.Add(cancelBtn, 0)
gridSizer.Add(buttonSizer, pos=(0,2), span=(3,1))
borderSizer.Add(gridSizer, 0, wx.ALL, SPACE)
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.SetSizer(borderSizer)
self.Fit()
self._findCtrl.SetFocus()
def SaveConfig(self):
""" Save find patterns and search flags to registry. """
findService = wx.GetApp().GetService(FindService)
if findService:
findService.SaveFindConfig(self._findCtrl.GetValue(),
self._wholeWordCtrl.IsChecked(),
self._matchCaseCtrl.IsChecked(),
self._regExprCtrl.IsChecked(),
self._wrapCtrl.IsChecked(),
self._radioBox.GetSelection(),
)
def DoClose(self):
self.SaveConfig()
self.Destroy()
def OnClose(self, event):
findService = wx.GetApp().GetService(FindService)
if findService:
findService.OnFindClose(event)
self.DoClose()
def OnActionEvent(self, event):
self.SaveConfig()
if wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_MDI:
if wx.GetApp().GetTopWindow().ProcessEvent(event):
return True
else:
view = wx.GetApp().GetDocumentManager().GetLastActiveView()
if view and view.ProcessEvent(event):
return True
return False
class FindReplaceDialog(FindDialog):
""" Find/Replace Dialog with regular expression matching and wrap to top/bottom of file. """
def __init__(self, parent, id, title, size, findString=None):
wx.Dialog.__init__(self, parent, id, title, size=size)
config = wx.ConfigBase_Get()
borderSizer = wx.BoxSizer(wx.VERTICAL)
gridSizer = wx.GridBagSizer(SPACE, SPACE)
gridSizer2 = wx.GridBagSizer(SPACE, SPACE)
gridSizer2.Add(wx.StaticText(self, -1, _("Find what:")), flag=wx.ALIGN_CENTER_VERTICAL, pos=(0,0))
if not findString:
findString = config.Read(FIND_MATCHPATTERN, "")
self._findCtrl = wx.TextCtrl(self, -1, findString, size=(200,-1))
gridSizer2.Add(self._findCtrl, pos=(0,1))
gridSizer2.Add(wx.StaticText(self, -1, _("Replace with:")), flag=wx.ALIGN_CENTER_VERTICAL, pos=(1,0))
self._replaceCtrl = wx.TextCtrl(self, -1, config.Read(FIND_MATCHREPLACE, ""), size=(200,-1))
gridSizer2.Add(self._replaceCtrl, pos=(1,1))
gridSizer.Add(gridSizer2, pos=(0,0), span=(1,2))
choiceSizer = wx.BoxSizer(wx.VERTICAL)
self._wholeWordCtrl = wx.CheckBox(self, -1, _("Match whole word only"))
self._wholeWordCtrl.SetValue(config.ReadInt(FIND_MATCHWHOLEWORD, False))
self._matchCaseCtrl = wx.CheckBox(self, -1, _("Match case"))
self._matchCaseCtrl.SetValue(config.ReadInt(FIND_MATCHCASE, False))
self._regExprCtrl = wx.CheckBox(self, -1, _("Regular expression"))
self._regExprCtrl.SetValue(config.ReadInt(FIND_MATCHREGEXPR, False))
self._wrapCtrl = wx.CheckBox(self, -1, _("Wrap"))
self._wrapCtrl.SetValue(config.ReadInt(FIND_MATCHWRAP, False))
choiceSizer.Add(self._wholeWordCtrl, 0, wx.BOTTOM, SPACE)
choiceSizer.Add(self._matchCaseCtrl, 0, wx.BOTTOM, SPACE)
choiceSizer.Add(self._regExprCtrl, 0, wx.BOTTOM, SPACE)
choiceSizer.Add(self._wrapCtrl, 0)
gridSizer.Add(choiceSizer, pos=(1,0), span=(2,1))
self._radioBox = wx.RadioBox(self, -1, _("Direction"), choices = ["Up", "Down"])
self._radioBox.SetSelection(config.ReadInt(FIND_MATCHUPDOWN, 1))
gridSizer.Add(self._radioBox, pos=(1,1), span=(2,1))
buttonSizer = wx.BoxSizer(wx.VERTICAL)
findBtn = wx.Button(self, FindService.FINDONE_ID, _("Find Next"))
findBtn.SetDefault()
wx.EVT_BUTTON(self, FindService.FINDONE_ID, self.OnActionEvent)
cancelBtn = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
wx.EVT_BUTTON(self, wx.ID_CANCEL, self.OnClose)
replaceBtn = wx.Button(self, FindService.REPLACEONE_ID, _("Replace"))
wx.EVT_BUTTON(self, FindService.REPLACEONE_ID, self.OnActionEvent)
replaceAllBtn = wx.Button(self, FindService.REPLACEALL_ID, _("Replace All"))
wx.EVT_BUTTON(self, FindService.REPLACEALL_ID, self.OnActionEvent)
buttonSizer.Add(findBtn, 0, wx.BOTTOM, HALF_SPACE)
buttonSizer.Add(replaceBtn, 0, wx.BOTTOM, HALF_SPACE)
buttonSizer.Add(replaceAllBtn, 0, wx.BOTTOM, HALF_SPACE)
buttonSizer.Add(cancelBtn, 0)
gridSizer.Add(buttonSizer, pos=(0,2), span=(3,1))
borderSizer.Add(gridSizer, 0, wx.ALL, SPACE)
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.SetSizer(borderSizer)
self.Fit()
self._findCtrl.SetFocus()
def SaveConfig(self):
""" Save find/replace patterns and search flags to registry. """
findService = wx.GetApp().GetService(FindService)
if findService:
findService.SaveFindConfig(self._findCtrl.GetValue(),
self._wholeWordCtrl.IsChecked(),
self._matchCaseCtrl.IsChecked(),
self._regExprCtrl.IsChecked(),
self._wrapCtrl.IsChecked(),
self._radioBox.GetSelection(),
self._replaceCtrl.GetValue()
)
#----------------------------------------------------------------------------
# Menu Bitmaps - generated by encode_bitmaps.py
#----------------------------------------------------------------------------
from wx import ImageFromStream, BitmapFromImage
import cStringIO
def getFindData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x00\x81IDAT8\x8d\xa5S\xc1\x16\xc0\x10\x0ckk\xff\xff\xc7d\x87\xad^U\r\
\x93S\xe5U$\n\xb3$:\xc1e\x17(\x19Z\xb3$\x9e\xf1DD\xe2\x15\x01x\xea\x93\xef\
\x04\x989\xea\x1b\xf2U\xc0\xda\xb4\xeb\x11\x1f:\xd8\xb5\xff8\x93\xd4\xa9\xae\
@/S\xaaUwJ3\x85\xc0\x81\xee\xeb.q\x17C\x81\xd5XU \x1a\x93\xc6\x18\x8d\x90\
\xe8}\x89\x00\x9a&\x9b_k\x94\x0c\xdf\xd78\xf8\x0b\x99Y\xb4\x08c\x9e\xfe\xc6\
\xe3\x087\xf9\xd0D\x180\xf1#\x8e\x00\x00\x00\x00IEND\xaeB`\x82'
def getFindBitmap():
return BitmapFromImage(getFindImage())
def getFindImage():
stream = cStringIO.StringIO(getFindData())
return ImageFromStream(stream)

View File

@@ -0,0 +1,222 @@
#----------------------------------------------------------------------------
# Name: HtmlEditor.py
# Purpose: Abstract Code Editor for pydocview tbat uses the Styled Text Control
#
# Author: Peter Yared
#
# Created: 8/15/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import os.path
import string
import STCTextEditor
import CodeEditor
_ = wx.GetTranslation
class HtmlDocument(CodeEditor.CodeDocument):
pass
class HtmlView(CodeEditor.CodeView):
def GetCtrlClass(self):
""" Used in split window to instantiate new instances """
return HtmlCtrl
def GetAutoCompleteHint(self):
pos = self.GetCtrl().GetCurrentPos()
if pos == 0:
return None, None
validLetters = string.letters + string.digits + '_!-'
word = ''
while (True):
pos = pos - 1
if pos < 0:
break
char = chr(self.GetCtrl().GetCharAt(pos))
if char not in validLetters:
break
word = char + word
return None, word
def GetAutoCompleteDefaultKeywords(self):
return HTMLKEYWORDS
## def _CreateControl(self, parent, id):
## import wx # wxBug: When inlining the import of the appropriate html control below, have to specifically import wx for some reason
## self._notebook = wx.Notebook(parent, wx.NewId(), style = wx.NB_BOTTOM)
## self._textEditor = HtmlCtrl(self._notebook, id)
## if wx.Platform =='__WXMSW__':
## import wxPython.iewin
## self._browserCtrl = wxPython.iewin.wxIEHtmlWin(self._notebook, -1, style = wx.NO_FULL_REPAINT_ON_RESIZE)
## else:
## import wx.html
## self._browserCtrl = wx.html.HtmlWindow(self._notebook, -1, style = wx.NO_FULL_REPAINT_ON_RESIZE)
## self._notebook.AddPage(self._textEditor, _("Edit"))
## self._notebook.AddPage(self._browserCtrl, _("View"))
## self._insertMode = True
## wx.EVT_NOTEBOOK_PAGE_CHANGED(self._notebook, self._notebook.GetId(), self.OnNotebookChanging)
## return self._textEditor
##
##
## def _CreateSizer(self, frame):
## sizer = wx.BoxSizer(wx.HORIZONTAL)
## sizer.Add(self._notebook, 1, wx.EXPAND)
## frame.SetSizer(sizer)
## frame.SetAutoLayout(True)
##
##
## def OnNotebookChanging(self, event):
## if event.GetSelection() == 0: # Going to the edit page
## pass # self._textEditor.Refresh()
## elif event.GetSelection() == 1: # Going to the browser page
## text = self._textEditor.GetText()
## if wx.Platform == '__WXMSW__':
## path = os.path.join(tempfile.gettempdir(), "temp.html")
## file = open(path, 'w')
## file.write(text)
## file.close()
## self._browserCtrl.Navigate("file://" + path)
## else:
## self._browserCtrl.SetPage(text)
## event.Skip()
class HtmlService(CodeEditor.CodeService):
def __init__(self):
CodeEditor.CodeService.__init__(self)
class HtmlCtrl(CodeEditor.CodeCtrl):
def __init__(self, parent, ID = -1, style = wx.NO_FULL_REPAINT_ON_RESIZE):
CodeEditor.CodeCtrl.__init__(self, parent, ID, style)
self.SetLexer(wx.stc.STC_LEX_HTML)
self.SetProperty("fold.html", "1")
def GetMatchingBraces(self):
return "<>[]{}()"
def CanWordWrap(self):
return True
def SetViewDefaults(self):
CodeEditor.CodeCtrl.SetViewDefaults(self, configPrefix = "Html", hasWordWrap = False, hasTabs = True)
def GetFontAndColorFromConfig(self):
return CodeEditor.CodeCtrl.GetFontAndColorFromConfig(self, configPrefix = "Html")
def UpdateStyles(self):
CodeEditor.CodeCtrl.UpdateStyles(self)
if not self.GetFont():
return
faces = { 'font' : self.GetFont().GetFaceName(),
'size' : self.GetFont().GetPointSize(),
'size2': self.GetFont().GetPointSize() - 2,
'color' : "%02x%02x%02x" % (self.GetFontColor().Red(), self.GetFontColor().Green(), self.GetFontColor().Blue())
}
# White space
self.StyleSetSpec(wx.stc.STC_H_DEFAULT, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
# Comment
self.StyleSetSpec(wx.stc.STC_H_COMMENT, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces)
# Number
self.StyleSetSpec(wx.stc.STC_H_NUMBER, "face:%(font)s,fore:#007F7F,size:%(size)d" % faces)
# String
self.StyleSetSpec(wx.stc.STC_H_SINGLESTRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_H_DOUBLESTRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
# Tag
self.StyleSetSpec(wx.stc.STC_H_TAG, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces)
# Attributes
self.StyleSetSpec(wx.stc.STC_H_ATTRIBUTE, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces)
class HtmlOptionsPanel(STCTextEditor.TextOptionsPanel):
def __init__(self, parent, id):
STCTextEditor.TextOptionsPanel.__init__(self, parent, id, configPrefix = "Html", label = "HTML", hasWordWrap = True, hasTabs = True)
HTMLKEYWORDS = [
"A", "ABBR", "ACRONYM", "ADDRESS", "APPLET", "AREA", "B", "BASE", "BASEFONT", "BDO", "BIG", "BLOCKQUOTE",
"BODY", "BR", "BUTTON", "CAPTION", "CENTER", "CITE", "CODE", "COL", "COLGROUP", "DD", "DEL", "DFN", "DIR",
"DIV", "DL", "DT", "EM", "FIELDSET", "FONT", "FORM", "FRAME", "FRAMESET", "H1", "H2", "H3", "H4", "H5", "H6",
"HEAD", "HR", "HTML", "I", "IFRAME", "IMG", "INPUT", "INS", "ISINDEX", "KBD", "LABEL", "LEGEND", "LI", "LINK",
"MAP", "MENU", "META", "NOFRAMES", "NOSCRIPT", "OBJECT", "OL", "OPTGROUP", "OPTION", "P", "PARAM",
"PRE", "Q", "S", "SAMP", "SCRIPT", "SELECT", "SMALL", "SPAN", "STRIKE", "STRONG", "STYLE", "SUB", "SUP",
"TABLE", "TBODY", "TD", "TEXTAREA", "TFOOT", "TH", "THEAD", "TITLE", "TR", "TT", "U", "UL", "VAR", "XML",
"XMLNS", "ACCEPT-CHARSET", "ACCEPT", "ACCESSKEY", "ACTION", "ALIGN", "ALINK", "ALT",
"ARCHIVE", "AXIS", "BACKGROUND", "BGCOLOR", "BORDER", "CELLPADDING", "CELLSPACING", "CHAR",
"CHAROFF", "CHARSET", "CHECKED", "CLASS", "CLASSID", "CLEAR", "CODEBASE", "CODETYPE",
"COLOR", "COLS", "COLSPAN", "COMPACT", "CONTENT", "COORDS", "DATA", "DATAFLD", "DATAFORMATAS",
"DATAPAGESIZE", "DATASRC", "DATETIME", "DECLARE", "DEFER", "DISABLED", "ENCTYPE",
"EVENT", "FACE", "FOR", "FRAMEBORDER", "HEADERS", "HEIGHT", "HREF", "HREFLANG", "HSPACE",
"HTTP-EQUIV", "ID", "ISMAP", "LANG", "LANGUAGE", "LEFTMARGIN", "LONGDESC",
"MARGINWIDTH", "MARGINHEIGHT", "MAXLENGTH", "MEDIA", "METHOD", "MULTIPLE", "NAME", "NOHREF",
"NORESIZE", "NOSHADE", "NOWRAP", "ONBLUR", "ONCHANGE", "ONCLICK", "ONDBLCLICK",
"ONFOCUS", "ONKEYDOWN", "ONKEYPRESS", "ONKEYUP", "ONLOAD", "ONMOUSEDOWN", "ONMOUSEMOVE",
"ONMOUSEOVER", "ONMOUSEOUT", "ONMOUSEUP", "ONRESET", "ONSELECT", "ONSUBMIT", "ONUNLOAD",
"PROFILE", "PROMPT", "READONLY", "REL", "REV", "ROWS", "ROWSPAN", "RULES", "SCHEME", "SCOPE",
"SELECTED", "SHAPE", "SIZE", "SRC", "STANDBY", "START", "SUMMARY", "TABINDEX",
"TARGET", "TOPMARGIN", "TYPE", "USEMAP", "VALIGN", "VALUE", "VALUETYPE",
"VERSION", "VLINK", "VSPACE", "WIDTH", "TEXT", "PASSWORD", "CHECKBOX", "RADIO", "SUBMIT", "RESET",
"FILE", "HIDDEN", "IMAGE", "PUBLIC", "!DOCTYPE",
"ADD_DATE", "LAST_MODIFIED", "LAST_VISIT"
]
#----------------------------------------------------------------------------
# Icon Bitmaps - generated by encode_bitmaps.py
#----------------------------------------------------------------------------
from wx import ImageFromStream, BitmapFromImage
from wx import EmptyIcon
import cStringIO
def getHTMLData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x00\xcdIDAT8\x8dcd`f\xf8\xcf@\x01`\xfc\x7f\xa3\x87"\x03X\xfe}\xbeI\x89~\
\x06&\x8at\x0f\n\x03\x18\xe4\x954\xff\xc3\x00\x8c-\xaf\xa4\xf9_\xc7\xc0\xfc\
\xbf\x93\xab\xf7\xff\xff\xff\xff\xff70\xb6\xfe\x7f\xed\xce\x93\xff\xd7\xee<\
\xf9\xafc`\x0eW\xf3\xf5\xd7\xff\xff,\x0f\x1f^gPP\xd6B1\xf4\xc1\xddk\x0c\xf6\
\xb6\x16\x0c{wma````x\xf7\xfc\x06\xc3\xea\xa5\xb3\x198\xd8X\x18\xbe~|\x06W\
\xc7\xc5\xca\xc0\xc0\xc2\xc0\xc0\xc0P\\\x9c\xcf\xf0\xf4\xc5\x1b\x86\x15K\x97\
\xc2%Y\xd9y\xe0lF\x0e1\x86C\x87\x8e0\x88\x88\x8a3\xfccD\x88\xe3\xf4\x026\xf6\
\xa9c{\xfe_<s\x18\xc5\x9b\xf2J\x9a\xff\x19\xff\x9eN\xa5(!\r|4\x0e\x03\x03\
\x00R\xe4{\xe74\x9e\xbb\xd1\x00\x00\x00\x00IEND\xaeB`\x82'
def getHTMLBitmap():
return BitmapFromImage(getHTMLImage())
def getHTMLImage():
stream = cStringIO.StringIO(getHTMLData())
return ImageFromStream(stream)
def getHTMLIcon():
icon = EmptyIcon()
icon.CopyFromBitmap(getHTMLBitmap())
return icon

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,445 @@
#----------------------------------------------------------------------------
# Name: IDEFindService.py
# Purpose: Find Service for pydocview
#
# Author: Morgan Hua
#
# Created: 8/15/03
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.lib.docview
import os
from os.path import join
import re
import ProjectEditor
import MessageService
import FindService
import OutlineService
_ = wx.GetTranslation
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
FILENAME_MARKER = _("Found in file: ")
PROJECT_MARKER = _("Searching project: ")
FIND_MATCHDIR = "FindMatchDir"
FIND_MATCHDIRSUBFOLDERS = "FindMatchDirSubfolders"
SPACE = 10
HALF_SPACE = 5
class IDEFindService(FindService.FindService):
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
FINDALL_ID = wx.NewId() # for bringing up Find All dialog box
FINDDIR_ID = wx.NewId() # for bringing up Find Dir dialog box
def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
FindService.FindService.InstallControls(self, frame, menuBar, toolBar, statusBar, document)
editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
wx.EVT_MENU(frame, IDEFindService.FINDALL_ID, self.ProcessEvent)
wx.EVT_UPDATE_UI(frame, IDEFindService.FINDALL_ID, self.ProcessUpdateUIEvent)
editMenu.Append(IDEFindService.FINDALL_ID, _("Find in Project...\tCtrl+Shift+F"), _("Searches for the specified text in all the files in the project"))
wx.EVT_MENU(frame, IDEFindService.FINDDIR_ID, self.ProcessEvent)
wx.EVT_UPDATE_UI(frame, IDEFindService.FINDDIR_ID, self.ProcessUpdateUIEvent)
editMenu.Append(IDEFindService.FINDDIR_ID, _("Find in Directory..."), _("Searches for the specified text in all the files in the directory"))
def ProcessEvent(self, event):
id = event.GetId()
if id == IDEFindService.FINDALL_ID:
self.ShowFindAllDialog()
return True
elif id == IDEFindService.FINDDIR_ID:
self.ShowFindDirDialog()
return True
else:
return FindService.FindService.ProcessEvent(self, event)
def ProcessUpdateUIEvent(self, event):
id = event.GetId()
if id == IDEFindService.FINDALL_ID:
projectService = wx.GetApp().GetService(ProjectEditor.ProjectService)
view = projectService.GetView()
if view and view.GetDocument() and view.GetDocument().GetFiles():
event.Enable(True)
else:
event.Enable(False)
return True
elif id == IDEFindService.FINDDIR_ID:
event.Enable(True)
else:
return FindService.FindService.ProcessUpdateUIEvent(self, event)
def ShowFindDirDialog(self):
config = wx.ConfigBase_Get()
frame = wx.Dialog(None, -1, _("Find in Directory"), size= (320,200))
borderSizer = wx.BoxSizer(wx.HORIZONTAL)
contentSizer = wx.BoxSizer(wx.VERTICAL)
lineSizer = wx.BoxSizer(wx.HORIZONTAL)
lineSizer.Add(wx.StaticText(frame, -1, _("Directory:")), 0, wx.ALIGN_CENTER | wx.RIGHT, HALF_SPACE)
dirCtrl = wx.TextCtrl(frame, -1, config.Read(FIND_MATCHDIR, ""), size=(200,-1))
dirCtrl.SetToolTipString(dirCtrl.GetValue())
lineSizer.Add(dirCtrl, 0, wx.LEFT, HALF_SPACE)
findDirButton = wx.Button(frame, -1, "Browse...")
lineSizer.Add(findDirButton, 0, wx.LEFT, HALF_SPACE)
contentSizer.Add(lineSizer, 0, wx.BOTTOM, SPACE)
def OnBrowseButton(event):
dlg = wx.DirDialog(frame, _("Choose a directory:"), style=wx.DD_DEFAULT_STYLE)
dir = dirCtrl.GetValue()
if len(dir):
dlg.SetPath(dir)
if dlg.ShowModal() == wx.ID_OK:
dirCtrl.SetValue(dlg.GetPath())
dirCtrl.SetToolTipString(dirCtrl.GetValue())
dirCtrl.SetInsertionPointEnd()
dlg.Destroy()
wx.EVT_BUTTON(findDirButton, -1, OnBrowseButton)
subfolderCtrl = wx.CheckBox(frame, -1, _("Search in subfolders"))
subfolderCtrl.SetValue(config.ReadInt(FIND_MATCHDIRSUBFOLDERS, True))
contentSizer.Add(subfolderCtrl, 0, wx.BOTTOM, SPACE)
lineSizer = wx.BoxSizer(wx.VERTICAL) # let the line expand horizontally without vertical expansion
lineSizer.Add(wx.StaticLine(frame, -1, size = (10,-1)), 0, flag=wx.EXPAND)
contentSizer.Add(lineSizer, flag=wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.BOTTOM, border=HALF_SPACE)
lineSizer = wx.BoxSizer(wx.HORIZONTAL)
lineSizer.Add(wx.StaticText(frame, -1, _("Find what:")), 0, wx.ALIGN_CENTER | wx.RIGHT, HALF_SPACE)
findCtrl = wx.TextCtrl(frame, -1, config.Read(FindService.FIND_MATCHPATTERN, ""), size=(200,-1))
lineSizer.Add(findCtrl, 0, wx.LEFT, HALF_SPACE)
contentSizer.Add(lineSizer, 0, wx.BOTTOM, SPACE)
wholeWordCtrl = wx.CheckBox(frame, -1, _("Match whole word only"))
wholeWordCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHWHOLEWORD, False))
matchCaseCtrl = wx.CheckBox(frame, -1, _("Match case"))
matchCaseCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHCASE, False))
regExprCtrl = wx.CheckBox(frame, -1, _("Regular expression"))
regExprCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHREGEXPR, False))
contentSizer.Add(wholeWordCtrl, 0, wx.BOTTOM, SPACE)
contentSizer.Add(matchCaseCtrl, 0, wx.BOTTOM, SPACE)
contentSizer.Add(regExprCtrl, 0, wx.BOTTOM, SPACE)
borderSizer.Add(contentSizer, 0, wx.TOP | wx.BOTTOM | wx.LEFT, SPACE)
buttonSizer = wx.BoxSizer(wx.VERTICAL)
findBtn = wx.Button(frame, wx.ID_OK, _("Find"))
findBtn.SetDefault()
buttonSizer.Add(findBtn, 0, wx.BOTTOM, HALF_SPACE)
buttonSizer.Add(wx.Button(frame, wx.ID_CANCEL, _("Cancel")), 0)
borderSizer.Add(buttonSizer, 0, wx.ALL, SPACE)
frame.SetSizer(borderSizer)
frame.Fit()
status = frame.ShowModal()
# save user choice state for this and other Find Dialog Boxes
dirString = dirCtrl.GetValue()
searchSubfolders = subfolderCtrl.IsChecked()
self.SaveFindDirConfig(dirString, searchSubfolders)
findString = findCtrl.GetValue()
matchCase = matchCaseCtrl.IsChecked()
wholeWord = wholeWordCtrl.IsChecked()
regExpr = regExprCtrl.IsChecked()
self.SaveFindConfig(findString, wholeWord, matchCase, regExpr)
while not os.path.exists(dirString):
dlg = wx.MessageDialog(frame,
_("'%s' does not exist.") % dirString,
_("Find in Directory"),
wx.OK | wx.ICON_EXCLAMATION
)
dlg.ShowModal()
dlg.Destroy()
status = frame.ShowModal()
# save user choice state for this and other Find Dialog Boxes
dirString = dirCtrl.GetValue()
searchSubfolders = subfolderCtrl.IsChecked()
self.SaveFindDirConfig(dirString, searchSubfolders)
findString = findCtrl.GetValue()
matchCase = matchCaseCtrl.IsChecked()
wholeWord = wholeWordCtrl.IsChecked()
regExpr = regExprCtrl.IsChecked()
self.SaveFindConfig(findString, wholeWord, matchCase, regExpr)
if status == wx.ID_CANCEL:
break
if status == wx.ID_OK:
frame.Destroy()
messageService = wx.GetApp().GetService(MessageService.MessageService)
messageService.ShowWindow()
view = messageService.GetView()
if view:
wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
view.ClearLines()
view.SetCallback(self.OnJumpToFoundLine)
view.AddLines(_("Searching for '%s' in '%s'\n\n") % (findString, dirString))
if os.path.isfile(dirString):
try:
docFile = file(dirString, 'r')
lineNum = 1
needToDisplayFilename = True
line = docFile.readline()
while line:
count, foundStart, foundEnd, newText = self.DoFind(findString, None, line, 0, 0, True, matchCase, wholeWord, regExpr)
if count != -1:
if needToDisplayFilename:
view.AddLines(FILENAME_MARKER + dirString + "\n")
needToDisplayFilename = False
line = repr(lineNum).zfill(4) + ":" + line
view.AddLines(line)
line = docFile.readline()
lineNum += 1
if not needToDisplayFilename:
view.AddLines("\n")
except IOError, (code, message):
print _("Warning, unable to read file: '%s'. %s") % (dirString, message)
else:
# do search in files on disk
for root, dirs, files in os.walk(dirString):
if not searchSubfolders and root != dirString:
break
for name in files:
filename = os.path.join(root, name)
try:
docFile = file(filename, 'r')
except IOError, (code, message):
print _("Warning, unable to read file: '%s'. %s") % (filename, message)
continue
lineNum = 1
needToDisplayFilename = True
line = docFile.readline()
while line:
count, foundStart, foundEnd, newText = self.DoFind(findString, None, line, 0, 0, True, matchCase, wholeWord, regExpr)
if count != -1:
if needToDisplayFilename:
view.AddLines(FILENAME_MARKER + filename + "\n")
needToDisplayFilename = False
line = repr(lineNum).zfill(4) + ":" + line
view.AddLines(line)
line = docFile.readline()
lineNum += 1
if not needToDisplayFilename:
view.AddLines("\n")
view.AddLines(_("Search completed."))
wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
return True
else:
frame.Destroy()
return False
def SaveFindDirConfig(self, dirString, searchSubfolders):
""" Save search dir patterns and flags to registry.
dirString = search directory
searchSubfolders = Search subfolders
"""
config = wx.ConfigBase_Get()
config.Write(FIND_MATCHDIR, dirString)
config.WriteInt(FIND_MATCHDIRSUBFOLDERS, searchSubfolders)
def ShowFindAllDialog(self):
config = wx.ConfigBase_Get()
frame = wx.Dialog(None, -1, _("Find in Project"), size= (320,200))
borderSizer = wx.BoxSizer(wx.HORIZONTAL)
contentSizer = wx.BoxSizer(wx.VERTICAL)
lineSizer = wx.BoxSizer(wx.HORIZONTAL)
lineSizer.Add(wx.StaticText(frame, -1, _("Find what:")), 0, wx.ALIGN_CENTER | wx.RIGHT, HALF_SPACE)
findCtrl = wx.TextCtrl(frame, -1, config.Read(FindService.FIND_MATCHPATTERN, ""), size=(200,-1))
lineSizer.Add(findCtrl, 0, wx.LEFT, HALF_SPACE)
contentSizer.Add(lineSizer, 0, wx.BOTTOM, SPACE)
wholeWordCtrl = wx.CheckBox(frame, -1, _("Match whole word only"))
wholeWordCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHWHOLEWORD, False))
matchCaseCtrl = wx.CheckBox(frame, -1, _("Match case"))
matchCaseCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHCASE, False))
regExprCtrl = wx.CheckBox(frame, -1, _("Regular expression"))
regExprCtrl.SetValue(config.ReadInt(FindService.FIND_MATCHREGEXPR, False))
contentSizer.Add(wholeWordCtrl, 0, wx.BOTTOM, SPACE)
contentSizer.Add(matchCaseCtrl, 0, wx.BOTTOM, SPACE)
contentSizer.Add(regExprCtrl, 0, wx.BOTTOM, SPACE)
borderSizer.Add(contentSizer, 0, wx.TOP | wx.BOTTOM | wx.LEFT, SPACE)
buttonSizer = wx.BoxSizer(wx.VERTICAL)
findBtn = wx.Button(frame, wx.ID_OK, _("Find"))
findBtn.SetDefault()
buttonSizer.Add(findBtn, 0, wx.BOTTOM, HALF_SPACE)
buttonSizer.Add(wx.Button(frame, wx.ID_CANCEL, _("Cancel")), 0)
borderSizer.Add(buttonSizer, 0, wx.ALL, SPACE)
frame.SetSizer(borderSizer)
frame.Fit()
status = frame.ShowModal()
# save user choice state for this and other Find Dialog Boxes
findString = findCtrl.GetValue()
matchCase = matchCaseCtrl.IsChecked()
wholeWord = wholeWordCtrl.IsChecked()
regExpr = regExprCtrl.IsChecked()
self.SaveFindConfig(findString, wholeWord, matchCase, regExpr)
if status == wx.ID_OK:
frame.Destroy()
messageService = wx.GetApp().GetService(MessageService.MessageService)
messageService.ShowWindow()
view = messageService.GetView()
if view:
view.ClearLines()
view.SetCallback(self.OnJumpToFoundLine)
projectService = wx.GetApp().GetService(ProjectEditor.ProjectService)
projectFilenames = projectService.GetFilesFromCurrentProject()
projView = projectService.GetView()
if projView:
projName = wx.lib.docview.FileNameFromPath(projView.GetDocument().GetFilename())
view.AddLines(PROJECT_MARKER + projName + "\n\n")
# do search in open files first, open files may have been modified and different from disk because it hasn't been saved
openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
openDocsInProject = filter(lambda openDoc: openDoc.GetFilename() in projectFilenames, openDocs)
for openDoc in openDocsInProject:
if isinstance(openDoc, ProjectEditor.ProjectDocument): # don't search project model
continue
openDocView = openDoc.GetFirstView()
# some views don't have a in memory text object to search through such as the PM and the DM
# even if they do have a non-text searchable object, how do we display it in the message window?
if not hasattr(openDocView, "GetValue"):
continue
text = openDocView.GetValue()
lineNum = 1
needToDisplayFilename = True
start = 0
end = 0
count = 0
while count != -1:
count, foundStart, foundEnd, newText = self.DoFind(findString, None, text, start, end, True, matchCase, wholeWord, regExpr)
if count != -1:
if needToDisplayFilename:
view.AddLines(FILENAME_MARKER + openDoc.GetFilename() + "\n")
needToDisplayFilename = False
lineNum = openDocView.LineFromPosition(foundStart)
line = repr(lineNum).zfill(4) + ":" + openDocView.GetLine(lineNum)
view.AddLines(line)
start = text.find("\n", foundStart)
if start == -1:
break
end = start
if not needToDisplayFilename:
view.AddLines("\n")
openDocNames = map(lambda openDoc: openDoc.GetFilename(), openDocs)
# do search in closed files, skipping the open ones we already searched
filenames = filter(lambda filename: filename not in openDocNames, projectFilenames)
for filename in filenames:
try:
docFile = file(filename, 'r')
except IOError, (code, message):
print _("Warning, unable to read file: '%s'. %s") % (filename, message)
continue
lineNum = 1
needToDisplayFilename = True
line = docFile.readline()
while line:
count, foundStart, foundEnd, newText = self.DoFind(findString, None, line, 0, 0, True, matchCase, wholeWord, regExpr)
if count != -1:
if needToDisplayFilename:
view.AddLines(FILENAME_MARKER + filename + "\n")
needToDisplayFilename = False
line = repr(lineNum).zfill(4) + ":" + line
view.AddLines(line)
line = docFile.readline()
lineNum += 1
if not needToDisplayFilename:
view.AddLines("\n")
view.AddLines(_("Search for '%s' completed.") % findString)
return True
else:
frame.Destroy()
return False
def OnJumpToFoundLine(self, event):
messageService = wx.GetApp().GetService(MessageService.MessageService)
lineText, pos = messageService.GetView().GetCurrLine()
if lineText == "\n" or lineText.find(FILENAME_MARKER) != -1 or lineText.find(PROJECT_MARKER) != -1:
return
lineEnd = lineText.find(":")
if lineEnd == -1:
return
else:
lineNum = int(lineText[0:lineEnd])
text = messageService.GetView().GetText()
curPos = messageService.GetView().GetCurrentPos()
startPos = text.rfind(FILENAME_MARKER, 0, curPos)
endPos = text.find("\n", startPos)
filename = text[startPos + len(FILENAME_MARKER):endPos]
foundView = None
openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
for openDoc in openDocs:
if openDoc.GetFilename() == filename:
foundView = openDoc.GetFirstView()
break
if not foundView:
doc = wx.GetApp().GetDocumentManager().CreateDocument(filename, wx.lib.docview.DOC_SILENT)
foundView = doc.GetFirstView()
if foundView:
foundView.GetFrame().SetFocus()
foundView.Activate()
if hasattr(foundView, "GotoLine"):
foundView.GotoLine(lineNum)
startPos = foundView.PositionFromLine(lineNum)
# wxBug: Need to select in reverse order, (end, start) to put cursor at head of line so positioning is correct
# Also, if we use the correct positioning order (start, end), somehow, when we open a edit window for the first
# time, we don't see the selection, it is scrolled off screen
foundView.SetSelection(startPos - 1 + len(lineText[lineEnd:].rstrip("\n")), startPos)
wx.GetApp().GetService(OutlineService.OutlineService).LoadOutline(foundView, position=startPos)

View File

@@ -0,0 +1,93 @@
#----------------------------------------------------------------------------
# Name: ImageEditor.py
# Purpose: Image Editor for pydocview
#
# Author: Morgan Hua
#
# Created: 12/24/04
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# CVS-ID: $Id$
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.lib.docview
_ = wx.GetTranslation
class ImageDocument(wx.lib.docview.Document):
pass
class ImageView(wx.lib.docview.View):
#----------------------------------------------------------------------------
# Overridden methods
#----------------------------------------------------------------------------
def __init__(self):
wx.lib.docview.View.__init__(self)
self._ctrl = None
def OnCreate(self, doc, flags):
if len(doc.GetFilename()) == 0:
wx.MessageBox(_("Cannot create a new image file.\n%s has no paint capability.") % wx.GetApp().GetAppName(),
_("New Image File"),
wx.OK | wx.ICON_EXCLAMATION)
return False
frame = wx.GetApp().CreateDocumentFrame(self, doc, flags)
panel = wx.Panel(frame, -1)
bitmap = wx.Image(doc.GetFilename()).ConvertToBitmap()
self._ctrl = wx.StaticBitmap(panel, -1, bitmap, (0,0), (bitmap.GetWidth(), bitmap.GetHeight()))
panel.SetClientSize(bitmap.GetSize())
frame.SetClientSize(panel.GetSize())
self.Activate()
return True
def OnClose(self, deleteWindow = True):
statusC = wx.GetApp().CloseChildDocuments(self.GetDocument())
statusP = wx.lib.docview.View.OnClose(self, deleteWindow = deleteWindow)
if not (statusC and statusP):
return False
self.Activate(False)
if deleteWindow:
self.GetFrame().Destroy()
return True
#----------------------------------------------------------------------------
# Icon Bitmaps - generated by encode_bitmaps.py
#----------------------------------------------------------------------------
from wx import ImageFromStream, BitmapFromImage
from wx import EmptyIcon
import cStringIO
def getImageData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x0f\x00\x00\x00\x0e\x08\x06\
\x00\x00\x00\xf0\x8aF\xef\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x00\x97IDAT(\x91\x9d\x93Q\n\xc4 \x0cD\'\xda\xd3\xa9\xe9ac\xdb\x8bx\xa0\
\xf4C"\xd6mAw@\x0c1/\t\x03\x123+\x16\x95s\x06\x00l\x00p\x9c\x17\xad\xc0\xe4<\
R\x0c\xeaf\x81\x14\x83\xa6\x18\x1e[N\xc1)\x06\x15\x01Dj\xbc\x04\x7fi\x9b):\
\xce\x8b\xf6\xbdN\xec\xfd\x99\x82G\xc8\xf4\xba\xf6\x9b9o\xfa\x81\xab9\x02\
\x11i\xe6|6cf%\xe7A\xce\x83\x99\xd5\xc4\xccZJ\xd11\xd7\xd76\xd8\x8aJ)\xed\
\xb6c\x8d,~\xc0\xe3\xe3L\xdc\xe0~\xcaJ\x03\xfa\xe7c\x98n\x01\x88\xc6k\xb1\
\x83\x04\x87\x00\x00\x00\x00IEND\xaeB`\x82'
def getImageBitmap():
return BitmapFromImage(getImageImage())
def getImageImage():
stream = cStringIO.StringIO(getImageData())
return ImageFromStream(stream)
def getImageIcon():
icon = EmptyIcon()
icon.CopyFromBitmap(getImageBitmap())
return icon

View File

@@ -0,0 +1,91 @@
#----------------------------------------------------------------------------
# Name: MarkerService.py
# Purpose: Adding and removing line markers in text for easy searching
#
# Author: Morgan Hua
#
# Created: 10/6/03
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.stc
import wx.lib.docview
import wx.lib.pydocview
import STCTextEditor
_ = wx.GetTranslation
class MarkerService(wx.lib.pydocview.DocService):
MARKERTOGGLE_ID = wx.NewId()
MARKERDELALL_ID = wx.NewId()
MARKERNEXT_ID = wx.NewId()
MARKERPREV_ID = wx.NewId()
def __init__(self):
pass
def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
if document and document.GetDocumentTemplate().GetDocumentType() != STCTextEditor.TextDocument:
return
if not document and wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
return
editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
editMenu.AppendSeparator()
editMenu.Append(MarkerService.MARKERTOGGLE_ID, _("Toggle &Marker\tCtrl+M"), _("Toggles a jump marker to text line"))
wx.EVT_MENU(frame, MarkerService.MARKERTOGGLE_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, MarkerService.MARKERTOGGLE_ID, frame.ProcessUpdateUIEvent)
editMenu.Append(MarkerService.MARKERDELALL_ID, _("Clear Markers"), _("Removes all jump markers from selected file"))
wx.EVT_MENU(frame, MarkerService.MARKERDELALL_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, MarkerService.MARKERDELALL_ID, frame.ProcessUpdateUIEvent)
editMenu.Append(MarkerService.MARKERNEXT_ID, _("Marker Next\tF4"), _("Moves to next marker in selected file"))
wx.EVT_MENU(frame, MarkerService.MARKERNEXT_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, MarkerService.MARKERNEXT_ID, frame.ProcessUpdateUIEvent)
editMenu.Append(MarkerService.MARKERPREV_ID, _("Marker Previous\tShift+F4"), _("Moves to previous marker in selected file"))
wx.EVT_MENU(frame, MarkerService.MARKERPREV_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, MarkerService.MARKERPREV_ID, frame.ProcessUpdateUIEvent)
def ProcessEvent(self, event):
id = event.GetId()
if id == MarkerService.MARKERTOGGLE_ID:
wx.GetApp().GetDocumentManager().GetCurrentView().MarkerToggle()
return True
elif id == MarkerService.MARKERDELALL_ID:
wx.GetApp().GetDocumentManager().GetCurrentView().MarkerDeleteAll()
return True
elif id == MarkerService.MARKERNEXT_ID:
wx.GetApp().GetDocumentManager().GetCurrentView().MarkerNext()
return True
elif id == MarkerService.MARKERPREV_ID:
wx.GetApp().GetDocumentManager().GetCurrentView().MarkerPrevious()
return True
else:
return False
def ProcessUpdateUIEvent(self, event):
id = event.GetId()
if id == MarkerService.MARKERTOGGLE_ID:
view = wx.GetApp().GetDocumentManager().GetCurrentView()
event.Enable(hasattr(view, "MarkerToggle"))
return True
elif id == MarkerService.MARKERDELALL_ID:
view = wx.GetApp().GetDocumentManager().GetCurrentView()
event.Enable(hasattr(view, "MarkerDeleteAll") and view.GetMarkerCount())
return True
elif id == MarkerService.MARKERNEXT_ID:
view = wx.GetApp().GetDocumentManager().GetCurrentView()
event.Enable(hasattr(view, "MarkerNext") and view.GetMarkerCount())
return True
elif id == MarkerService.MARKERPREV_ID:
view = wx.GetApp().GetDocumentManager().GetCurrentView()
event.Enable(hasattr(view, "MarkerPrevious") and view.GetMarkerCount())
return True
else:
return False

View File

@@ -0,0 +1,143 @@
#----------------------------------------------------------------------------
# Name: MessageService.py
# Purpose: Message View Service for pydocview
#
# Author: Morgan Hua
#
# Created: 9/2/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import Service
import STCTextEditor
class MessageView(Service.ServiceView):
""" Reusable Message View for any document.
When an item is selected, the document view is called back (with DoSelectCallback) to highlight and display the corresponding item in the document view.
"""
#----------------------------------------------------------------------------
# Overridden methods
#----------------------------------------------------------------------------
def _CreateControl(self, parent, id):
txtCtrl = STCTextEditor.TextCtrl(parent, id)
txtCtrl.SetMarginWidth(1, 0) # hide line numbers
txtCtrl.SetReadOnly(True)
if wx.Platform == '__WXMSW__':
font = "Courier New"
else:
font = "Courier"
txtCtrl.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = font))
txtCtrl.SetFontColor(wx.BLACK)
txtCtrl.StyleClearAll()
txtCtrl.UpdateStyles()
return txtCtrl
## def ProcessEvent(self, event):
## stcControl = self.GetControl()
## if not isinstance(stcControl, wx.stc.StyledTextCtrl):
## return wx.lib.docview.View.ProcessUpdateUIEvent(self, event)
## id = event.GetId()
## if id == wx.ID_CUT:
## stcControl.Cut()
## return True
## elif id == wx.ID_COPY:
## stcControl.Copy()
## return True
## elif id == wx.ID_PASTE:
## stcControl.Paste()
## return True
## elif id == wx.ID_CLEAR:
## stcControl.Clear()
## return True
## elif id == wx.ID_SELECTALL:
## stcControl.SetSelection(0, -1)
## return True
##
##
## def ProcessUpdateUIEvent(self, event):
## stcControl = self.GetControl()
## if not isinstance(stcControl, wx.stc.StyledTextCtrl):
## return wx.lib.docview.View.ProcessUpdateUIEvent(self, event)
## id = event.GetId()
## if id == wx.ID_CUT:
## event.Enable(stcControl.CanCut())
## return True
## elif id == wx.ID_COPY:
## event.Enable(stcControl.CanCopy())
## return True
## elif id == wx.ID_PASTE:
## event.Enable(stcControl.CanPaste())
## return True
## elif id == wx.ID_CLEAR:
## event.Enable(True) # wxBug: should be stcControl.CanCut()) but disabling clear item means del key doesn't work in control as expected
## return True
## elif id == wx.ID_SELECTALL:
## event.Enable(stcControl.GetTextLength() > 0)
## return True
#----------------------------------------------------------------------------
# Service specific methods
#----------------------------------------------------------------------------
def ClearLines(self):
self.GetControl().SetReadOnly(False)
self.GetControl().ClearAll()
self.GetControl().SetReadOnly(True)
def AddLines(self, text):
self.GetControl().SetReadOnly(False)
self.GetControl().AddText(text)
self.GetControl().SetReadOnly(True)
def GetText(self):
return self.GetControl().GetText()
def GetCurrentPos(self):
return self.GetControl().GetCurrentPos()
def GetCurrLine(self):
return self.GetControl().GetCurLine()
#----------------------------------------------------------------------------
# Callback Methods
#----------------------------------------------------------------------------
def SetCallback(self, callback):
""" Sets in the event table for a doubleclick to invoke the given callback.
Additional calls to this method overwrites the previous entry and only the last set callback will be invoked.
"""
wx.stc.EVT_STC_DOUBLECLICK(self.GetControl(), self.GetControl().GetId(), callback)
class MessageService(Service.Service):
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
SHOW_WINDOW = wx.NewId() # keep this line for each subclass, need unique ID for each Service
#----------------------------------------------------------------------------
# Overridden methods
#----------------------------------------------------------------------------
def _CreateView(self):
return MessageView(self)

View File

@@ -0,0 +1,520 @@
#----------------------------------------------------------------------------
# Name: OutlineService.py
# Purpose: Outline View Service for pydocview
#
# Author: Morgan Hua
#
# Created: 8/3/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.lib.docview
import wx.lib.pydocview
import Service
_ = wx.GetTranslation
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
SORT_NONE = 0
SORT_ASC = 1
SORT_DESC = 2
class OutlineView(Service.ServiceView):
""" Reusable Outline View for any document.
As a default, it uses a modified tree control (OutlineTreeCtrl) that allows sorting.
Subclass OutlineTreeCtrl to customize the tree control and call SetTreeCtrl to install a customized tree control.
When an item is selected, the document view is called back (with DoSelectCallback) to highlight and display the corresponding item in the document view.
"""
#----------------------------------------------------------------------------
# Overridden methods
#----------------------------------------------------------------------------
def __init__(self, service):
Service.ServiceView.__init__(self, service)
self._actionOnSelect = True
def _CreateControl(self, parent, id):
treeCtrl = OutlineTreeCtrl(parent, id)
wx.EVT_TREE_SEL_CHANGED(treeCtrl, treeCtrl.GetId(), self.DoSelection)
wx.EVT_SET_FOCUS(treeCtrl, self.DoSelection)
wx.EVT_ENTER_WINDOW(treeCtrl, treeCtrl.CallDoLoadOutlineCallback)
wx.EVT_RIGHT_DOWN(treeCtrl, self.OnRightClick)
return treeCtrl
#----------------------------------------------------------------------------
# Service specific methods
#----------------------------------------------------------------------------
def OnRightClick(self, event):
menu = wx.Menu()
menu.AppendRadioItem(OutlineService.SORT_NONE, _("Unsorted"), _("Display items in original order"))
menu.AppendRadioItem(OutlineService.SORT_ASC, _("Sort A-Z"), _("Display items in ascending order"))
menu.AppendRadioItem(OutlineService.SORT_DESC, _("Sort Z-A"), _("Display items in descending order"))
config = wx.ConfigBase_Get()
sort = config.ReadInt("OutlineSort", SORT_NONE)
if sort == SORT_NONE:
menu.Check(OutlineService.SORT_NONE, True)
elif sort == SORT_ASC:
menu.Check(OutlineService.SORT_ASC, True)
elif sort == SORT_DESC:
menu.Check(OutlineService.SORT_DESC, True)
self.GetControl().PopupMenu(menu, event.GetPosition())
menu.Destroy()
#----------------------------------------------------------------------------
# Tree Methods
#----------------------------------------------------------------------------
def DoSelection(self, event):
if not self._actionOnSelect:
return
item = self.GetControl().GetSelection()
if item:
self.GetControl().CallDoSelectCallback(item)
def ResumeActionOnSelect(self):
self._actionOnSelect = True
def StopActionOnSelect(self):
self._actionOnSelect = False
def SetTreeCtrl(self, tree):
self.SetControl(tree)
wx.EVT_TREE_SEL_CHANGED(self.GetControl(), self.GetControl().GetId(), self.DoSelection)
wx.EVT_ENTER_WINDOW(self.GetControl(), treeCtrl.CallDoLoadOutlineCallback)
wx.EVT_RIGHT_DOWN(self.GetControl(), self.OnRightClick)
def GetTreeCtrl(self):
return self.GetControl()
def OnSort(self, sortOrder):
treeCtrl = self.GetControl()
treeCtrl.SetSortOrder(sortOrder)
treeCtrl.SortAllChildren(treeCtrl.GetRootItem())
def ClearTreeCtrl(self):
if self.GetControl():
self.GetControl().DeleteAllItems()
def GetExpansionState(self):
expanded = []
treeCtrl = self.GetControl()
if not treeCtrl:
return expanded
parentItem = treeCtrl.GetRootItem()
if not parentItem:
return expanded
if not treeCtrl.IsExpanded(parentItem):
return expanded
expanded.append(treeCtrl.GetItemText(parentItem))
(child, cookie) = treeCtrl.GetFirstChild(parentItem)
while child.IsOk():
if treeCtrl.IsExpanded(child):
expanded.append(treeCtrl.GetItemText(child))
(child, cookie) = treeCtrl.GetNextChild(parentItem, cookie)
return expanded
def SetExpansionState(self, expanded):
if not expanded or len(expanded) == 0:
return
treeCtrl = self.GetControl()
parentItem = treeCtrl.GetRootItem()
if expanded[0] != treeCtrl.GetItemText(parentItem):
return
(child, cookie) = treeCtrl.GetFirstChild(parentItem)
while child.IsOk():
if treeCtrl.GetItemText(child) in expanded:
treeCtrl.Expand(child)
(child, cookie) = treeCtrl.GetNextChild(parentItem, cookie)
# wxBug: This causes a crash, tried using ScrollTo which crashed as well. Then tried calling it with wx.CallAfter and that crashed as well, with both EnsureVisible and ScrollTo
# self.GetControl().EnsureVisible(self.GetControl().GetRootItem())
# So doing the following massive hack which forces the treectrl to scroll up to the top item
treeCtrl.Collapse(parentItem)
treeCtrl.Expand(parentItem)
class OutlineTreeCtrl(wx.TreeCtrl):
""" Default Tree Control Class for OutlineView.
This class has the added functionality of sorting by the labels
"""
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
ORIG_ORDER = 0
VIEW = 1
CALLBACKDATA = 2
#----------------------------------------------------------------------------
# Overridden Methods
#----------------------------------------------------------------------------
def __init__(self, parent, id, style=wx.TR_HAS_BUTTONS|wx.TR_DEFAULT_STYLE):
wx.TreeCtrl.__init__(self, parent, id, style = style)
self._origOrderIndex = 0
self._sortOrder = SORT_NONE
def DeleteAllItems(self):
self._origOrderIndex = 0
wx.TreeCtrl.DeleteAllItems(self)
#----------------------------------------------------------------------------
# Sort Methods
#----------------------------------------------------------------------------
def SetSortOrder(self, sortOrder = SORT_NONE):
""" Sort Order constants are defined at top of file """
self._sortOrder = sortOrder
def OnCompareItems(self, item1, item2):
if self._sortOrder == SORT_ASC:
return cmp(self.GetItemText(item1).lower(), self.GetItemText(item2).lower()) # sort A-Z
elif self._sortOrder == SORT_DESC:
return cmp(self.GetItemText(item2).lower(), self.GetItemText(item1).lower()) # sort Z-A
else:
return (self.GetPyData(item1)[self.ORIG_ORDER] > self.GetPyData(item2)[self.ORIG_ORDER]) # unsorted
def SortAllChildren(self, parentItem):
if parentItem and self.GetChildrenCount(parentItem, False):
self.SortChildren(parentItem)
(child, cookie) = self.GetFirstChild(parentItem)
while child.IsOk():
self.SortAllChildren(child)
(child, cookie) = self.GetNextChild(parentItem, cookie)
#----------------------------------------------------------------------------
# Select Callback Methods
#----------------------------------------------------------------------------
def CallDoSelectCallback(self, item):
""" Invoke the DoSelectCallback of the given view to highlight text in the document view
"""
data = self.GetPyData(item)
if not data:
return
view = data[self.VIEW]
cbdata = data[self.CALLBACKDATA]
if view:
view.DoSelectCallback(cbdata)
def SelectClosestItem(self, position):
tree = self
distances = []
items = []
self.FindDistanceToTreeItems(tree.GetRootItem(), position, distances, items)
mindist = 1000000
mindex = -1
for index in range(0, len(distances)):
if distances[index] <= mindist:
mindist = distances[index]
mindex = index
if mindex != -1:
item = items[mindex]
self.EnsureVisible(item)
os_view = wx.GetApp().GetService(OutlineService).GetView()
if os_view:
os_view.StopActionOnSelect()
self.SelectItem(item)
if os_view:
os_view.ResumeActionOnSelect()
def FindDistanceToTreeItems(self, item, position, distances, items):
data = self.GetPyData(item)
this_dist = 1000000
if data and data[2]:
positionTuple = data[2]
if position >= positionTuple[1]:
items.append(item)
distances.append(position - positionTuple[1])
if self.ItemHasChildren(item):
child, cookie = self.GetFirstChild(item)
while child and child.IsOk():
self.FindDistanceToTreeItems(child, position, distances, items)
child, cookie = self.GetNextChild(item, cookie)
return False
def SetDoSelectCallback(self, item, view, callbackdata):
""" When an item in the outline view is selected,
a method is called to select the respective text in the document view.
The view must define the method DoSelectCallback(self, data) in order for this to work
"""
self.SetPyData(item, (self._origOrderIndex, view, callbackdata))
self._origOrderIndex = self._origOrderIndex + 1
def CallDoLoadOutlineCallback(self, event):
""" Invoke the DoLoadOutlineCallback
"""
rootItem = self.GetRootItem()
if rootItem:
data = self.GetPyData(rootItem)
if data:
view = data[self.VIEW]
if view and view.DoLoadOutlineCallback():
self.SortAllChildren(self.GetRootItem())
def GetCallbackView(self):
rootItem = self.GetRootItem()
if rootItem:
return self.GetPyData(rootItem)[self.VIEW]
else:
return None
class OutlineService(Service.Service):
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
SHOW_WINDOW = wx.NewId() # keep this line for each subclass, need unique ID for each Service
SORT = wx.NewId()
SORT_ASC = wx.NewId()
SORT_DESC = wx.NewId()
SORT_NONE = wx.NewId()
#----------------------------------------------------------------------------
# Overridden methods
#----------------------------------------------------------------------------
def __init__(self, serviceName, embeddedWindowLocation = wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM):
Service.Service.__init__(self, serviceName, embeddedWindowLocation)
self._validTemplates = []
def _CreateView(self):
return OutlineView(self)
def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
Service.Service.InstallControls(self, frame, menuBar, toolBar, statusBar, document)
wx.EVT_MENU(frame, OutlineService.SORT_ASC, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, OutlineService.SORT_ASC, frame.ProcessUpdateUIEvent)
wx.EVT_MENU(frame, OutlineService.SORT_DESC, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, OutlineService.SORT_DESC, frame.ProcessUpdateUIEvent)
wx.EVT_MENU(frame, OutlineService.SORT_NONE, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, OutlineService.SORT_NONE, frame.ProcessUpdateUIEvent)
if wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
return True
viewMenu = menuBar.GetMenu(menuBar.FindMenu(_("&View")))
self._outlineSortMenu = wx.Menu()
self._outlineSortMenu.AppendRadioItem(OutlineService.SORT_NONE, _("Unsorted"), _("Display items in original order"))
self._outlineSortMenu.AppendRadioItem(OutlineService.SORT_ASC, _("Sort A-Z"), _("Display items in ascending order"))
self._outlineSortMenu.AppendRadioItem(OutlineService.SORT_DESC, _("Sort Z-A"), _("Display items in descending order"))
viewMenu.AppendMenu(wx.NewId(), _("Outline Sort"), self._outlineSortMenu)
return True
#----------------------------------------------------------------------------
# Event Processing Methods
#----------------------------------------------------------------------------
def ProcessEvent(self, event):
if Service.Service.ProcessEvent(self, event):
return True
id = event.GetId()
if id == OutlineService.SORT_ASC:
self.OnSort(event)
return True
elif id == OutlineService.SORT_DESC:
self.OnSort(event)
return True
elif id == OutlineService.SORT_NONE:
self.OnSort(event)
return True
else:
return False
def ProcessUpdateUIEvent(self, event):
if Service.Service.ProcessUpdateUIEvent(self, event):
return True
id = event.GetId()
if id == OutlineService.SORT_ASC:
event.Enable(True)
config = wx.ConfigBase_Get()
sort = config.ReadInt("OutlineSort", SORT_NONE)
if sort == SORT_ASC:
self._outlineSortMenu.Check(OutlineService.SORT_ASC, True)
else:
self._outlineSortMenu.Check(OutlineService.SORT_ASC, False)
return True
elif id == OutlineService.SORT_DESC:
event.Enable(True)
config = wx.ConfigBase_Get()
sort = config.ReadInt("OutlineSort", SORT_NONE)
if sort == SORT_DESC:
self._outlineSortMenu.Check(OutlineService.SORT_DESC, True)
else:
self._outlineSortMenu.Check(OutlineService.SORT_DESC, False)
return True
elif id == OutlineService.SORT_NONE:
event.Enable(True)
config = wx.ConfigBase_Get()
sort = config.ReadInt("OutlineSort", SORT_NONE)
if sort == SORT_NONE:
self._outlineSortMenu.Check(OutlineService.SORT_NONE, True)
else:
self._outlineSortMenu.Check(OutlineService.SORT_NONE, False)
return True
else:
return False
def OnSort(self, event):
id = event.GetId()
if id == OutlineService.SORT_ASC:
wx.ConfigBase_Get().WriteInt("OutlineSort", SORT_ASC)
self.GetView().OnSort(SORT_ASC)
return True
elif id == OutlineService.SORT_DESC:
wx.ConfigBase_Get().WriteInt("OutlineSort", SORT_DESC)
self.GetView().OnSort(SORT_DESC)
return True
elif id == OutlineService.SORT_NONE:
wx.ConfigBase_Get().WriteInt("OutlineSort", SORT_NONE)
self.GetView().OnSort(SORT_NONE)
return True
#----------------------------------------------------------------------------
# Service specific methods
#----------------------------------------------------------------------------
def LoadOutline(self, view, position=-1, force=False):
if not self.GetView():
return
self.SaveExpansionState()
if view.DoLoadOutlineCallback(force=force):
self.GetView().OnSort(wx.ConfigBase_Get().ReadInt("OutlineSort", SORT_NONE))
self.LoadExpansionState()
if position >= 0:
self.SyncToPosition(position)
def SyncToPosition(self, position):
if not self.GetView():
return
self.GetView().GetTreeCtrl().SelectClosestItem(position)
def OnCloseFrame(self, event):
Service.Service.OnCloseFrame(self, event)
self.SaveExpansionState(clear = True)
return True
def SaveExpansionState(self, clear = False):
if clear:
expanded = []
elif self.GetView():
expanded = self.GetView().GetExpansionState()
wx.ConfigBase_Get().Write("OutlineLastExpanded", expanded.__repr__())
def LoadExpansionState(self):
expanded = wx.ConfigBase_Get().Read("OutlineLastExpanded")
if expanded:
self.GetView().SetExpansionState(eval(expanded))
#----------------------------------------------------------------------------
# Timer Methods
#----------------------------------------------------------------------------
def StartBackgroundTimer(self):
self._timer = wx.PyTimer(self.DoBackgroundRefresh)
self._timer.Start(250)
def DoBackgroundRefresh(self):
""" Refresh the outline view periodically """
self._timer.Stop()
foundRegisteredView = False
if self.GetView():
currView = wx.GetApp().GetDocumentManager().GetCurrentView()
if currView:
for template in self._validTemplates:
type = template.GetViewType()
if isinstance(currView, type):
self.LoadOutline(currView)
foundRegisteredView = True
break
if not foundRegisteredView:
self.GetView().ClearTreeCtrl()
self._timer.Start(1000) # 1 second interval
def AddTemplateForBackgroundHandler(self, template):
self._validTemplates.append(template)
def GetTemplatesForBackgroundHandler(self):
return self._validTemplates
def RemoveTemplateForBackgroundHandler(self, template):
self._validTemplates.remove(template)

View File

@@ -0,0 +1,297 @@
#----------------------------------------------------------------------------
# Name: PHPEditor.py
# Purpose: PHP Script Editor for pydocview tbat uses the Styled Text Control
#
# Author: Morgan Hua
#
# Created: 1/4/04
# CVS-ID: $Id$
# Copyright: (c) 2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import string
import STCTextEditor
import CodeEditor
import OutlineService
import os
import re
class PHPDocument(CodeEditor.CodeDocument):
pass
class PHPView(CodeEditor.CodeView):
def GetCtrlClass(self):
""" Used in split window to instantiate new instances """
return PHPCtrl
def GetAutoCompleteHint(self):
pos = self.GetCtrl().GetCurrentPos()
if pos == 0:
return None, None
validLetters = string.letters + string.digits + '_$'
word = ''
while (True):
pos = pos - 1
if pos < 0:
break
char = chr(self.GetCtrl().GetCharAt(pos))
if char not in validLetters:
break
word = char + word
return None, word
def GetAutoCompleteDefaultKeywords(self):
return PHPKEYWORDS
#----------------------------------------------------------------------------
# Methods for OutlineService
#----------------------------------------------------------------------------
def DoLoadOutlineCallback(self, force=False):
outlineService = wx.GetApp().GetService(OutlineService.OutlineService)
if not outlineService:
return False
outlineView = outlineService.GetView()
if not outlineView:
return False
treeCtrl = outlineView.GetTreeCtrl()
if not treeCtrl:
return False
view = treeCtrl.GetCallbackView()
newCheckSum = self.GenCheckSum()
if not force:
if view and view is self:
if self._checkSum == newCheckSum:
return False
self._checkSum = newCheckSum
treeCtrl.DeleteAllItems()
document = self.GetDocument()
if not document:
return True
filename = document.GetFilename()
if filename:
rootItem = treeCtrl.AddRoot(os.path.basename(filename))
treeCtrl.SetDoSelectCallback(rootItem, self, None)
else:
return True
text = self.GetValue()
if not text:
return True
INTERFACE_PATTERN = 'interface[ \t]+\w+'
CLASS_PATTERN = '((final|abstract)[ \t]+)?((public|private|protected)[ \t]+)?(static[ \t]+)?class[ \t]+\w+((implements|extends)\w+)?'
FUNCTION_PATTERN = '(abstract[ \t]+)?((public|private|protected)[ \t]+)?(static[ \t]+)?function[ \t]+?\w+\(.*?\)'
interfacePat = re.compile(INTERFACE_PATTERN, re.M|re.S)
classPat = re.compile(CLASS_PATTERN, re.M|re.S)
funcPat= re.compile(FUNCTION_PATTERN, re.M|re.S)
pattern = re.compile('^[ \t]*('+ CLASS_PATTERN + '.*?{|' + FUNCTION_PATTERN + '|' + INTERFACE_PATTERN +'\s*?{).*?$', re.M|re.S)
iter = pattern.finditer(text)
indentStack = [(0, rootItem)]
for pattern in iter:
line = pattern.string[pattern.start(0):pattern.end(0)]
foundLine = classPat.search(line)
if foundLine:
indent = foundLine.start(0)
itemStr = foundLine.string[foundLine.start(0):foundLine.end(0)]
else:
foundLine = funcPat.search(line)
if foundLine:
indent = foundLine.start(0)
itemStr = foundLine.string[foundLine.start(0):foundLine.end(0)]
else:
foundLine = interfacePat.search(line)
if foundLine:
indent = foundLine.start(0)
itemStr = foundLine.string[foundLine.start(0):foundLine.end(0)]
if indent == 0:
parentItem = rootItem
else:
lastItem = indentStack.pop()
while lastItem[0] >= indent:
lastItem = indentStack.pop()
indentStack.append(lastItem)
parentItem = lastItem[1]
item = treeCtrl.AppendItem(parentItem, itemStr)
treeCtrl.SetDoSelectCallback(item, self, (pattern.end(0), pattern.start(0) + indent)) # select in reverse order because we want the cursor to be at the start of the line so it wouldn't scroll to the right
indentStack.append((indent, item))
treeCtrl.Expand(rootItem)
return True
class PHPService(CodeEditor.CodeService):
def __init__(self):
CodeEditor.CodeService.__init__(self)
class PHPCtrl(CodeEditor.CodeCtrl):
def __init__(self, parent, ID = -1, style = wx.NO_FULL_REPAINT_ON_RESIZE):
CodeEditor.CodeCtrl.__init__(self, parent, ID, style)
self.SetLexer(wx.stc.STC_LEX_HTML)
self.SetStyleBits(7)
self.SetKeyWords(4, string.join(PHPKEYWORDS))
self.SetProperty("fold.html", "1")
def CanWordWrap(self):
return True
def SetViewDefaults(self):
CodeEditor.CodeCtrl.SetViewDefaults(self, configPrefix = "PHP", hasWordWrap = True, hasTabs = True)
def GetFontAndColorFromConfig(self):
return CodeEditor.CodeCtrl.GetFontAndColorFromConfig(self, configPrefix = "PHP")
def UpdateStyles(self):
CodeEditor.CodeCtrl.UpdateStyles(self)
if not self.GetFont():
return
faces = { 'font' : self.GetFont().GetFaceName(),
'size' : self.GetFont().GetPointSize(),
'size2': self.GetFont().GetPointSize() - 2,
'color' : "%02x%02x%02x" % (self.GetFontColor().Red(), self.GetFontColor().Green(), self.GetFontColor().Blue())
}
# HTML Styles
# White space
self.StyleSetSpec(wx.stc.STC_H_DEFAULT, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
# Comment
self.StyleSetSpec(wx.stc.STC_H_COMMENT, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces)
# Number
self.StyleSetSpec(wx.stc.STC_H_NUMBER, "face:%(font)s,fore:#007F7F,size:%(size)d" % faces)
# String
self.StyleSetSpec(wx.stc.STC_H_SINGLESTRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_H_DOUBLESTRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
# Tag
self.StyleSetSpec(wx.stc.STC_H_TAG, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces)
# Attributes
self.StyleSetSpec(wx.stc.STC_H_ATTRIBUTE, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces)
# PHP Styles
self.StyleSetSpec(wx.stc.STC_HPHP_DEFAULT, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_COMMENT, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_COMMENTLINE, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_NUMBER, "face:%(font)s,fore:#007F7F,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_SIMPLESTRING, "face:%(font)s,fore:#7F007F,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_HSTRING, "face:%(font)s,fore7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_HSTRING_VARIABLE, "face:%(font)s,fore:#007F7F,italic,bold,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_VARIABLE, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_OPERATOR, "face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_HPHP_WORD, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces) # keyword
class PHPOptionsPanel(STCTextEditor.TextOptionsPanel):
def __init__(self, parent, id):
STCTextEditor.TextOptionsPanel.__init__(self, parent, id, configPrefix = "PHP", label = "PHP", hasWordWrap = True, hasTabs = True)
PHPKEYWORDS = [
"and", "or", "xor", "__FILE__", "exception", "__LINE__", "array", "as", "break", "case",
"class", "const", "continue", "declare", "default", "die", "do", "echo", "else", "elseif",
"empty", "enddeclare", "endfor", "endforeach", "endif", "endswith", "endwhile", "eval",
"exit", "extends", "for", "foreach", "function", "global", "if", "include", "include_once",
"isset", "list", "new", "print", "require", "require_once", "return", "static", "switch",
"unset", "use", "var", "while", "__FUNCTION__", "__CLASS__", "__METHOD__", "final", "php_user_filter",
"interface", "implements", "extends", "public", "private", "protected", "abstract", "clone", "try", "catch",
"throw", "cfunction", "old_function",
"$_SERVER", "$_ENV", "$_COOKIE", "$_GET", "$_POST", "$_FILES", "$_REQUEST", "$_SESSION", "$GLOBALS", "$php_errormsg",
"PHP_VERSION", "PHP_OS", "PHP_EOL", "DEFAULT_INCLUDE_PATH", "PEAR_INSTALL_DIR", "PEAR_EXTENSION_DIR",
"PHP_EXTENSION_DIR", "PHP_BINDIR", "PHP_LIBDIR", "PHP_DATADIR", "PHP_SYSCONFDIR", "PHP_LOCALSTATEDIR",
"PHP_CONFIG_FILE_PATH", "PHP_OUTPUT_HANDLER_START", "PHP_OUTPUT_HANDLER_CONT", "PHP_OUTPUT_HANDLER_END",
"E_ERROR", "E_WARNING", "E_PARSE", "E_NOTICE", "E_CORE_ERROR", "E_CORE_WARNING", "E_COMPILE_ERROR",
"E_COMPILE_WARNING", "E_USER_ERROR", "E_USER_WARNING", "E_USER_NOTICE", "E_ALL", "E_STRICT",
"TRUE", "FALSE", "NULL", "ZEND_THREAD_SAFE",
"EXTR_OVERWRITE", "EXTR_SKIP", "EXTR_PREFIX_SAME", "EXTR_PREFIX_ALL", "EXTR_PREFIX_INVALID",
"EXTR_PREFIX_IF_EXISTS", "EXTR_IF_EXISTS", "SORT_ASC", "SORT_DESC", "SORT_REGULAR", "SORT_NUMERIC",
"SORT_STRING", "CASE_LOWER", "CASE_UPPER", "COUNT_NORMAL", "COUNT_RECURSIVE", "ASSERT_ACTIVE",
"ASSERT_CALLBACK", "ASSERT_BAIL", "ASSERT_WARNING", "ASSERT_QUIET_EVAL", "CONNECTION_ABORTED",
"CONNECTION_NORMAL", "CONNECTION_TIMEOUT", "INI_USER", "INI_PERDIR", "INI_SYSTEM", "INI_ALL",
"M_E", "M_LOG2E", "M_LOG10E", "M_LN2", "M_LN10", "M_PI", "M_PI_2", "M_PI_4", "M_1_PI", "M_2_PI",
"M_2_SQRTPI", "M_SQRT2", "M_SQRT1_2", "CRYPT_SALT_LENGTH", "CRYPT_STD_DES", "CRYPT_EXT_DES", "CRYPT_MD5",
"CRYPT_BLOWFISH", "DIRECTORY_SEPARATOR", "SEEK_SET", "SEEK_CUR", "SEEK_END", "LOCK_SH", "LOCK_EX", "LOCK_UN",
"LOCK_NB", "HTML_SPECIALCHARS", "HTML_ENTITIES", "ENT_COMPAT", "ENT_QUOTES", "ENT_NOQUOTES", "INFO_GENERAL",
"INFO_CREDITS", "INFO_CONFIGURATION", "INFO_MODULES", "INFO_ENVIRONMENT", "INFO_VARIABLES", "INFO_LICENSE",
"INFO_ALL", "CREDITS_GROUP", "CREDITS_GENERAL", "CREDITS_SAPI", "CREDITS_MODULES", "CREDITS_DOCS",
"CREDITS_FULLPAGE", "CREDITS_QA", "CREDITS_ALL", "STR_PAD_LEFT", "STR_PAD_RIGHT", "STR_PAD_BOTH",
"PATHINFO_DIRNAME", "PATHINFO_BASENAME", "PATHINFO_EXTENSION", "PATH_SEPARATOR", "CHAR_MAX", "LC_CTYPE",
"LC_NUMERIC", "LC_TIME", "LC_COLLATE", "LC_MONETARY", "LC_ALL", "LC_MESSAGES", "ABDAY_1", "ABDAY_2",
"ABDAY_3", "ABDAY_4", "ABDAY_5", "ABDAY_6", "ABDAY_7", "DAY_1", "DAY_2", "DAY_3", "DAY_4", "DAY_5",
"DAY_6", "DAY_7", "ABMON_1", "ABMON_2", "ABMON_3", "ABMON_4", "ABMON_5", "ABMON_6", "ABMON_7", "ABMON_8",
"ABMON_9", "ABMON_10", "ABMON_11", "ABMON_12", "MON_1", "MON_2", "MON_3", "MON_4", "MON_5", "MON_6", "MON_7",
"MON_8", "MON_9", "MON_10", "MON_11", "MON_12", "AM_STR", "PM_STR", "D_T_FMT", "D_FMT", "T_FMT", "T_FMT_AMPM",
"ERA", "ERA_YEAR", "ERA_D_T_FMT", "ERA_D_FMT", "ERA_T_FMT", "ALT_DIGITS", "INT_CURR_SYMBOL", "CURRENCY_SYMBOL",
"CRNCYSTR", "MON_DECIMAL_POINT", "MON_THOUSANDS_SEP", "MON_GROUPING", "POSITIVE_SIGN", "NEGATIVE_SIGN",
"INT_FRAC_DIGITS", "FRAC_DIGITS", "P_CS_PRECEDES", "P_SEP_BY_SPACE", "N_CS_PRECEDES", "N_SEP_BY_SPACE",
"P_SIGN_POSN", "N_SIGN_POSN", "DECIMAL_POINT", "RADIXCHAR", "THOUSANDS_SEP", "THOUSEP", "GROUPING",
"YESEXPR", "NOEXPR", "YESSTR", "NOSTR", "CODESET", "LOG_EMERG", "LOG_ALERT", "LOG_CRIT", "LOG_ERR",
"LOG_WARNING", "LOG_NOTICE", "LOG_INFO", "LOG_DEBUG", "LOG_KERN", "LOG_USER", "LOG_MAIL", "LOG_DAEMON",
"LOG_AUTH", "LOG_SYSLOG", "LOG_LPR", "LOG_NEWS", "LOG_UUCP", "LOG_CRON", "LOG_AUTHPRIV", "LOG_LOCAL0",
"LOG_LOCAL1", "LOG_LOCAL2", "LOG_LOCAL3", "LOG_LOCAL4", "LOG_LOCAL5", "LOG_LOCAL6", "LOG_LOCAL7",
"LOG_PID", "LOG_CONS", "LOG_ODELAY", "LOG_NDELAY", "LOG_NOWAIT", "LOG_PERROR"
]
#----------------------------------------------------------------------------
# Icon Bitmaps - generated by encode_bitmaps.py
#----------------------------------------------------------------------------
from wx import ImageFromStream, BitmapFromImage
from wx import EmptyIcon
import cStringIO
def getPHPData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x00{IDAT8\x8dclh8\xf0\x9f\x81\x02\xc0D\x89f\xaa\x18\xc0\x82M0<\\\x1c\
\xce^\xb9\xf2%y.\xd0\xd4\xd4$\xde\x05\xf8l\x0c\x0f\x17\x87\x8baS\xc7x\xfd\
\xfa\xf5\xff\xc8\xb6]\xbf~\x1d\xc3\x05\xf8\xc4\x98\x90\x05\xae_\xbf\x8e\xa1\
\x88\x90\xd8 \x8aF\x98\x93`~\xc3\x05\xd0\xd5\xc1\r\x80\t\xc0B\xf7\xfa\xf5\
\xeb(l\\\xeaP\xbc\x80\x1c\x85\xb8\xd8\xe8|&b\x9c\x8dn;2`\x1c\xf0\xdc\x08\x00\
\x8e\xf2S\xed\xb0\xbe\xaa\xbc\x00\x00\x00\x00IEND\xaeB`\x82'
def getPHPBitmap():
return BitmapFromImage(getPHPImage())
def getPHPImage():
stream = cStringIO.StringIO(getPHPData())
return ImageFromStream(stream)
def getPHPIcon():
icon = EmptyIcon()
icon.CopyFromBitmap(getPHPBitmap())
return icon

View File

@@ -0,0 +1,425 @@
#----------------------------------------------------------------------------
# Name: PerlEditor.py
# Purpose: Perl Script Editor for pydocview tbat uses the Styled Text Control
#
# Author: Morgan Hua
#
# Created: 1/5/04
# CVS-ID: $Id$
# Copyright: (c) 2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import string
import STCTextEditor
import CodeEditor
class PerlDocument(CodeEditor.CodeDocument):
pass
class PerlView(CodeEditor.CodeView):
def GetCtrlClass(self):
""" Used in split window to instantiate new instances """
return PerlCtrl
def GetAutoCompleteHint(self):
pos = self.GetCtrl().GetCurrentPos()
if pos == 0:
return None, None
validLetters = string.letters + string.digits + '_/'
word = ''
while (True):
pos = pos - 1
if pos < 0:
break
char = chr(self.GetCtrl().GetCharAt(pos))
if char not in validLetters:
break
word = char + word
return None, word
def GetAutoCompleteDefaultKeywords(self):
return PERLKEYWORDS
class PerlService(CodeEditor.CodeService):
def __init__(self):
CodeEditor.CodeService.__init__(self)
class PerlCtrl(CodeEditor.CodeCtrl):
def __init__(self, parent, ID = -1, style = wx.NO_FULL_REPAINT_ON_RESIZE):
CodeEditor.CodeCtrl.__init__(self, parent, ID, style)
self.SetLexer(wx.stc.STC_LEX_PERL)
self.SetKeyWords(0, string.join(PERLKEYWORDS))
def CanWordWrap(self):
return True
def SetViewDefaults(self):
CodeEditor.CodeCtrl.SetViewDefaults(self, configPrefix = "Perl", hasWordWrap = True, hasTabs = True)
def GetFontAndColorFromConfig(self):
return CodeEditor.CodeCtrl.GetFontAndColorFromConfig(self, configPrefix = "Perl")
def UpdateStyles(self):
CodeEditor.CodeCtrl.UpdateStyles(self)
if not self.GetFont():
return
faces = { 'font' : self.GetFont().GetFaceName(),
'size' : self.GetFont().GetPointSize(),
'size2': self.GetFont().GetPointSize() - 2,
'color' : "%02x%02x%02x" % (self.GetFontColor().Red(), self.GetFontColor().Green(), self.GetFontColor().Blue())
}
# Perl Styles
self.StyleSetSpec(wx.stc.STC_PL_DEFAULT, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_COMMENTLINE, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_NUMBER, "face:%(font)s,fore:#007F7F,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_CHARACTER, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_STRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_STRING_Q, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_STRING_QQ, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_STRING_QX, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_STRING_QR, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_STRING_QW, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_BACKTICKS, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_WORD, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces) # keyword
self.StyleSetSpec(wx.stc.STC_PL_IDENTIFIER, "face:%(font)s,fore:#%(color)s,face:%(font)s,size:%(size)d" % faces)
# Default
self.StyleSetSpec(wx.stc.STC_PL_ARRAY, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_DATASECTION, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_ERROR, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_HASH, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_HERE_DELIM, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_HERE_Q, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_HERE_QQ, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_HERE_QX, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_LONGQUOTE, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_OPERATOR, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_POD, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_PREPROCESSOR, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_PUNCTUATION, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_REGEX, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_REGSUBST, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_SCALAR, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_PL_SYMBOLTABLE, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
class PerlOptionsPanel(STCTextEditor.TextOptionsPanel):
def __init__(self, parent, id):
STCTextEditor.TextOptionsPanel.__init__(self, parent, id, configPrefix = "Perl", label = "Perl", hasWordWrap = True, hasTabs = True)
PERLKEYWORDS = [
"abs",
"accept",
"alarm",
"atan2",
"bind",
"binmode",
"bless",
"caller",
"chdir",
"chmod",
"chomp",
"chop",
"chown",
"chr",
"chroot",
"close",
"closedir",
"connect",
"continue",
"cos",
"crypt",
"dbmclose",
"dbmopen",
"defined",
"delete",
"die",
"do",
"dump",
"each",
"endgrent",
"endhostent",
"endnetent",
"endprotoent",
"endpwent",
"endservent",
"eof",
"eval",
"exec",
"exists",
"exit",
"exp",
"fcntl",
"fileno",
"flock",
"fork",
"format",
"formline",
"getc",
"getgrent",
"getgrgid",
"getgrnam",
"gethostbyaddr",
"gethostbyname",
"gethostent",
"getlogin",
"getnetbyaddr",
"getnetbyname",
"getnetent",
"getpeername",
"getpgrp",
"getppid",
"getpriority",
"getprotobyname",
"getprotobynumber",
"getprotoent",
"getpwent",
"getpwnam",
"getpwuid",
"getservbyname",
"getservbyport",
"getservent",
"getsockname",
"getsockopt",
"glob",
"gmtime",
"goto",
"grep",
"hex",
"import",
"index",
"int",
"ioctl",
"join",
"keys",
"kill",
"last",
"lc",
"lcfirst",
"length",
"link",
"listen",
"local",
"localtime",
"log",
"lstat",
"m//",
"map",
"mkdir",
"msgctl",
"msgget",
"msgrcv",
"msgsnd",
"my",
"next",
"no",
"oct",
"open",
"opendir",
"ord",
"pack",
"package",
"pipe",
"pop",
"pos",
"print",
"printf",
"prototype",
"push",
"q/STRING/",
"qq/STRING/",
"quotemeta",
"qw",
"qw/STRING/",
"qx",
"qx/STRING/",
"rand",
"read",
"readdir",
"readline",
"readlink",
"readpipe",
"recv",
"redo",
"ref",
"rename",
"require",
"reset",
"return",
"reverse",
"rewinddir",
"rindex",
"rmdir",
"s///",
"scalar",
"seek",
"seekdir",
"select",
"semctl",
"semget",
"semop",
"send",
"setgrent",
"sethostent",
"setnetent",
"setpgrp",
"setpriority",
"setprotoent",
"setpwent",
"setservent",
"setsockopt",
"shift",
"shmctl",
"shmget",
"shmread",
"shmwrite",
"shutdown",
"sin",
"sleep",
"socket",
"socketpair",
"sort",
"splice",
"split",
"sprintf",
"sqrt",
"srand",
"stat",
"study",
"sub",
"substr",
"symlink",
"syscall",
"sysopen",
"sysread",
"sysseek",
"system",
"syswrite",
"tell",
"telldir",
"tie",
"tied",
"times",
"tr///",
"truncate",
"uc",
"ucfirst",
"umask",
"undef",
"unlink",
"unpack",
"unshift",
"untie",
"use",
"utime",
"values",
"vec",
"wait",
"waitpid",
"wantarray",
"warn",
"write",
"y///",
"eq",
"ne",
"lt",
"le",
"gt",
"ge",
"cmp",
"if",
"else"
"not",
"and",
"xor",
"or",
"if",
"while",
"until",
"for",
"foreach",
"last",
"next",
"redo",
"goto",
"STDIN",
"STDOUT",
"STDERR",
"WHEncE",
"BEGIN",
"END",
"require",
"integer",
"less",
"sigtrap",
"strict",
"subs"
]
#----------------------------------------------------------------------------
# Icon Bitmaps - generated by encode_bitmaps.py
#----------------------------------------------------------------------------
from wx import ImageFromStream, BitmapFromImage
from wx import EmptyIcon
import cStringIO
def getPerlData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x0e\x00\x00\x00\x10\x08\x06\
\x00\x00\x00&\x94N:\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\
\x01mIDAT(\x91\x9d\x93/\x8e\xf30\x10\xc5\x7f[\xed\x05\xca\x82,Ef\xc6e\x01Vx{\
\x89\x04\x16\x94\x97\x045\xa8\xa0\xa44G\x08\xc9\x01\xa2\x80\x1e $ld\xc9\xa8w\
\x08\xf0\xa2x\x93~\x1f\xda\x91F\xb2\xfd\xe6=\xcd?\x7f\xcd\xf3\x1c\xf8\x83}/\
\x87i\x9a\x000\xc6D\xb0\xeb:\x86a MS\xce\xe7\xf3\x968M\x13}\xdf\xe3\x9cCD\
\xb8\xddn\x18c\xe8\xba\x8e\xb2,\xc9\xb2\x0c\x11\x01\xd8\x90w\xc6\x18\x94R\
\xf1\xa1\xef{\xba\xae\xa3i\x1a\xb4\xd6h\xad)\x8a\x02\xe7\\\xccj\x93\xea\xa2\
\nP\xd75\xd7\xeb\x15\x00\xef\xfdFt)e\xb7\x80\x8b\xbas\x8e$I\xe2}\xc1\x8b\xa2\
\xd8\xf4b\x07\xa0\x94\xe2\xf5za\xad\xc5Z\xcb\xfb\xfdFD\xe8\xfb\x9e\x05\x17\
\x11\x9cs4M\xf3K<\x9dNdY\xc60\x0cx\xef\x11\x11\xea\xbaF)\x85s\x8e\xba\xae)\
\xcb\x12\x11!M\xd3_"\xc0\xfd~\xc7Z\x8bs\x0e\x80$I\xa2:@UU1u\x00\xe6y\x0ek\
\x1f\xc71\x1c\x0e\x87\xd0\xb6m\xd8\xef\xf7\xe1\xf1x\x84\xcb\xe5\x12\xe6y\x0e\
\xc7\xe31\xc6\xed\xf80\x11!\xcb2\xbc\xf7TUE\x9e\xe71=\xadul\xce\xf7\'Qk\x8d\
\xf7\x9e<\xcf\x81\xed&Yk\xb7\xe3\xf84\xa5\x14\xc6\x18D\x84\xe7\xf3\x19\x83\
\xd75\xfe\x97\xb8\x0eXo\xcc2\x9e\x7f\x9a3\x8ech\xdb6|6l\xf15\xf6\xf5\xd7o\
\xf5\x03\xaf\x9f\xfa@\x02\xe4\xdc\xf9\x00\x00\x00\x00IEND\xaeB`\x82'
def getPerlBitmap():
return BitmapFromImage(getPerlImage())
def getPerlImage():
stream = cStringIO.StringIO(getPerlData())
return ImageFromStream(stream)
def getPerlIcon():
icon = EmptyIcon()
icon.CopyFromBitmap(getPerlBitmap())
return icon

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,614 @@
#----------------------------------------------------------------------------
# Name: PythonEditor.py
# Purpose: PythonEditor for wx.lib.pydocview tbat uses the Styled Text Control
#
# Author: Peter Yared
#
# Created: 8/15/03
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import CodeEditor
import wx
import wx.lib.docview
import wx.lib.pydocview
import string
import keyword # So it knows what to hilite
import wx.py # For the Python interpreter
import wx.stc # For the Python interpreter
import cStringIO # For indent
import OutlineService
import STCTextEditor
import keyword # for GetAutoCompleteKeywordList
import sys # for GetAutoCompleteKeywordList
import MessageService # for OnCheckCode
import OutlineService
try:
import checker # for pychecker
_CHECKER_INSTALLED = True
except ImportError:
_CHECKER_INSTALLED = False
import os.path # for pychecker
_ = wx.GetTranslation
if wx.Platform == '__WXMSW__':
_WINDOWS = True
else:
_WINDOWS = False
VIEW_PYTHON_INTERPRETER_ID = wx.NewId()
class PythonDocument(CodeEditor.CodeDocument):
pass
class PythonView(CodeEditor.CodeView):
def ProcessUpdateUIEvent(self, event):
if not self.GetCtrl():
return False
id = event.GetId()
if id == CodeEditor.CHECK_CODE_ID:
hasText = self.GetCtrl().GetTextLength() > 0
event.Enable(hasText)
return True
return CodeEditor.CodeView.ProcessUpdateUIEvent(self, event)
def GetCtrlClass(self):
""" Used in split window to instantiate new instances """
return PythonCtrl
def OnActivateView(self, activate, activeView, deactiveView):
STCTextEditor.TextView.OnActivateView(self, activate, activeView, deactiveView)
if activate:
wx.CallAfter(self.LoadOutline) # need CallAfter because document isn't loaded yet
def OnClose(self, deleteWindow = True):
status = STCTextEditor.TextView.OnClose(self, deleteWindow)
wx.CallAfter(self.ClearOutline) # need CallAfter because when closing the document, it is Activated and then Close, so need to match OnActivateView's CallAfter
return status
def GetAutoCompleteKeywordList(self, context, hint):
obj = None
try:
if context and len(context):
obj = eval(context, globals(), locals())
except:
if not hint or len(hint) == 0: # context isn't valid, maybe it was the hint
hint = context
if obj is None:
kw = keyword.kwlist[:]
else:
symTbl = dir(obj)
kw = filter(lambda item: item[0] != '_', symTbl) # remove local variables and methods
if hint and len(hint):
lowerHint = hint.lower()
filterkw = filter(lambda item: item.lower().startswith(lowerHint), kw) # remove variables and methods that don't match hint
kw = filterkw
kw.sort(self.CaseInsensitiveCompare)
if hint:
replaceLen = len(hint)
else:
replaceLen = 0
return " ".join(kw), replaceLen
def OnCheckCode(self):
if not _CHECKER_INSTALLED:
wx.MessageBox(_("pychecker not found. Please install pychecker."), _("Check Code"))
return
filename = os.path.basename(self.GetDocument().GetFilename())
# pychecker only works on files, doesn't take a stream or string input
if self.GetDocument().IsModified():
dlg = wx.MessageDialog(self.GetFrame(), _("'%s' has been modfied and must be saved first. Save file and check code?") % filename, _("Check Code"))
val = dlg.ShowModal()
dlg.Destroy()
if val == wx.ID_OK:
self.GetDocument().Save()
else:
return
messageService = wx.GetApp().GetService(MessageService.MessageService)
messageService.ShowWindow()
view = messageService.GetView()
if not view:
return
view.ClearLines()
view.SetCallback(self.OnJumpToFoundLine)
# Set cursor to Wait cursor
wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
# This takes a while for involved code
checker.checkSyntax(self.GetDocument().GetFilename(), view)
# Set cursor to Default cursor
wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
def OnJumpToFoundLine(self, event):
messageService = wx.GetApp().GetService(MessageService.MessageService)
lineText, pos = messageService.GetView().GetCurrLine()
lineEnd = lineText.find(".py:")
if lineEnd == -1:
return
lineStart = lineEnd + len(".py:")
lineEnd = lineText.find(":", lineStart)
lineNum = int(lineText[lineStart:lineEnd])
filename = lineText[0:lineStart - 1]
foundView = None
openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
for openDoc in openDocs:
if openDoc.GetFilename() == filename:
foundView = openDoc.GetFirstView()
break
if not foundView:
doc = wx.GetApp().GetDocumentManager().CreateDocument(filename, wx.lib.docview.DOC_SILENT)
foundView = doc.GetFirstView()
if foundView:
foundView.GetFrame().SetFocus()
foundView.Activate()
foundView.GotoLine(lineNum)
startPos = foundView.PositionFromLine(lineNum)
endPos = foundView.GetLineEndPosition(lineNum)
# wxBug: Need to select in reverse order, (end, start) to put cursor at head of line so positioning is correct
# Also, if we use the correct positioning order (start, end), somehow, when we open a edit window for the first
# time, we don't see the selection, it is scrolled off screen
foundView.SetSelection(endPos, startPos)
wx.GetApp().GetService(OutlineService.OutlineService).LoadOutline(foundView, position=startPos)
class PythonInterpreterView(wx.lib.docview.View):
def OnCreate(self, doc, flags):
frame = wx.GetApp().CreateDocumentFrame(self, doc, flags)
sizer = wx.BoxSizer()
self._pyCrust = wx.py.crust.Crust(frame)
sizer.Add(self._pyCrust, 1, wx.EXPAND, 0)
frame.SetSizer(sizer)
frame.Layout()
self.Activate()
frame.Show()
return True
def ProcessEvent(self, event):
if not hasattr(self, "_pyCrust") or not self._pyCrust:
return wx.lib.docview.View.ProcessEvent(self, event)
stcControl = wx.Window_FindFocus()
if not isinstance(stcControl, wx.stc.StyledTextCtrl):
return wx.lib.docview.View.ProcessEvent(self, event)
id = event.GetId()
if id == wx.ID_UNDO:
stcControl.Undo()
return True
elif id == wx.ID_REDO:
stcControl.Redo()
return True
elif id == wx.ID_CUT:
stcControl.Cut()
return True
elif id == wx.ID_COPY:
stcControl.Copy()
return True
elif id == wx.ID_PASTE:
stcControl.Paste()
return True
elif id == wx.ID_CLEAR:
stcControl.Clear()
return True
elif id == wx.ID_SELECTALL:
stcControl.SetSelection(0, -1)
return True
else:
return wx.lib.docview.View.ProcessEvent(self, event)
def ProcessUpdateUIEvent(self, event):
if not hasattr(self, "_pyCrust") or not self._pyCrust:
return wx.lib.docview.View.ProcessUpdateUIEvent(self, event)
stcControl = wx.Window_FindFocus()
if not isinstance(stcControl, wx.stc.StyledTextCtrl):
return wx.lib.docview.View.ProcessUpdateUIEvent(self, event)
id = event.GetId()
if id == wx.ID_UNDO:
event.Enable(stcControl.CanUndo())
return True
elif id == wx.ID_REDO:
event.Enable(stcControl.CanRedo())
return True
elif id == wx.ID_CUT:
event.Enable(stcControl.CanCut())
return True
elif id == wx.ID_COPY:
event.Enable(stcControl.CanCopy())
return True
elif id == wx.ID_PASTE:
event.Enable(stcControl.CanPaste())
return True
elif id == wx.ID_CLEAR:
event.Enable(True) # wxBug: should be stcControl.CanCut()) but disabling clear item means del key doesn't work in control as expected
return True
elif id == wx.ID_SELECTALL:
event.Enable(stcControl.GetTextLength() > 0)
return True
else:
return wx.lib.docview.View.ProcessUpdateUIEvent(self, event)
def OnClose(self, deleteWindow=True):
if deleteWindow and self.GetFrame():
self.GetFrame().Destroy()
return True
class PythonService(CodeEditor.CodeService):
def __init__(self):
CodeEditor.CodeService.__init__(self)
def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
CodeEditor.CodeService.InstallControls(self, frame, menuBar, toolBar, statusBar, document)
if document and document.GetDocumentTemplate().GetDocumentType() != PythonDocument:
return
if not document and wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
return
viewMenu = menuBar.GetMenu(menuBar.FindMenu(_("&View")))
viewStatusBarItemPos = self.GetMenuItemPos(viewMenu, wx.lib.pydocview.VIEW_STATUSBAR_ID)
viewMenu.InsertCheckItem(viewStatusBarItemPos + 1, VIEW_PYTHON_INTERPRETER_ID, _("Python &Interpreter"), _("Shows or hides the Python interactive window"))
wx.EVT_MENU(frame, VIEW_PYTHON_INTERPRETER_ID, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, VIEW_PYTHON_INTERPRETER_ID, frame.ProcessUpdateUIEvent)
def ProcessEvent(self, event):
id = event.GetId()
if id == VIEW_PYTHON_INTERPRETER_ID:
self.OnViewPythonInterpreter(event)
return True
else:
return CodeEditor.CodeService.ProcessEvent(self, event)
def ProcessUpdateUIEvent(self, event):
id = event.GetId()
if id == VIEW_PYTHON_INTERPRETER_ID:
event.Enable(True)
docManager = wx.GetApp().GetDocumentManager()
event.Check(False)
for doc in docManager.GetDocuments():
if isinstance(doc.GetFirstView(), PythonInterpreterView):
event.Check(True)
break
return True
else:
return CodeEditor.CodeService.ProcessUpdateUIEvent(self, event)
def OnViewPythonInterpreter(self, event):
for doc in wx.GetApp().GetDocumentManager().GetDocuments():
if isinstance(doc.GetFirstView(), PythonInterpreterView):
doc.GetFirstView().GetDocument().DeleteAllViews()
return
docManager = self.GetDocumentManager()
template = wx.lib.docview.DocTemplate(docManager,
_("Python Interpreter"),
"*.Foobar",
"Foobar",
".Foobar",
_("Python Interpreter Document"),
_("Python Interpreter View"),
wx.lib.docview.Document,
PythonInterpreterView,
flags = wx.lib.docview.TEMPLATE_INVISIBLE)
newDoc = template.CreateDocument('', wx.lib.docview.DOC_SILENT)
if newDoc:
newDoc.SetDocumentName(template.GetDocumentName())
newDoc.SetDocumentTemplate(template)
newDoc.OnNewDocument()
newDoc.SetWriteable(False)
newDoc.GetFirstView().GetFrame().SetTitle(_("Python Interpreter"))
class PythonCtrl(CodeEditor.CodeCtrl):
def __init__(self, parent, ID = -1, style = wx.NO_FULL_REPAINT_ON_RESIZE):
CodeEditor.CodeCtrl.__init__(self, parent, ID, style)
self.SetProperty("tab.timmy.whinge.level", "1")
self.SetProperty("fold.comment.python", "1")
self.SetProperty("fold.quotes.python", "1")
self.SetLexer(wx.stc.STC_LEX_PYTHON)
self.SetKeyWords(0, string.join(keyword.kwlist))
def SetViewDefaults(self):
CodeEditor.CodeCtrl.SetViewDefaults(self, configPrefix = "Python", hasWordWrap = False, hasTabs = True)
def GetFontAndColorFromConfig(self):
return CodeEditor.CodeCtrl.GetFontAndColorFromConfig(self, configPrefix = "Python")
def UpdateStyles(self):
CodeEditor.CodeCtrl.UpdateStyles(self)
if not self.GetFont():
return
faces = { 'font' : self.GetFont().GetFaceName(),
'size' : self.GetFont().GetPointSize(),
'size2': self.GetFont().GetPointSize() - 2,
'color' : "%02x%02x%02x" % (self.GetFontColor().Red(), self.GetFontColor().Green(), self.GetFontColor().Blue())
}
# Python styles
# White space
self.StyleSetSpec(wx.stc.STC_P_DEFAULT, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
# Comment
self.StyleSetSpec(wx.stc.STC_P_COMMENTLINE, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces)
# Number
self.StyleSetSpec(wx.stc.STC_P_NUMBER, "face:%(font)s,fore:#007F7F,size:%(size)d" % faces)
# String
self.StyleSetSpec(wx.stc.STC_P_STRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
# Single quoted string
self.StyleSetSpec(wx.stc.STC_P_CHARACTER, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
# Keyword
self.StyleSetSpec(wx.stc.STC_P_WORD, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces)
# Triple quotes
self.StyleSetSpec(wx.stc.STC_P_TRIPLE, "face:%(font)s,fore:#7F0000,size:%(size)d" % faces)
# Triple double quotes
self.StyleSetSpec(wx.stc.STC_P_TRIPLEDOUBLE, "face:%(font)s,fore:#7F0000,size:%(size)d" % faces)
# Class name definition
self.StyleSetSpec(wx.stc.STC_P_CLASSNAME, "face:%(font)s,fore:#0000FF,bold,size:%(size)d" % faces)
# Function or method name definition
self.StyleSetSpec(wx.stc.STC_P_DEFNAME, "face:%(font)s,fore:#007F7F,bold,size:%(size)d" % faces)
# Operators
self.StyleSetSpec(wx.stc.STC_P_OPERATOR, "face:%(font)s,size:%(size)d" % faces)
# Identifiers
self.StyleSetSpec(wx.stc.STC_P_IDENTIFIER, "face:%(font)s,fore:#%(color)s,face:%(font)s,size:%(size)d" % faces)
# Comment-blocks
self.StyleSetSpec(wx.stc.STC_P_COMMENTBLOCK, "face:%(font)s,fore:#7F7F7F,size:%(size)d" % faces)
# End of line where string is not closed
self.StyleSetSpec(wx.stc.STC_P_STRINGEOL, "face:%(font)s,fore:#000000,face:%(font)s,back:#E0C0E0,eol,size:%(size)d" % faces)
def OnUpdateUI(self, evt):
braces = self.GetMatchingBraces()
# check for matching braces
braceAtCaret = -1
braceOpposite = -1
charBefore = None
caretPos = self.GetCurrentPos()
if caretPos > 0:
charBefore = self.GetCharAt(caretPos - 1)
styleBefore = self.GetStyleAt(caretPos - 1)
# check before
if charBefore and chr(charBefore) in braces and styleBefore == wx.stc.STC_P_OPERATOR:
braceAtCaret = caretPos - 1
# check after
if braceAtCaret < 0:
charAfter = self.GetCharAt(caretPos)
styleAfter = self.GetStyleAt(caretPos)
if charAfter and chr(charAfter) in braces and styleAfter == wx.stc.STC_P_OPERATOR:
braceAtCaret = caretPos
if braceAtCaret >= 0:
braceOpposite = self.BraceMatch(braceAtCaret)
if braceAtCaret != -1 and braceOpposite == -1:
self.BraceBadLight(braceAtCaret)
else:
self.BraceHighlight(braceAtCaret, braceOpposite)
evt.Skip()
def DoIndent(self):
(text, caretPos) = self.GetCurLine()
self._tokenizerChars = {} # This is really too much, need to find something more like a C array
for i in range(len(text)):
self._tokenizerChars[i] = 0
ctext = cStringIO.StringIO(text)
try:
tokenize.tokenize(ctext.readline, self)
except:
pass
# Left in for debugging purposes:
#for i in range(len(text)):
# print i, text[i], self._tokenizerChars[i]
if caretPos == 0 or len(string.strip(text)) == 0: # At beginning of line or within an empty line
self.AddText('\n')
else:
doExtraIndent = False
brackets = False
commentStart = -1
if caretPos > 1:
startParenCount = 0
endParenCount = 0
startSquareBracketCount = 0
endSquareBracketCount = 0
startCurlyBracketCount = 0
endCurlyBracketCount = 0
startQuoteCount = 0
endQuoteCount = 0
for i in range(caretPos - 1, -1, -1): # Go through each character before the caret
if i >= len(text): # Sometimes the caret is at the end of the text if there is no LF
continue
if self._tokenizerChars[i] == 1:
continue
elif self._tokenizerChars[i] == 2:
startQuoteCount = startQuoteCount + 1
elif self._tokenizerChars[i] == 3:
endQuoteCount = endQuoteCount + 1
elif text[i] == '(': # Would be nice to use a dict for this, but the code is much more readable this way
startParenCount = startParenCount + 1
elif text[i] == ')':
endParenCount = endParenCount + 1
elif text[i] == "[":
startSquareBracketCount = startSquareBracketCount + 1
elif text[i] == "]":
endSquareBracketCount = endSquareBracketCount + 1
elif text[i] == "{":
startCurlyBracketCount = startCurlyBracketCount + 1
elif text[i] == "}":
endCurlyBracketCount = endCurlyBracketCount + 1
elif text[i] == "#":
commentStart = i
break
if startQuoteCount > endQuoteCount or startParenCount > endParenCount or startSquareBracketCount > endSquareBracketCount or startCurlyBracketCount > endCurlyBracketCount:
if i + 1 >= caretPos: # Caret is right at the open paren, so just do indent as if colon was there
doExtraIndent = True
break
else:
spaces = " " * (i + 1)
brackets = True
break
if not brackets:
spaces = text[0:len(text) - len(string.lstrip(text))]
if caretPos < len(spaces): # If within the opening spaces of a line
spaces = spaces[:caretPos]
# strip comment off
if commentStart != -1:
text = text[0:commentStart]
textNoTrailingSpaces = text[0:caretPos].rstrip()
if doExtraIndent or len(textNoTrailingSpaces) and textNoTrailingSpaces[-1] == ':':
spaces = spaces + ' ' * self.GetIndent()
self.AddText('\n' + spaces)
# Callback for tokenizer in self.DoIndent
def __call__(self, toktype, toktext, (srow,scol), (erow,ecol), line):
if toktype == tokenize.COMMENT:
for i in range(scol, ecol + 1):
self._validChars[i] = False
elif toktype == token.STRING:
self._tokenizerChars[scol] = 2 # Open quote
self._tokenizerChars[ecol - 1] = 3 # Close quote
for i in range(scol + 1, ecol - 2):
self._tokenizerChars[i] = 1 # Part of string, 1 == ignore the char
class PythonOptionsPanel(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
pathLabel = wx.StaticText(self, -1, _("python.exe Path:"))
config = wx.ConfigBase_Get()
path = config.Read("ActiveGridPythonLocation")
self._pathTextCtrl = wx.TextCtrl(self, -1, path, size = (150, -1))
self._pathTextCtrl.SetToolTipString(self._pathTextCtrl.GetValue())
self._pathTextCtrl.SetInsertionPointEnd()
choosePathButton = wx.Button(self, -1, _("Browse..."))
pathSizer = wx.BoxSizer(wx.HORIZONTAL)
HALF_SPACE = 5
pathSizer.Add(pathLabel, 0, wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.TOP, HALF_SPACE)
pathSizer.Add(self._pathTextCtrl, 0, wx.ALIGN_LEFT | wx.EXPAND | wx.RIGHT, HALF_SPACE)
pathSizer.Add(choosePathButton, 0, wx.ALIGN_RIGHT | wx.LEFT, HALF_SPACE)
wx.EVT_BUTTON(self, choosePathButton.GetId(), self.OnChoosePath)
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(pathSizer, 0, wx.LEFT | wx.RIGHT | wx.TOP, 10)
self._otherOptions = STCTextEditor.TextOptionsPanel(self, -1, configPrefix = "Python", label = "Python", hasWordWrap = False, hasTabs = True, addPage=False)
mainSizer.Add(self._otherOptions)
self.SetSizer(mainSizer)
parent.AddPage(self, _("Python"))
def OnChoosePath(self, event):
if _WINDOWS:
wildcard = _("*.exe")
else:
wildcard = _("*")
path = wx.FileSelector(_("Select a File"),
_(""),
_(""),
wildcard = wildcard ,
flags = wx.HIDE_READONLY,
parent = wx.GetApp().GetTopWindow())
if path:
self._pathTextCtrl.SetValue(path)
self._pathTextCtrl.SetToolTipString(self._pathTextCtrl.GetValue())
self._pathTextCtrl.SetInsertionPointEnd()
def OnOK(self, optionsDialog):
if len(self._pathTextCtrl.GetValue()) > 0:
config = wx.ConfigBase_Get()
config.Write("ActiveGridPythonLocation", self._pathTextCtrl.GetValue())
self._otherOptions.OnOK(optionsDialog)
#----------------------------------------------------------------------------
# Icon Bitmaps - generated by encode_bitmaps.py
#----------------------------------------------------------------------------
from wx import ImageFromStream, BitmapFromImage
from wx import EmptyIcon
import cStringIO
def getPythonData():
return \
"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x00\xd5IDAT8\x8d\x8d\x93Y\x0e\xc3 \x0cD\x9fM\xcf\xddNr2.\x96\xb8\x1f\
\x05\n\x84.#Y\x10\xa3\x19o\xb1\x99'*\xe2<\x82\x0e\xe6\xc9\xf8\x01\xef?\xa4\
\xf7)]\x05\x970O\xcdr\xce!\x119\xe7\x00\x02\x88\xfe}i\xb5\x848\x8f\xa8\x19\
\xcc\x19}+\xc5\xcc\xd3\x92<CZ\x0b\x99\xc4\xb2N\x01<\x80\xad\xdc?\x88\xf8\x1c\
X\x8f7\xe1\x1f\xdc*\xa9a+\xe1\xa3\xdc\xe7\xb4\xf6\xd1\xe5\xb6'\xc3@\xc5\xa0#\
\xab\x94\xd1\x0bL\xf0\xe6\x17\xa8v\xc3\x8aS\xa0.\x8be\x13\xe3\x15\x8f\xe1\
\xa5D\xee\xc9\xdb~%\xc7y\x84\xbb'sO\xd6\xd4\x17\xe4~\xc4\xf5\xef\xac\xa7\r\
\xbbp?b&\x0f\x89i\x14\x93\xca\x14z\xc5oh\x02E\xc4<\xd92\x03\xe0:B^\xc4K#\xe7\
\xe5\x00\x02\xfd\xb9H\x9ex\x02\x9a\x05a\xd2\xd3c\xc0\xcc\x00\x00\x00\x00IEND\
\xaeB`\x82"
def getPythonBitmap():
return BitmapFromImage(getPythonImage())
def getPythonImage():
stream = cStringIO.StringIO(getPythonData())
return ImageFromStream(stream)
def getPythonIcon():
icon = EmptyIcon()
icon.CopyFromBitmap(getPythonBitmap())
return icon

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,327 @@
#----------------------------------------------------------------------------
# Name: Service.py
# Purpose: Basic Reusable Service View for wx.lib.pydocview
#
# Author: Morgan Hua
#
# Created: 11/4/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.lib.docview
import wx.lib.pydocview
_ = wx.GetTranslation
FLOATING_MINIFRAME = -1
class ServiceView(wx.EvtHandler):
""" Basic Service View.
"""
bottomTab = None
#----------------------------------------------------------------------------
# Overridden methods
#----------------------------------------------------------------------------
def __init__(self, service):
wx.EvtHandler.__init__(self)
self._viewFrame = None
self._service = service
self._control = None
self._embeddedWindow = None
def Destroy(self):
wx.EvtHandler.Destroy(self)
def GetFrame(self):
return self._viewFrame
def SetFrame(self, frame):
self._viewFrame = frame
def _CreateControl(self, parent, id):
return None
def GetControl(self):
return self._control
def SetControl(self, control):
self._control = control
def OnCreate(self, doc, flags):
config = wx.ConfigBase_Get()
windowLoc = self._service.GetEmbeddedWindowLocation()
if windowLoc == FLOATING_MINIFRAME:
pos = config.ReadInt(self._service.GetServiceName() + "FrameXLoc", -1), config.ReadInt(self._service.GetServiceName() + "FrameYLoc", -1)
# make sure frame is visible
screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)
screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
if pos[0] < 0 or pos[0] >= screenWidth or pos[1] < 0 or pos[1] >= screenHeight:
pos = wx.DefaultPosition
size = wx.Size(config.ReadInt(self._service.GetServiceName() + "FrameXSize", -1), config.ReadInt(self._service.GetServiceName() + "FrameYSize", -1))
title = _(self._service.GetServiceName())
if wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI and wx.GetApp().GetAppName():
title = title + " - " + wx.GetApp().GetAppName()
frame = wx.MiniFrame(wx.GetApp().GetTopWindow(), -1, title, pos = pos, size = size, style = wx.CLOSE_BOX|wx.CAPTION|wx.SYSTEM_MENU)
wx.EVT_CLOSE(frame, self.OnCloseWindow)
elif wx.GetApp().IsMDI():
self._embeddedWindow = wx.GetApp().GetTopWindow().GetEmbeddedWindow(windowLoc)
frame = self._embeddedWindow
else:
pos = config.ReadInt(self._service.GetServiceName() + "FrameXLoc", -1), config.ReadInt(self._service.GetServiceName() + "FrameYLoc", -1)
# make sure frame is visible
screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)
screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
if pos[0] < 0 or pos[0] >= screenWidth or pos[1] < 0 or pos[1] >= screenHeight:
pos = wx.DefaultPosition
size = wx.Size(config.ReadInt(self._service.GetServiceName() + "FrameXSize", -1), config.ReadInt(self._service.GetServiceName() + "FrameYSize", -1))
title = _(self._service.GetServiceName())
if wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI and wx.GetApp().GetAppName():
title = title + " - " + wx.GetApp().GetAppName()
frame = wx.GetApp().CreateDocumentFrame(self, doc, flags, pos = pos, size = size)
frame.SetTitle(title)
if config.ReadInt(self._service.GetServiceName() + "FrameMaximized", False):
frame.Maximize(True)
wx.EVT_CLOSE(frame, self.OnCloseWindow)
self.SetFrame(frame)
sizer = wx.BoxSizer(wx.VERTICAL)
windowLoc = self._service.GetEmbeddedWindowLocation()
if self._embeddedWindow or windowLoc == FLOATING_MINIFRAME:
if (self._service.GetEmbeddedWindowLocation() == wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM):
if ServiceView.bottomTab == None:
ServiceView.bottomTab = wx.Notebook(frame, wx.NewId(), (0,0), (100,100), wx.LB_DEFAULT, "Bottom Tab")
sizer.Add(ServiceView.bottomTab, 1, wx.TOP|wx.EXPAND, 4)
def OnFrameResize(event):
ServiceView.bottomTab.SetSize(ServiceView.bottomTab.GetParent().GetSize())
frame.Bind(wx.EVT_SIZE, OnFrameResize)
# Factor this out.
self._control = self._CreateControl(ServiceView.bottomTab, wx.NewId())
if self._control != None:
ServiceView.bottomTab.AddPage(self._control, self._service.GetServiceName())
ServiceView.bottomTab.Layout()
else:
# Factor this out.
self._control = self._CreateControl(frame, wx.NewId())
sizer.Add(self._control)
else:
# Factor this out.
self._control = self._CreateControl(frame, wx.NewId())
sizer.Add(self._control, 1, wx.EXPAND, 0)
frame.SetSizer(sizer)
frame.Layout()
return True
def OnCloseWindow(self, event):
frame = self.GetFrame()
config = wx.ConfigBase_Get()
if frame and not self._embeddedWindow:
if not frame.IsMaximized():
config.WriteInt(self._service.GetServiceName() + "FrameXLoc", frame.GetPositionTuple()[0])
config.WriteInt(self._service.GetServiceName() + "FrameYLoc", frame.GetPositionTuple()[1])
config.WriteInt(self._service.GetServiceName() + "FrameXSize", frame.GetSizeTuple()[0])
config.WriteInt(self._service.GetServiceName() + "FrameYSize", frame.GetSizeTuple()[1])
config.WriteInt(self._service.GetServiceName() + "FrameMaximized", frame.IsMaximized())
if not self._embeddedWindow:
windowLoc = self._service.GetEmbeddedWindowLocation()
if windowLoc == FLOATING_MINIFRAME:
# don't destroy it, just hide it
frame.Hide()
else:
# Call the original OnCloseWindow, could have subclassed SDIDocFrame and MDIDocFrame but this is easier since it will work for both SDI and MDI frames without subclassing both
frame.OnCloseWindow(event)
def Activate(self, activate = True):
""" Dummy function for SDI mode """
pass
def Close(self, deleteWindow = True):
"""
Closes the view by calling OnClose. If deleteWindow is true, this
function should delete the window associated with the view.
"""
if deleteWindow:
self.Destroy()
return True
#----------------------------------------------------------------------------
# Callback Methods
#----------------------------------------------------------------------------
def SetCallback(self, callback):
""" Sets in the event table for a doubleclick to invoke the given callback.
Additional calls to this method overwrites the previous entry and only the last set callback will be invoked.
"""
wx.stc.EVT_STC_DOUBLECLICK(self.GetControl(), self.GetControl().GetId(), callback)
#----------------------------------------------------------------------------
# Display Methods
#----------------------------------------------------------------------------
def IsShown(self):
if not self.GetFrame():
return False
return self.GetFrame().IsShown()
def Hide(self):
self.Show(False)
def Show(self, show = True):
self.GetFrame().Show(show)
if self._embeddedWindow:
mdiParentFrame = wx.GetApp().GetTopWindow()
mdiParentFrame.ShowEmbeddedWindow(self.GetFrame(), show)
class Service(wx.lib.pydocview.DocService):
#----------------------------------------------------------------------------
# Constants
#----------------------------------------------------------------------------
SHOW_WINDOW = wx.NewId() # keep this line for each subclass, need unique ID for each Service
def __init__(self, serviceName, embeddedWindowLocation = wx.lib.pydocview.EMBEDDED_WINDOW_LEFT):
self._serviceName = serviceName
self._embeddedWindowLocation = embeddedWindowLocation
self._view = None
def GetEmbeddedWindowLocation(self):
return self._embeddedWindowLocation
def SetEmbeddedWindowLocation(self, embeddedWindowLocation):
self._embeddedWindowLocation = embeddedWindowLocation
def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
viewMenu = menuBar.GetMenu(menuBar.FindMenu(_("&View")))
menuItemPos = self.GetMenuItemPos(viewMenu, viewMenu.FindItem(_("&Status Bar"))) + 1
viewMenu.InsertCheckItem(menuItemPos, self.SHOW_WINDOW, self.GetMenuString(), self.GetMenuDescr())
wx.EVT_MENU(frame, self.SHOW_WINDOW, frame.ProcessEvent)
wx.EVT_UPDATE_UI(frame, self.SHOW_WINDOW, frame.ProcessUpdateUIEvent)
return True
def GetServiceName(self):
""" String used to save out Service View configuration information """
return self._serviceName
def GetMenuString(self):
""" Need to override this method to provide menu item for showing Service View """
return _(self.GetServiceName())
def GetMenuDescr(self):
""" Need to override this method to provide menu item for showing Service View """
return _("Show or hides the %s window") % self.GetMenuString()
#----------------------------------------------------------------------------
# Event Processing Methods
#----------------------------------------------------------------------------
def ProcessEvent(self, event):
id = event.GetId()
if id == self.SHOW_WINDOW:
self.ToggleWindow(event)
return True
else:
return False
def ProcessUpdateUIEvent(self, event):
id = event.GetId()
if id == self.SHOW_WINDOW:
event.Check(self._view != None and self._view.IsShown())
event.Enable(True)
return True
else:
return False
#----------------------------------------------------------------------------
# View Methods
#----------------------------------------------------------------------------
def _CreateView(self):
""" This method needs to be overridden with corresponding ServiceView """
return ServiceView(self)
def GetView(self):
# Window Menu Service Method
return self._view
def SetView(self, view):
self._view = view
def ShowWindow(self, show = True):
if show:
if self._view:
if not self._view.IsShown():
self._view.Show()
else:
view = self._CreateView()
view.OnCreate(None, flags = 0)
self.SetView(view)
else:
if self._view:
if self._view.IsShown():
self._view.Hide()
def HideWindow(self):
self.ShowWindow(False)
def ToggleWindow(self, event):
show = event.IsChecked()
wx.ConfigBase_Get().WriteInt(self.GetServiceName()+"Shown", show)
self.ShowWindow(show)
def OnCloseFrame(self, event):
if not self._view:
return True
if wx.GetApp().IsMDI():
self._view.OnCloseWindow(event)
# This is called when any SDI frame is closed, so need to check if message window is closing or some other window
elif self._view == event.GetEventObject().GetView():
self.SetView(None)
return True

View File

@@ -0,0 +1,48 @@
#----------------------------------------------------------------------------
# Name: TabbedView.py
# Purpose:
#
# Author: Peter Yared
#
# Created: 8/17/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.lib.docview
class TabbedView(dict, wx.lib.docview.View):
#----------------------------------------------------------------------------
# Overridden methods
#----------------------------------------------------------------------------
def __init__(self):
wx.lib.docview.View.__init__(self)
self._views = {}
self._currentView = None
def OnCreate(self, doc, flags):
frame = wx.GetApp().CreateDocumentFrame(self, doc, flags)
sizer = wx.BoxSizer()
self._notebook = wx.Notebook(frame, -1, style = wx.NB_BOTTOM)
self.Activate()
return True
def AddView(self, viewName, view):
self._notebook.AddPage(wx.Panel(self._notebook, -1), viewName)
self._currentView = view
self._views[viewName] = view
def __getattr__(self, attrname):
return getattr(self._currentView, attrname)
def SetView(self, viewName):
self._currentview = self._views[viewName]

View File

@@ -0,0 +1,115 @@
#----------------------------------------------------------------------------
# Name: UICommon.py
# Purpose: Shared UI stuff
#
# Author: Matt Fryer
#
# Created: 3/10/05
# CVS-ID: $Id$
# Copyright: (c) 2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import os
import os.path
import wx
import ProjectEditor
_ = wx.GetTranslation
def CreateDirectoryControl( parent, fileLabel, dirLabel, fileExtension, startingName="", startingDirectory=""):
nameControl = wx.TextCtrl(parent, -1, startingName, size=(-1,-1))
nameLabelText = wx.StaticText(parent, -1, fileLabel)
dirLabelText = wx.StaticText(parent, -1, dirLabel)
dirControl = wx.TextCtrl(parent, -1, startingDirectory, size=(-1,-1))
dirControl.SetToolTipString(startingDirectory)
button = wx.Button(parent, -1, _("Browse..."), size=(60,-1))
def OnFindDirClick(event):
name = ""
nameCtrlValue = nameControl.GetValue()
if nameCtrlValue:
root, ext = os.path.splitext( nameCtrlValue )
if ext == '.' + fileExtension:
name = nameCtrlValue
else:
name = _("%s.%s") % (nameCtrlValue, fileExtension)
path = wx.FileSelector(_("Choose a filename and directory"),
"",
"%s" % name,
wildcard=_("*.%s") % fileExtension ,
flags=wx.SAVE,
parent=parent)
if path:
dir, filename = os.path.split(path)
dirControl.SetValue(dir)
dirControl.SetToolTipString(dir)
nameControl.SetValue(filename)
parent.Bind(wx.EVT_BUTTON, OnFindDirClick, button)
def Validate(allowOverwriteOnPrompt=False):
if nameControl.GetValue() == "":
wx.MessageBox(_("Please provide a filename."), _("Provide a Filename"))
return False
if nameControl.GetValue().find(' ') != -1:
wx.MessageBox(_("Please provide a filename that does not contains spaces."), _("Spaces in Filename"))
return False
filePath = os.path.join(dirControl.GetValue(), MakeNameEndInExtension(nameControl.GetValue(), "." + fileExtension))
if os.path.exists(filePath):
if allowOverwriteOnPrompt:
res = wx.MessageBox(_("That file already exists. Would you like to overwrite it."), "File Exists", style=wx.YES_NO|wx.NO_DEFAULT)
return (res == wx.YES)
else:
wx.MessageBox(_("That file already exists. Please choose a different name."), "File Exists")
return False
return True
HALF_SPACE = 5
flexGridSizer = wx.FlexGridSizer(cols = 3, vgap = HALF_SPACE, hgap = HALF_SPACE)
flexGridSizer.AddGrowableCol(1,1)
flexGridSizer.Add(nameLabelText, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.TOP|wx.RIGHT, HALF_SPACE)
flexGridSizer.Add(nameControl, 2, flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
flexGridSizer.Add(button, flag=wx.ALIGN_RIGHT|wx.LEFT, border=HALF_SPACE)
flexGridSizer.Add(dirLabelText, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.TOP|wx.RIGHT, border=HALF_SPACE)
flexGridSizer.Add(dirControl, 2, flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, border=HALF_SPACE)
flexGridSizer.Add(wx.StaticText(parent, -1, ""), 0)
return nameControl, dirControl, flexGridSizer, Validate
def AddFilesToCurrentProject(paths, save=False):
projectService = wx.GetApp().GetService(ProjectEditor.ProjectService)
if projectService:
projectDocument = projectService.GetCurrentProject()
if projectDocument:
files = projectDocument.GetFiles()
for path in paths:
if path in files:
paths.remove(path)
if paths:
projectDocument.GetCommandProcessor().Submit(ProjectEditor.ProjectAddFilesCommand(projectDocument, paths))
if save:
projectDocument.OnSaveDocument(projectDocument.GetFilename())
def MakeNameEndInExtension(name, extension):
if not name:
return name
root, ext = os.path.splitext(name)
if ext == extension:
return name
else:
return name + extension
# Lame
def PluralName(name):
if not name:
return name
if name.endswith('us'):
return name[0:-2] + 'ii'
elif name.endswith('s'):
return name
elif name.endswith('y'):
return name[0:-1] + 'ies'
else:
return name + 's'

View File

@@ -0,0 +1,967 @@
#----------------------------------------------------------------------------
# Name: Wizard.py
# Purpose:
#
# Author: Peter Yared
#
# Created: 10/28/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import wx.xrc as xrc
import wx.wizard
#----------------------------------------------------------------------------
# Classes
#----------------------------------------------------------------------------
class BaseWizard(wx.wizard.Wizard):
def __init__(self, parent, title, pos=(-1,-1)):
wizardBitMap = getWizardBitmap()
wx.wizard.Wizard.__init__(self, parent, wx.NewId(), title, wizardBitMap, pos=pos)
def GetDocument(self):
if self.GetParent() and hasattr(self.GetParent(), 'GetDocument'):
return self.GetParent().GetDocument()
else:
return None
def SetPrevNext(self, prev, next):
prev.SetNext(next)
next.SetPrev(prev)
class TitledWizardPage(wx.wizard.PyWizardPage):
def __init__(self, parent, title):
self._prev = None
self._prevFunc = None
self._next = None
self._nextFunc = None
wx.wizard.PyWizardPage.__init__(self, parent)
self.SetSizer(wx.BoxSizer(wx.VERTICAL))
self.MakePageTitle(title)
def MakePageTitle(self, title):
sizer = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, -1, title)
title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
sizer.Add(title, 0, wx.ALIGN_LEFT | wx.ALL, 5)
sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 5)
self.GetSizer().Add(sizer)
def GetPrev(self):
if self._prevFunc:
self._prev = self._prevFunc()
return self._prev
def SetPrev(self, prev):
self._prev = prev
self._prevFunc = None
def GetPrevFunc(self):
return self._prevFunc
def SetPrevFunc(self, prevFunc):
self._prevFunc = prevFunc
self._prev = None
def GetNext(self):
if self._nextFunc:
self._next = self._nextFunc()
return self._next
def SetNext(self, next):
self._next = next
self._nextFunc = None
def GetNextFunc(self):
return self._nextFunc
def SetNextFunc(self, nextFunc):
self._nextFunc = nextFunc
self._next = None
def SetPrevNext(self, prev, next):
self._prev = prev
self._next = next
self._nextFunc = None
self._prevFunc = None
#----------------------------------------------------------------------------
# Menu Bitmaps - generated by encode_bitmaps.py
#----------------------------------------------------------------------------
from wx import ImageFromStream, BitmapFromImage
import cStringIO
def getWizardData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00}\x00\x00\x00\xfa\x08\x06\
\x00\x00\x00\x8c5HE\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x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fd\xde\x18\xd2%l\xcbTc\
p\xf7\x9e<\x19\x9b\x18p\xf1\xf9O\x16\xa7\x8a\x14\xd9yA\x0c\x14\x86\x12\x88T\
\x1e\x14\xbf\xa18\xaf<\x8bs\xa7\x05\xb0U \x95t/9\xa8\x01\x15\xe7\xe2\x99%\
\xd8*\xf9\xff\x1baQ61\x94\xec\xcc\x88\xc4|B(\x8a&N\xa00u\xf0f\xa4\xda\x90F)r\
\x82^\xaa\xe6\x94\x80R\x18\xc2D\xa88\x08/\x02\xc1\xbeW\xf7STTDaa!\xf9\xf9y(\
\xa5x\xfe\xf9\xe7\xf1x<\x94\x95\x95\xa5\x8fP\x93u\x9d\xba\xaea\x18\x14\x14\
\x14\xbck\xe9\xce\xcf\xcf\'???\xfd\xfa\xbc\xbc\xbc\xff\xe6\xe0~$\xc6\xec]6e\
\xb8\x91*\x991\xcd\x12.\xdc\xe9S\xf4d\xf8\xa6\x84\x91\xcc\xadh\x08\x1f\x86\r\
R(\x10F\xfa8U\xb9\xfd(\x92\xe5"\x15\xf2\'\x95\x03\x99tbZ\x14B$\xbfP*\x19\xf1\
\x11c\xd4\x91\xec\xf0\xccD\x812\x04\n\x0f\x16"\x99\xed\xcd\xb6\xd9\xb4i\x13\
\xbd\xbd\xbdTVV\x92\x97\x97Gss3\r\r\r\xac\\\xb9\x12\xbf\xdf\xff\x9e\x99\x1a\
\xde\xab<]\xdf\xc7\x881\x93.\x95\x8d\x9dz\xdf\\*\x1b\x84\x1c\x95\x1e\xd2\x95\
\n\xa0;\x1c\xcbMa`\xa5~,\xd5p\x16\xd2\xe1?\x04\x99\x0e\xe4\x0b\xc9\xcc\xab\
\xa76F\xc9P}\xb6p3|\xf9\xf7\xbam\x1a.\x97\xa9\xe5\xdf0\x0c\xee\xba\xeb.v\xee\
\xdc\xc9\xa1C\x87hlld\xd2\xa4I\xdcq\xc7\x1d\xcc\x981c\xdco\xc0\xfe[dT\xba\
\xb2-\x84!1\x01\x97\x10\xa7\xf6\xa7\xa3\x1fF?I\r\xac\x18\xd9\xb8\xf4`\'\x15\
\xa6\xc3{\xa5\x8aO\t\x1f\xfe-\xf5\xc1\xdb\x92\x11\xf5\x8c$++\x8b\xaa\xaa*\
\xaa\xaa\xaa>\xe8\n\xff\xb3dt\xed\xb1\x85L\x07\xe0\x1d=\xbc\x1fe\xc6\xbc\xdf\
\x9c=\xddk?\xec\xb5\x9dCF\xa5\'l\xc5\xe8,\xb1\x9a\x8f\x03\x19]\xde}\xf2t\xeb\
\xb8f\xbc\xf9\xf8\xddZj2\x8e\x96\xee@\xb4t\x07\xa2\xa5;\x10-\xdd\x81h\xe9\
\x0eDKw Z\xba\x03\xd1\xd2\x1d\x88\x96\xee@\xb4t\x07\xa2\xa5;\x10-\xdd\x81h\
\xe9\x0eDKw Z\xba\x03\xd1\xd2\x1d\x88\x96\xee@\xb4t\x07\xa2\xa5;\x10-\xdd\
\x81h\xe9\x0eDKw Z\xba\x03\xd1\xd2\x1d\x88\x96\xee@\xb4t\x07\xa2\xa5;\x10-\
\xdd\x81h\xe9\x0eDKw Z\xba\x03\xd1\xd2\x1d\x88\x96\xee@\xb4t\x07\xa2\xa5;\
\x10-\xdd\x81h\xe9\x0eDKw Z\xba\x03\xd1\xd2\x1d\x88\x96\xee@\xb4t\x07\xa2\
\xa5;\x10-\xdd\x81h\xe9\x0eDKw Z\xba\x03\xd1\xd2\x1d\x88\x96\xee@\xb4t\x07\
\xa2\xa5;\x10-\xdd\x81h\xe9\x0eDKw Z\xba\x03\xd1\xd2\x1d\x88\x96\xee@\xb4t\
\x07\xa2\xa5;\x10-\xdd\x81h\xe9\x0eDKw Z\xba\x03\xd1\xd2\x1d\x88\x0b`\xe3\
\xa6\xc7\xc5\xc6M\x8f\x8fw[4c\x84PJ\xa9\xf1n\x84fl\xf97\x87\xba&\x9e\x12\xca\
GT\x00\x00\x00\x00IEND\xaeB`\x82'
def getWizardDataOld():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00t\x00\x00\x01\x04\x08\x06\
\x00\x00\x00\xf9\xcf\x10R\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x0f\xdfIDATx\x9c\xed]K\xb6\xe3(\x0cU\xf5\xa9MU\x86\xd9\xd6\xcb\xd0\xd9\
\x96\x87\xaeeU\x0f\xfc\t\x06\x01\x12\x16\x1f+\xba\xe7\xf4\xe9\xd4\xb3-d\xf0E\
\t\xf8\xb5,\xcb\xbf\xc7c\x06\xc3\x05L\x00\xf0\xfa\xd9~\xbf\xcf\xbf\x81p\r\
\xbb\xaf\xf0\xdao\xb1\x97\xfa6L\xdb\xff_?\x00/\xb8\xd6@\xdc\x0f q\xed?\x89w\
\xfb\x0e\xfc\xac\x8d8m\xbf\x07\x8514\x8b\x9dU\xefj\xac\x92\xecr\x8d\xa1\x01~\
\xe0`\xe3\xc0L\x8c\xc1\x18z\xc2O5\xe6$\xaf\t\xb2\xfd\xd7:\xca\xfd\xc3\x7fw\
\xc3\x90\xd8\x18\xfa\xee\xabE\x17\x10\xd8X\xc2\x9c\xa3.\x192\xa5\xd8\x0eoc\
\xa86|\x19C\xa5F\x9f\x992\xc8\xacz\xe7\x9fs\xef#80\x8c\xa1\xca\xa0\x9f\xa1\
\xaeG\xe7\xca\xe83\xc9J\x80\x13\xfb\xb3\xb6\x17\xa9o\x9f}\xae^~\xd9\x13Du6\
\x86*\x83b\x86\xd6\x9a\x1f\x12\xd8\x95\x1d\x01#\xe00t\x7f?c\xa8~\xe8bh\xec+\
\xdf\xff\xdd\xcb\xc7J\xaa_\xc2(\x97\xf0\x9c1T\x19\x140\xb4\xd4\xff\x1a{ga\
\x1fkvt\xbc\x81mC\x11\xbd\xcd\x86\xea\xc3\x8d\x19\xca\xf4\xbf\x96\xbec\x8a9~\
\xd9\xa5\xd7\x04\xed\xfeM\xc3g?\xf1\x97E_\xfcBQ~z\xc9!s\xc0\xc1\xd7=\x03\xdc\
?\xe8_\'\x00\x80\xe9\r\xc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xfe\
\xe5\x93\xf8\x95\xef5p\xfb\'\x01\xb3\xa1\'\xb0l\xe8Vq\xc1\xfaP\xe2\xca\xef\
\x11\x02\xd91\xdcj\x17\x94\x14h\xcey8<J\xeb3\xfe`\xe5\x0f\xc4\xea\xe2t\xd0]\
\x95\xdeE\x86\xa1\xf5\x8f\xca:\xb2\xd1\xbd2\xc4\xbfr\xf7\xa5#\xb2\xa7L\xc5\
\xb8\x83\xb7\xa4\xfcD\x19W\x10\xad#zY\xb7\xdcI\x0c\x83\xbf\x93X\x80\x083\xf7\
\x7f\x1f\xbf\x01\x00\xab\x0f<1\xec\xba\xde\xae~\x12\xa3\xdc6\x87\xd9\xb9_^5\
\xa6\xfeu~\x9fe\x9e\xec\x9fS\xee\x03>\x19\x07\x07",]7\xb0\xf2\xbbr\xc1zs\x1b\
-U_\x194\xdas\x9e\x90J!\x19\x8b\xf4\xd6\x9f\x02D\x96\xfa;i$\xd4\xc8\x08\xd9g\
\xcc\xc6]l\xe8\x8e\x143EX\x1a\xda\xd0\x143\xddc%\xc3#.S\xfa|\x18\xbd,\xc2^)\
\x01\x1b\xda\xf0T\x88:\xe9\x1f;\x02\xe6 \xe7\x9c\x9dYuf\x84\x9f\xec\x15\xed1\
\xbc\xac\x84u\x03\xc9K\xaa\x1fr%z\xafv\r\xda!\xfd\x03 \x11d\xc6\xc2{\xae\xdf\
\x96\xb0\xc9\xd5!_dpt\xb7\x007\xe1\xc8\xe5\x9ae\xb3?\xda\x94>\x03\x1f\x9f\
\xd5\xf8\xa8\xacL\xae\xea\x85n7v\x96v|\xf0\x12\xa6\xc8\xe0\x03\xa7H\x81N\x97\
>\xcf\xf3\xf5nWe\x92\x984K\x93\xcc\x0c?\x1e\xea&W\xbb\xec\x1d\xcf\xe78\xfb\
\x1au8\x106\x97\x01^\xc8\xd2\xa2\x14J<\xbcwrR\x10\xa60\xf4\xf22\xba\xdc\xca\
\x86\x92!0\x85!\xdb\xcc|E\xf9K\xf2]\xf4;\x8c>\x8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x991y\x1c\xbdNpG\x97o\
\xb8\xcb\x11\x99\xf7\xb4\xa1]\xb07p\xa1\x93"u\xcd\x02\xdc\x86\x18\xae\xad>+\
\xedrc\xcf\x97\xca\xa1\xc8ma\xcbK\x03\xe3\x82l7\x86*C_\x86\xc6\xe4\\\x91\x95\
\x92)!wp\x18C\x95a\x0c\x86b\xb2\xae\xca\x8b\xc9\x94\x90;0\x8c\xa1\xca06C\xaf\
\xca\xac)wP\x18C\x95a\x1c\x86b\xf2F\x97; \x8c\xa1\xca0\x16C1\x995\xe5J\xc9\
\x1e\x08\xc6Pe\xf8\x1e\x86\xd6\x96=\x08\xc6\xc9)JA*\xdd\xa4G\xdepc\x8c\xd7\
\xa0\xca\x18\xd3\x1a\xe35h\x0c5\x99\xa4\x88\xa5c6h\xedD5\xc5\x18\xb3A{0F\tK\
\xc7lP\xe5,\xaa\x891\x1b\xb46\x14\x7f0\xe6XP\x86\xf1\x1c\x0b1\xd9w\x93\xdf\t\
\xc6Pe\x18\x97\xa1\x98|\xc92\x8c\xa1\x86;\xc0\x18ZCvG\x18C\x95\xc1\x18ZCvG\
\x18C\x95a\xfc\xdd8[B\x01C\xd7\x06}\xddc1\xab!\x0fc\xa8\x0b\x05\x0c\xfdN\xe7\
|\x0c\nBh[\x97[\xf8\xb4\x8dr\x87\x831\xd4\x85\x02\x86\xde\xabAk3\xc8\x18Z\
\x11\n\xd8\xd2\x03\xe36\xa8\xa1\x08\xd6\xa0\xca`\xae?e\x18\xd79\xdfz\xca")\
\xbf#\x8c\xa1\xca`\x0c\x95\x96\xdd\x19\xc6Pe\x18\x93\xa15m\x9cbv\x02\x18C\
\xd5\xe1>\x0c\xad%[\x11;\x01\x8c\xa1\xea0\x1eCmt{\t\xc6Pe\xf8\x1e\x86*\xf6\
\x0e\xb90\x86*\xc3X\x0cm\xc9Ne\xcc\xdc1N\xf8\xacV@\xfb\xcb\x02\xe5\xe34(\x86\
Z\xbbp*\xc6\xd8\rZ\x0bJ\xbb[\x80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\x89\xa1\
\xcdRD\xa8\x8eu\x02\xb2\xae9\xa2.\xc5z\x84\x8e\x8f\xf3n\x9c\xad\x12\x93\x87J\
\xa5\x1c \xd2T\x0c\xdf\x9e\x1e\xbe\\\x8f\xa1\xb5\x1a\xb6wC^\xb1w(\x84\xa6;\
\xa5\t\x06\xae\x0c\x00\x0bpk\xc4\xb5\xd5gw\xc2e{\xe7B\xca\x0e_\xb5\xa1\xa1.\
\xc6Pe\xf8\x0e\x86J\xb8\xf7\x0ePSCJ\xf4*\x94\x03fC\xd5\xe2\x0b\x18\x9a\xf6}\
\xb2Q\x93\xed\x02z\x19C\x95\xe1\x0b\x19z\xf1]\xc5\xec\xde\xa6\x9b1\xd4\x90\
\x82r\x86\nET0\x99\x83\xb2\xdd\x18\xaa\x0c\xba\x19*\xea\x1d\x82l\xfa\x07\x1f\
\x826t\x93g\x0cU\x06\xdd\x0c\xbd\x1a\r\xc1\xe4\x01\x0cjCWyx\xf8L\x0b\xbe\xae\
\xcb\x1d1\x05E\n\xe2;\x85"\xe9&\x03B1C\x89\xebR\xa8`\xe5\xde2eJ\xe9\x08\x9a\
\x19Z\x1dc\x8e;\xf42\x14M7a\xae!\xe1\xaeQ)\xbd&\xb1\x0b\xcav\xcd\x18\xaa\x0c\
\xd6\xa0\xca`\x8e\x05eP\xecX\xa8=\xca\xbd(\xcf\x95)8\xca5\x86*\x83^\x86\xfa\
\xa3\\\t\xb7_\xd5P\x1c\x80D;\x18C\x95\xe17\x00\xc0\xd4{\x9f"\x83\x18\xfe\x07\
\xd2\x8b\x12\xe7\xc3\x8c\xd4\xb6\x00\x00\x00\x00IEND\xaeB`\x82'
def getWizardBitmap():
return BitmapFromImage(getWizardImage())
def getWizardImage():
stream = cStringIO.StringIO(getWizardDataOld()) # NOTE: This reverts us to the bitmap Peter likes.
return ImageFromStream(stream)

View File

@@ -0,0 +1,165 @@
#----------------------------------------------------------------------------
# Name: XmlEditor.py
# Purpose: Abstract Code Editor for pydocview tbat uses the Styled Text Control
#
# Author: Peter Yared
#
# Created: 8/15/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import wx
import string
import STCTextEditor
import CodeEditor
class XmlDocument(CodeEditor.CodeDocument):
pass
class XmlView(CodeEditor.CodeView):
def GetCtrlClass(self):
""" Used in split window to instantiate new instances """
return XmlCtrl
def GetAutoCompleteHint(self):
pos = self.GetCtrl().GetCurrentPos()
if pos == 0:
return None, None
validLetters = string.letters + string.digits + '_:'
word = ''
while (True):
pos = pos - 1
if pos < 0:
break
char = chr(self.GetCtrl().GetCharAt(pos))
if char not in validLetters:
break
word = char + word
return None, word
def GetAutoCompleteDefaultKeywords(self):
return XMLKEYWORDS
class XmlService(CodeEditor.CodeService):
def __init__(self):
CodeEditor.CodeService.__init__(self)
class XmlCtrl(CodeEditor.CodeCtrl):
def __init__(self, parent, ID = -1, style = wx.NO_FULL_REPAINT_ON_RESIZE):
CodeEditor.CodeCtrl.__init__(self, parent, ID, style)
self.SetLexer(wx.stc.STC_LEX_XML)
self.SetProperty("fold.html", "1")
def GetMatchingBraces(self):
return "<>[]{}()"
def CanWordWrap(self):
return True
def SetViewDefaults(self):
CodeEditor.CodeCtrl.SetViewDefaults(self, configPrefix = "Xml", hasWordWrap = True, hasTabs = True)
def GetFontAndColorFromConfig(self):
return CodeEditor.CodeCtrl.GetFontAndColorFromConfig(self, configPrefix = "Xml")
def UpdateStyles(self):
CodeEditor.CodeCtrl.UpdateStyles(self)
if not self.GetFont():
return
faces = { 'font' : self.GetFont().GetFaceName(),
'size' : self.GetFont().GetPointSize(),
'size2': self.GetFont().GetPointSize() - 2,
'color' : "%02x%02x%02x" % (self.GetFontColor().Red(), self.GetFontColor().Green(), self.GetFontColor().Blue())
}
# White space
self.StyleSetSpec(wx.stc.STC_H_DEFAULT, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces)
# Comment
self.StyleSetSpec(wx.stc.STC_H_COMMENT, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces)
# Number
self.StyleSetSpec(wx.stc.STC_H_NUMBER, "face:%(font)s,fore:#007F7F,size:%(size)d" % faces)
# String
self.StyleSetSpec(wx.stc.STC_H_SINGLESTRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
self.StyleSetSpec(wx.stc.STC_H_DOUBLESTRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces)
# Tag
self.StyleSetSpec(wx.stc.STC_H_TAG, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces)
# Attributes
self.StyleSetSpec(wx.stc.STC_H_ATTRIBUTE, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces)
class XmlOptionsPanel(STCTextEditor.TextOptionsPanel):
def __init__(self, parent, id):
STCTextEditor.TextOptionsPanel.__init__(self, parent, id, configPrefix = "Xml", label = "XML", hasWordWrap = True, hasTabs = True)
XMLKEYWORDS = [
"ag:connectionstring", "ag:datasource", "ag:editorBounds", "ag:label", "ag:name", "ag:shortLabel", "ag:type",
"element", "fractionDigits", "length", "minOccurs", "name", "objtype", "refer", "schema", "type", "xpath", "xmlns",
"xs:complexType", "xs:element", "xs:enumeration", "xs:field", "xs:key", "xs:keyref", "xs:schema", "xs:selector"
]
#----------------------------------------------------------------------------
# Icon Bitmaps - generated by encode_bitmaps.py
#----------------------------------------------------------------------------
from wx import ImageFromStream, BitmapFromImage
from wx import EmptyIcon
import cStringIO
def getXMLData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x01\x18IDAT8\x8d\xed\x92=N\xc3P\x0c\xc7\x7f~\xc9K\xd2\xa0\x16\xa9\xdc\
\x84+\xf4\x06\x1c\xa1\x12\x133\xa7`\xea\x05\xba\xc0\xc0\xd0\x93\x80*uc``e\t\
\x82\xb6J\xf3Q?3D\x04\x81`\xea\xc2\x80\x17K\xb6\xfc\xff\xb0-ff\x1c\x10\xee\
\x90\xe1\xbf\x01\x10s}\x0em\tu\t\xfb\x06\xcbFP\xad\x11\x17\x81\x196\x18!\xdb\
\x02\xd2#hk\xc8\x8f\t\xc1p\x89g\xb9\\\x11\xdb\xfd-\xbcn\x91\xa8C\x94,\x81\
\xaa\xe9\x19\xe4\x1b\xa3}R\xf3\xf0\x08\x0e\x9f\x81\xef\x9c\x94s\x83\xaa\xe92\
P\xcf\nv\xa7g\xd4\xb3\xa2\xef\xaf\xc5#i\x04\x89#\x8a\x05\'m\r)\x84\r\xe4S\
\xa1\x9c\x1b\xf9\xb4\xe3\xd5\xe1\x18?\xb9@\x87\xe3^\x81\xbe\xb5H\xab`\x013\
\xc3\xa9\xf3h\x15pC\xfa\xe1\x0f\x05\x00\xf1\xd5\xe4\x8b\x85la\x10@[0q\x88]\
\x9e\x18/\x05\xe8/k\xde\x01\x83\x1f\xea\x19,\x9e\x1c\xf1\xcdj\xc3\xae\x01jP\
\x05\x9fv\x07q1\x88\x83(\x8f\xd0\x8d"1h\x05\xba\x077\x80$\x87\xbb\xe7\x80\
\xfc\xbf\xf2\xe1\x00\xef\x8c\xb8x\x06\x07\xd1$\xff\x00\x00\x00\x00IEND\xaeB`\
\x82'
def getXMLBitmap():
return BitmapFromImage(getXMLImage())
def getXMLImage():
stream = cStringIO.StringIO(getXMLData())
return ImageFromStream(stream)
def getXMLIcon():
icon = EmptyIcon()
icon.CopyFromBitmap(getXMLBitmap())
return icon

View File

@@ -0,0 +1,896 @@
#!/usr/bin/env python
# Copyright (c) 2001-2004, MetaSlash Inc. All rights reserved.
"""
Copyright notice from pychecker:
Copyright (c) 2000-2001, MetaSlash Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
- Neither name of MetaSlash Inc. nor the names of contributors
may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
"""
Check python source code files for possible errors and print warnings
Contact Info:
http://pychecker.sourceforge.net/
pychecker-list@lists.sourceforge.net
"""
import string
import types
import sys
import imp
import os
import glob
import traceback
import re
import wx
_ = wx.GetTranslation
# see __init__.py for meaning, this must match the version there
LOCAL_MAIN_VERSION = 1
def setupNamespace(path) :
# remove pychecker if it's the first component, it needs to be last
if sys.path[0][-9:] == 'pychecker' :
del sys.path[0]
# make sure pychecker is last in path, so we can import
checker_path = os.path.dirname(os.path.dirname(path))
if checker_path not in sys.path :
sys.path.append(checker_path)
if __name__ == '__main__' :
setupNamespace(sys.argv[0])
from pychecker import utils
from pychecker import printer
from pychecker import warn
from pychecker import OP
from pychecker import Config
from pychecker import function
from pychecker.Warning import Warning
# Globals for storing a dictionary of info about modules and classes
_allModules = {}
_cfg = None
# Constants
_DEFAULT_MODULE_TOKENS = ('__builtins__', '__doc__', '__file__', '__name__',
'__path__')
_DEFAULT_CLASS_TOKENS = ('__doc__', '__name__', '__module__')
_VERSION_MISMATCH_ERROR = '''
There seem to be two versions of PyChecker being used.
One is probably in python/site-packages, the other in a local directory.
If you want to run the local version, you must remove the version
from site-packages. Or you can install the current version
by doing python setup.py install.
'''
def cfg() :
return utils.cfg()
def _flattenList(list) :
"Returns a list which contains no lists"
new_list = []
for element in list :
if type(element) == types.ListType :
new_list.extend(_flattenList(element))
else :
new_list.append(element)
return new_list
def getModules(arg_list) :
"Returns a list of module names that can be imported"
global _output
new_arguments = []
for arg in arg_list :
# is this a wildcard filespec? (necessary for windows)
if '*' in arg or '?' in arg or '[' in arg :
arg = glob.glob(arg)
new_arguments.append(arg)
PY_SUFFIXES = ['.py']
PY_SUFFIX_LENS = [3]
if _cfg.quixote:
PY_SUFFIXES.append('.ptl')
PY_SUFFIX_LENS.append(4)
modules = []
for arg in _flattenList(new_arguments) :
fullpath = arg
# is it a .py file?
for suf, suflen in zip(PY_SUFFIXES, PY_SUFFIX_LENS):
if len(arg) > suflen and arg[-suflen:] == suf:
arg_dir = os.path.dirname(arg)
if arg_dir and not os.path.exists(arg) :
txt = _('File or pathname element does not exist: "%s"') % arg
_output.AddLines(txt)
continue
module_name = os.path.basename(arg)[:-suflen]
if arg_dir not in sys.path :
sys.path.insert(0, arg_dir)
arg = module_name
modules.append((arg, fullpath))
return modules
def _q_file(f):
# crude hack!!!
# imp.load_module requires a real file object, so we can't just
# fiddle def lines and yield them
import tempfile
fd, newfname = tempfile.mkstemp(suffix=".py", text=True)
newf = os.fdopen(fd, 'r+')
os.unlink(newfname)
for line in f:
mat = re.match(r'(\s*def\s+\w+\s*)\[(html|plain)\](.*)', line)
if mat is None:
newf.write(line)
else:
newf.write(mat.group(1)+mat.group(3)+'\n')
newf.seek(0)
return newf
def _q_find_module(p, path):
if not _cfg.quixote:
return imp.find_module(p, path)
else:
for direc in path:
try:
return imp.find_module(p, [direc])
except ImportError:
f = os.path.join(direc, p+".ptl")
if os.path.exists(f):
return _q_file(file(f)), f, ('.ptl', 'U', 1)
def _findModule(name) :
"""Returns the result of an imp.find_module(), ie, (file, filename, smt)
name can be a module or a package name. It is *not* a filename."""
path = sys.path[:]
packages = string.split(name, '.')
for p in packages :
# smt = (suffix, mode, type)
file, filename, smt = _q_find_module(p, path)
if smt[-1] == imp.PKG_DIRECTORY :
try :
# package found - read path info from init file
m = imp.load_module(p, file, filename, smt)
finally :
if file is not None :
file.close()
# importing xml plays a trick, which replaces itself with _xmlplus
# both have subdirs w/same name, but different modules in them
# we need to choose the real (replaced) version
if m.__name__ != p :
try :
file, filename, smt = _q_find_module(m.__name__, path)
m = imp.load_module(p, file, filename, smt)
finally :
if file is not None :
file.close()
new_path = m.__path__
if type(new_path) == types.ListType :
new_path = filename
if new_path not in path :
path.insert(1, new_path)
elif smt[-1] != imp.PY_COMPILED:
if p is not packages[-1] :
if file is not None :
file.close()
raise ImportError, "No module named %s" % packages[-1]
return file, filename, smt
# in case we have been given a package to check
return file, filename, smt
class Variable :
"Class to hold all information about a variable"
def __init__(self, name, type):
self.name = name
self.type = type
self.value = None
def __str__(self) :
return self.name
__repr__ = utils.std_repr
def _filterDir(object, ignoreList) :
"Return a list of tokens (attributes) in a class, except for ignoreList"
tokens = dir(object)
for token in ignoreList :
if token in tokens :
tokens.remove(token)
return tokens
def _getClassTokens(c) :
return _filterDir(c, _DEFAULT_CLASS_TOKENS)
class Class :
"Class to hold all information about a class"
def __init__(self, name, module) :
self.name = name
self.classObject = getattr(module, name)
modname = getattr(self.classObject, '__module__', None)
if modname is None:
# hm, some ExtensionClasses don't have a __module__ attribute
# so try parsing the type output
typerepr = repr(type(self.classObject))
mo = re.match("^<type ['\"](.+)['\"]>$", typerepr)
if mo:
modname = ".".join(mo.group(1).split(".")[:-1])
self.module = sys.modules.get(modname)
if not self.module:
self.module = module
global _output
txt = _("warning: couldn't find real module for class %s (module name: %s)\n") % (self.classObject, modname)
_output.AddLines(txt)
self.ignoreAttrs = 0
self.methods = {}
self.members = { '__class__': types.ClassType,
'__doc__': types.StringType,
'__dict__': types.DictType, }
self.memberRefs = {}
self.statics = {}
self.lineNums = {}
def __str__(self) :
return self.name
__repr__ = utils.std_repr
def getFirstLine(self) :
"Return first line we can find in THIS class, not any base classes"
lineNums = []
classDir = dir(self.classObject)
for m in self.methods.values() :
if m != None and m.function.func_code.co_name in classDir:
lineNums.append(m.function.func_code.co_firstlineno)
if lineNums :
return min(lineNums)
return 0
def allBaseClasses(self, c = None) :
"Return a list of all base classes for this class and it's subclasses"
baseClasses = []
if c == None :
c = self.classObject
for base in c.__bases__ :
baseClasses = baseClasses + [ base ] + self.allBaseClasses(base)
return baseClasses
def __getMethodName(self, func_name, className = None) :
if func_name[0:2] == '__' and func_name[-2:] != '__' :
if className == None :
className = self.name
if className[0] != '_' :
className = '_' + className
func_name = className + func_name
return func_name
def addMethod(self, method, methodName = None) :
if type(method) == types.StringType :
self.methods[method] = None
else :
assert methodName is not None, "must supply methodName"
self.methods[methodName] = function.Function(method, 1)
def addMethods(self, classObject) :
for classToken in _getClassTokens(classObject) :
token = getattr(classObject, classToken, None)
if token is None:
continue
# Looks like a method. Need to code it this way to
# accommodate ExtensionClass and Python 2.2. Yecchh.
if (hasattr(token, "func_code") and
hasattr(token.func_code, "co_argcount")):
self.addMethod(token, token.__name__)
elif hasattr(token, '__get__') and \
not hasattr(token, '__set__') and \
type(token) is not types.ClassType :
self.addMethod(getattr(token, '__name__', classToken))
else :
self.members[classToken] = type(token)
self.memberRefs[classToken] = None
self.cleanupMemberRefs()
# add standard methods
for methodName in ('__class__',) :
self.addMethod(methodName, classObject.__name__)
def addMembers(self, classObject) :
if not cfg().onlyCheckInitForMembers :
for classToken in _getClassTokens(classObject) :
method = getattr(classObject, classToken, None)
if type(method) == types.MethodType :
self.addMembersFromMethod(method.im_func)
else:
try:
self.addMembersFromMethod(classObject.__init__.im_func)
except AttributeError:
pass
def addMembersFromMethod(self, method) :
if not hasattr(method, 'func_code') :
return
func_code, code, i, maxCode, extended_arg = OP.initFuncCode(method)
stack = []
while i < maxCode :
op, oparg, i, extended_arg = OP.getInfo(code, i, extended_arg)
if op >= OP.HAVE_ARGUMENT :
operand = OP.getOperand(op, func_code, oparg)
if OP.LOAD_CONST(op) or OP.LOAD_FAST(op) :
stack.append(operand)
elif OP.STORE_ATTR(op) :
if len(stack) > 0 :
if stack[-1] == cfg().methodArgName:
value = None
if len(stack) > 1 :
value = type(stack[-2])
self.members[operand] = value
self.memberRefs[operand] = None
stack = []
self.cleanupMemberRefs()
def cleanupMemberRefs(self) :
try :
del self.memberRefs[Config.CHECKER_VAR]
except KeyError :
pass
def abstractMethod(self, m):
"""Return 1 if method is abstract, None if not
An abstract method always raises an exception.
"""
if not self.methods.get(m, None):
return None
func_code, bytes, i, maxCode, extended_arg = \
OP.initFuncCode(self.methods[m].function)
# abstract if the first conditional is RAISE_VARARGS
while i < maxCode:
op, oparg, i, extended_arg = OP.getInfo(bytes, i, extended_arg)
if OP.RAISE_VARARGS(op):
return 1
if OP.conditional(op):
break
return None
def isAbstract(self):
"""Return the method names that make a class abstract.
An abstract class has at least one abstract method."""
result = []
for m in self.methods.keys():
if self.abstractMethod(m):
result.append(m)
return result
def _getLineInFile(moduleName, linenum):
line = ''
file, filename, smt = _findModule(moduleName)
try:
lines = file.readlines()
line = string.rstrip(lines[linenum - 1])
except (IOError, IndexError):
pass
file.close()
return line
def importError(moduleName):
exc_type, exc_value, tb = sys.exc_info()
# First, try to get a nice-looking name for this exception type.
exc_name = getattr(exc_type, '__name__', None)
if not exc_name:
# either it's a string exception or a user-defined exception class
# show string or fully-qualified class name
exc_name = str(exc_type)
# Print a traceback, unless this is an ImportError. ImportError is
# presumably the most common import-time exception, so this saves
# the clutter of a traceback most of the time. Also, the locus of
# the error is usually irrelevant for ImportError, so the lack of
# traceback shouldn't be a problem.
if exc_type is SyntaxError:
# SyntaxErrors are special, we want to control how we format
# the output and make it consistent for all versions of Python
e = exc_value
msg = '%s (%s, line %d)' % (e.msg, e.filename, e.lineno)
line = _getLineInFile(moduleName, e.lineno)
offset = e.offset
if type(offset) is not types.IntType:
offset = 0
exc_value = '%s\n %s\n %s^' % (msg, line, ' ' * offset)
elif exc_type is not ImportError:
global _output
txt = _(" Caught exception importing module %s:\n") % moduleName
_output.AddLines(txt)
try:
tbinfo = traceback.extract_tb(tb)
except:
tbinfo = []
txt = _(" Unable to format traceback\n")
_output.AddLines(txt)
for filename, line, func, text in tbinfo[1:]:
txt = _(" File \"%s\", line %d") % (filename, line)
_output.AddLines(txt)
if func != "?":
txt = _(", in %s()") % func
_output.AddLines(txt)
_output.AddLines("\n")
if text:
txt = _(" %s\n") % text
_output.AddLines(txt)
# And finally print the exception type and value.
# Careful formatting exc_value -- can fail for some user exceptions
txt = " %s: " % exc_name
_output.AddLines(txt)
try:
txt = str(exc_value) + '\n'
_output.AddLines(txt)
except:
txt = _('**error formatting exception value**\n')
_output.AddLines(txt)
def _getPyFile(filename):
"""Return the file and '.py' filename from a filename which could
end with .py, .pyc, or .pyo"""
if filename[-1] in 'oc' and filename[-4:-1] == '.py':
return filename[:-1]
return filename
class Module :
"Class to hold all information for a module"
def __init__(self, moduleName, check = 1, fullpath = None) :
self.moduleName = moduleName
self.variables = {}
self.functions = {}
self.classes = {}
self.modules = {}
self.moduleLineNums = {}
self.attributes = [ '__dict__' ]
self.main_code = None
self.module = None
self.check = check
self.fullpath = fullpath
_allModules[moduleName] = self
def __str__(self) :
return self.moduleName
__repr__ = utils.std_repr
def addVariable(self, var, varType) :
self.variables[var] = Variable(var, varType)
def addFunction(self, func) :
self.functions[func.__name__] = function.Function(func)
def __addAttributes(self, c, classObject) :
for base in classObject.__bases__ :
self.__addAttributes(c, base)
c.addMethods(classObject)
c.addMembers(classObject)
def addClass(self, name) :
self.classes[name] = c = Class(name, self.module)
try:
objName = str(c.classObject)
except TypeError:
# this can happen if there is a goofy __getattr__
c.ignoreAttrs = 1
else:
packages = string.split(objName, '.')
c.ignoreAttrs = packages[0] in cfg().blacklist
if not c.ignoreAttrs :
self.__addAttributes(c, c.classObject)
def addModule(self, name) :
module = _allModules.get(name, None)
if module is None :
self.modules[name] = module = Module(name, 0)
if imp.is_builtin(name) == 0 :
module.load()
else :
globalModule = globals().get(name)
if globalModule :
module.attributes.extend(dir(globalModule))
else :
self.modules[name] = module
def filename(self) :
try :
filename = self.module.__file__
except AttributeError :
filename = self.moduleName
return _getPyFile(filename)
def load(self, warnings = None):
try :
# there's no need to reload modules we already have
global _output, _statusDlg, _count
txt = _("Loading Module %s\n") % self.moduleName
_output.AddLines(txt)
_count += 1
if _count == 100:
_count = 95
_statusDlg.Update(_count, txt)
module = sys.modules.get(self.moduleName)
if module :
if not _allModules[self.moduleName].module :
return self._initModule(module)
return 1
return self._initModule(self.setupMainCode())
except (SystemExit, KeyboardInterrupt) :
exc_type, exc_value, exc_tb = sys.exc_info()
raise exc_type, exc_value
except SyntaxError, (message, (fileName, line, col, text)):
# ActiveGrid: added this for better feedback when module couldn't be loaded.
w = Warning(self.fullpath, line, _("Syntax Error: %s\n%s\n%s^error near here") % (message, text, ' '*(col-1)))
warnings.append(w)
return 0
except:
w = Warning(self.moduleName, 1, sys.exc_info()[0] + " NOT PROCESSED UNABLE TO IMPORT")
warnings.append(w)
importError(self.moduleName)
return 0
def initModule(self, module) :
if not self.module:
filename = _getPyFile(module.__file__)
if string.lower(filename[-3:]) == '.py':
try:
file = open(filename)
except IOError:
pass
else:
self._setupMainCode(file, filename, module)
return self._initModule(module)
return 1
def _initModule(self, module):
self.module = module
self.attributes = dir(self.module)
pychecker_attr = getattr(module, Config.CHECKER_VAR, None)
if pychecker_attr is not None :
utils.pushConfig()
utils.updateCheckerArgs(pychecker_attr, 'suppressions', 0, [])
for tokenName in _filterDir(self.module, _DEFAULT_MODULE_TOKENS) :
token = getattr(self.module, tokenName)
if isinstance(token, types.ModuleType) :
# get the real module name, tokenName could be an alias
self.addModule(token.__name__)
elif isinstance(token, types.FunctionType) :
self.addFunction(token)
elif isinstance(token, types.ClassType) or \
hasattr(token, '__bases__') :
self.addClass(tokenName)
else :
self.addVariable(tokenName, type(token))
if pychecker_attr is not None :
utils.popConfig()
return 1
def setupMainCode(self) :
file, filename, smt = _findModule(self.moduleName)
# FIXME: if the smt[-1] == imp.PKG_DIRECTORY : load __all__
module = imp.load_module(self.moduleName, file, filename, smt)
self._setupMainCode(file, filename, module)
return module
def _setupMainCode(self, file, filename, module):
try :
self.main_code = function.create_from_file(file, filename, module)
finally :
if file != None :
file.close()
def getAllModules() :
"Returns a list of all modules that should be checked."
modules = []
for module in _allModules.values() :
if module.check :
modules.append(module)
return modules
_BUILTIN_MODULE_ATTRS = { 'sys': [ 'ps1', 'ps2', 'tracebacklimit',
'exc_type', 'exc_value', 'exc_traceback',
'last_type', 'last_value', 'last_traceback',
],
}
def fixupBuiltinModules(needs_init=0):
for moduleName in sys.builtin_module_names :
if needs_init:
_ = Module(moduleName, 0)
module = _allModules.get(moduleName, None)
if module is not None :
try :
m = imp.init_builtin(moduleName)
except ImportError :
pass
else :
extra_attrs = _BUILTIN_MODULE_ATTRS.get(moduleName, [])
module.attributes = [ '__dict__' ] + dir(m) + extra_attrs
def _printWarnings(warnings, stream=None):
if stream is None:
stream = sys.stdout
warnings.sort()
lastWarning = None
for warning in warnings :
if lastWarning != None :
# ignore duplicate warnings
if cmp(lastWarning, warning) == 0 :
continue
# print blank line between files
if lastWarning.file != warning.file :
global _output
_output.AddLines("\n")
lastWarning = warning
_output.AddLines(warning.format() + "\n")
def processFiles(files, cfg = None, pre_process_cb = None) :
# insert this here, so we find files in the local dir before std library
if sys.path[0] != '' :
sys.path.insert(0, '')
# ensure we have a config object, it's necessary
global _cfg
if cfg is not None :
_cfg = cfg
elif _cfg is None :
_cfg = Config.Config()
warnings = []
utils.initConfig(_cfg)
for moduleName, filename in getModules(files) :
if callable(pre_process_cb) :
pre_process_cb(moduleName)
module = Module(moduleName, fullpath = filename)
module.load(warnings)
utils.popConfig()
return warnings
def getWarnings(files, cfg = None, suppressions = None):
warnings = processFiles(files, cfg)
fixupBuiltinModules()
return warnings + warn.find(getAllModules(), _cfg, suppressions)
def _print_processing(name) :
if not _cfg.quiet :
global _output, _statusDlg, _count
txt = _("Processing %s...\n") % name
_output.AddLines(txt)
_count += 1
_statusDlg.Update(_count, txt)
def checkSyntax(filename, messageView):
""" Massively hacked version of main for ActiveGrid IDE integration """
global _cfg
_cfg, files, suppressions = Config.setupFromArgs([filename])
if not files :
return 0
global _output, _statusDlg, _count
_output = messageView
# wxBug: Need to show progress dialog box, or message window never gets updated until the method returns
_statusDlg = wx.ProgressDialog(_("Check Code"), _("Checking %s") % filename, maximum = 100, style = wx.PD_AUTO_HIDE | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME)
_count = 0
# insert this here, so we find files in the local dir before std library
sys.path.insert(0, '')
importWarnings = processFiles(files, _cfg, _print_processing)
fixupBuiltinModules()
if _cfg.printParse :
for module in getAllModules() :
printer.module(module)
warnings = warn.find(getAllModules(), _cfg, suppressions)
_statusDlg.Update(100, _("Done"))
_statusDlg.Destroy()
if not _cfg.quiet :
_output.AddLines(_("\nWarnings and Errors...\n"))
if warnings or importWarnings :
_printWarnings(importWarnings + warnings)
return 1
if not _cfg.quiet :
_output.AddLines(_("No Syntax Errors"))
return 0
##
##
##def main(argv) :
## __pychecker__ = 'no-miximport'
## import pychecker
## if LOCAL_MAIN_VERSION != pychecker.MAIN_MODULE_VERSION :
## sys.stderr.write(_VERSION_MISMATCH_ERROR)
## sys.exit(100)
##
## # remove empty arguments
## argv = filter(None, argv)
##
## # if the first arg starts with an @, read options from the file
## # after the @ (this is mostly for windows)
## if len(argv) >= 2 and argv[1][0] == '@':
## # read data from the file
## command_file = argv[1][1:]
## try:
## f = open(command_file, 'r')
## command_line = f.read()
## f.close()
## except IOError, err:
## sys.stderr.write("Unable to read commands from file: %s\n %s\n" % \
## (command_file, err))
## sys.exit(101)
##
## # convert to an argv list, keeping argv[0] and the files to process
## argv = argv[:1] + string.split(command_line) + argv[2:]
##
## global _cfg
## _cfg, files, suppressions = Config.setupFromArgs(argv[1:])
## if not files :
## return 0
##
## # insert this here, so we find files in the local dir before std library
## sys.path.insert(0, '')
##
## importWarnings = processFiles(files, _cfg, _print_processing)
## fixupBuiltinModules()
## if _cfg.printParse :
## for module in getAllModules() :
## printer.module(module)
##
## warnings = warn.find(getAllModules(), _cfg, suppressions)
## if not _cfg.quiet :
## print "\nWarnings...\n"
## if warnings or importWarnings :
## _printWarnings(importWarnings + warnings)
## return 1
##
## if not _cfg.quiet :
## print "None"
## return 0
##
##
##if __name__ == '__main__' :
## try :
## sys.exit(main(sys.argv))
## except Config.UsageError :
## sys.exit(127)
##
##else :
## _orig__import__ = None
## _suppressions = None
## _warnings_cache = {}
##
## def _get_unique_warnings(warnings):
## for i in range(len(warnings)-1, -1, -1):
## w = warnings[i].format()
## if _warnings_cache.has_key(w):
## del warnings[i]
## else:
## _warnings_cache[w] = 1
## return warnings
##
## def __import__(name, globals=None, locals=None, fromlist=None):
## if globals is None:
## globals = {}
## if locals is None:
## locals = {}
## if fromlist is None:
## fromlist = []
##
## check = not sys.modules.has_key(name) and name[:10] != 'pychecker.'
## pymodule = _orig__import__(name, globals, locals, fromlist)
## if check :
## try :
## module = Module(pymodule.__name__)
## if module.initModule(pymodule):
## warnings = warn.find([module], _cfg, _suppressions)
## _printWarnings(_get_unique_warnings(warnings))
## else :
## print 'Unable to load module', pymodule.__name__
## except Exception:
## name = getattr(pymodule, '__name__', str(pymodule))
## importError(name)
##
## return pymodule
##
## def _init() :
## global _cfg, _suppressions, _orig__import__
##
## args = string.split(os.environ.get('PYCHECKER', ''))
## _cfg, files, _suppressions = Config.setupFromArgs(args)
## utils.initConfig(_cfg)
## fixupBuiltinModules(1)
##
## # keep the orig __import__ around so we can call it
## import __builtin__
## _orig__import__ = __builtin__.__import__
## __builtin__.__import__ = __import__
##
## if not os.environ.get('PYCHECKER_DISABLED') :
## _init()
##

View File

@@ -0,0 +1,7 @@
Ctrl-Space in any editor does code completion.
Right-clicking on something in the 'Thing' column of the debugger's frame tab may allow you to introspect it for more information.
Right-Mouse-Click in Outline window allows you to change display sorting.
In an editor, you can add line markers via Ctrl-M and jump to the next marker with F4 or previous marker with Shift-F4.
In an editor. you can use the numpad + and - keys to toggle folding.
In 'Find in Directory', if you specify a file, it will display all matches in the Message Window.
Breakpoints for the debugger can be set while the process is running

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
import logging
import cStringIO
import traceback
import sys
import string
import os
def classForName(className):
pathList = className.split('.')
moduleName = string.join(pathList[:-1], '.')
code = __import__(moduleName)
for name in pathList[1:]:
code = code.__dict__[name]
return code
def hasattrignorecase(object, name):
for attr in dir(object):
if attr.lower() == name.lower():
return True
for attr in dir(object):
if attr.lower() == '_' + name.lower():
return True
return False
def setattrignorecase(object, name, value):
for attr in object.__dict__:
if attr.lower() == name.lower():
object.__dict__[attr] = value
return
## for attr in dir(object):
## if attr.lower() == '_' + name.lower():
## object.__dict__[attr] = value
## return
object.__dict__[name] = value
def getattrignorecase(object, name):
for attr in object.__dict__:
if attr.lower() == name.lower():
return object.__dict__[attr]
## for attr in dir(object):
## if attr.lower() == '_' + name.lower():
## return object.__dict__[attr]
return object.__dict__[name]
def defaultLoad(fileObject):
xml = fileObject.read()
loadedObject = xmlmarshaller.unmarshal(xml)
if hasattr(fileObject, 'name'):
loadedObject.fileName = os.path.abspath(fileObject.name)
loadedObject.initialize()
return loadedObject
def defaultSave(fileObject, objectToSave):
xml = xmlmarshaller.marshal(objectToSave, prettyPrint=True)
fileObject.write(xml)
def clone(objectToClone):
xml = xmlmarshaller.marshal(objectToClone, prettyPrint=True)
clonedObject = xmlmarshaller.unmarshal(xml)
if hasattr(objectToClone, 'fileName'):
clonedObject.fileName = objectToClone.fileName
clonedObject.initialize()
return clonedObject
def exceptionToString(e):
sio = cStringIO.StringIO()
traceback.print_exception(e.__class__, e, sys.exc_traceback, file=sio)
return sio.getvalue()

View File

@@ -0,0 +1,84 @@
#----------------------------------------------------------------------------
# Name: aglogging.py
# Purpose: Utilities to help with logging
#
# Author: Jeff Norton
#
# Created: 01/04/05
# CVS-ID: $Id$
# Copyright: (c) 2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import sys
import os
import re
import traceback
global agTestMode
agTestMode = False
def setTestMode(mode):
global agTestMode
if (mode):
agTestMode = True
else:
agTestMode = False
def getTestMode():
global agTestMode
return agTestMode
def testMode(normalObj, testObj=None):
if getTestMode():
return testObj
return normalObj
def toDiffableString(value):
s = repr(value)
ds = ""
i = s.find(" at 0x")
start = 0
while (i >= 0):
j = s.find(">", i)
if (j < i):
break
ds += s[start:i]
start = j
i = s.find(" at 0x", start)
return ds + s[start:]
def removeFileRefs(str):
str = re.sub(r'(?<=File ")[^"]*(\\[^\\]*")(, line )[0-9]*', _fileNameReplacement, str)
return str
def _fileNameReplacement(match):
return "...%s" % match.group(1)
def getTraceback():
extype, val, tb = sys.exc_info()
tbs = "\n"
for s in traceback.format_tb(tb):
tbs += s
return tbs
def reportException(out=None, stacktrace=False, diffable=False):
extype, val, t = sys.exc_info()
if (diffable):
exstr = removeFileRefs(str(val))
else:
exstr = str(val)
if (out == None):
print "Got Exception = %s: %s" % (extype, exstr)
else:
print >> out, "Got Exception = %s: %s" % (extype, exstr)
if (stacktrace):
fmt = traceback.format_exception(extype, val, t)
for s in fmt:
if (diffable):
s = removeFileRefs(s)
if (out == None):
print s
else:
print >> out, s

View File

@@ -0,0 +1,87 @@
#----------------------------------------------------------------------------
# Name: cachedloader.py
# Purpose:
#
# Author: Joel Hare
#
# Created: 8/31/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import copy
import os.path
import string
import cStringIO
import time
# TODO: Instantiate the database and create a pool
class CachedLoader(object):
def __init__(self):
self.cache = {}
self.baseLoadDir = None
def fullPath(self, fileName):
if os.path.isabs(fileName):
absPath = fileName
elif self.baseLoadDir:
absPath = os.path.join(self.baseLoadDir, fileName)
else:
absPath = os.path.abspath(fileName)
return absPath
def setPrototype(self, fileName, loadedFile):
absPath = self.fullPath(fileName)
mtime = time.time() + 31536000.0 # Make sure prototypes aren't replaced by files on disk
self.cache[absPath] = (mtime, loadedFile)
def update(self, loader):
self.cache.update(loader.cache)
def clear(self):
self.cache.clear()
def delete(self, fileName):
absPath = self.fullPath(fileName)
del self.cache[absPath]
def needsLoad(self, fileName):
absPath = self.fullPath(fileName)
try:
cached = self.cache[absPath]
cachedTime = cached[0]
if cachedTime >= os.path.getmtime(absPath):
return False
except KeyError:
pass
return True
def load(self, fileName, loader):
absPath = self.fullPath(fileName)
loadedFile = None
try:
cached = self.cache[absPath]
except KeyError:
cached = None
if cached:
cachedTime = cached[0]
# ToDO We might need smarter logic for checking if a file needs to be reloaded
# ToDo We need a way to disable checking if this is a production server
if cachedTime >= os.path.getmtime(absPath):
loadedFile = cached[1]
if not loadedFile:
targetFile = file(absPath)
try:
mtime = os.path.getmtime(absPath)
loadedFile = loader(targetFile)
self.cache[absPath] = (mtime, loadedFile)
finally:
targetFile.close()
return loadedFile

View File

@@ -0,0 +1,145 @@
#----------------------------------------------------------------------------
# Name: dependencymgr.py
# Purpose: Dependency Manager
#
# Author: Jeff Norton
#
# Created: 01/28/05
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
#----------------------------------------------------------------------------
DM_NO_ID = 0
DM_ID_ATTR = "_DependencyMgr__ID"
##class ManageableObject(object):
##
## def __init__(self):
## self.__id = DM_NO_ID
##
## def __repr__(self):
## return "<ManageableObject id = %s>" % self.__id
##
## def __getID(self):
## return self.__id
##
## def __setID(self, value):
## if (self.__id != DM_NO_ID):
## raise DependencyMgrException("Cannot set the dependency ID on object %s to \"%s\" because it already has one (\"%s\")." % (repr(self), value, self.__id))
## self.__id = value
##
## _DependencyMgr__ID = property(__getID, __setID)
class DependencyMgr(object):
def __init__(self):
self.clear()
def clear(self):
self.__dependencies = {}
self.__lastID = DM_NO_ID
def addDependency(self, parent, child):
pid = self._initObjectID(parent)
try:
parentCollection = self.__dependencies[pid]
except KeyError:
parentCollection = self._newDependencyCollection()
self.__dependencies[pid] = parentCollection
if (child not in parentCollection):
parentCollection.append(child)
def removeDependency(self, parent, child):
pid = self._getObjectID(parent)
if (pid != DM_NO_ID):
try:
parentCollection = self.__dependencies[pid]
parentCollection.remove(child)
if (len(parentCollection) == 0):
del self.__dependencies[pid]
except KeyError, ValueError:
pass
def clearDependencies(self, parent):
"Returns a list of objects or an empty list if no dependencies exist as for getDependencies, and then removes the dependency list."
pid = self._getObjectID(parent)
try:
deps = self.__dependencies[pid]
del self.__dependencies[pid]
return deps
except KeyError:
return []
def hasDependency(self, parent):
"Returns a boolean"
return (self._getObjectID(parent) in self.__dependencies)
def getDependencies(self, parent):
"Returns a list of objects or an empty list if no dependencies exist."
try:
return self.__dependencies[self._getObjectID(parent)]
except KeyError:
return []
def dumpState(self, out):
"Writes the state of the dependency manager (as reported by getState) to out"
for line in self.getState():
print >> out, line
def getState(self):
"Returns the state of the dependency manager including all managed objects as a list of strings"
out = []
out.append("DependencyMgr %s has %i parent objects, last id assigned is %i" % (repr(self), len(self.__dependencies), self.__lastID))
for key, val in self.__dependencies.iteritems():
out.append("Object %s has dependents: %s " % (repr(key), ", ".join([repr(d) for d in val])))
return out
def _initObjectID(self, obj):
try:
id = getattr(obj, DM_ID_ATTR)
except AttributeError:
id = DM_NO_ID
if (id == DM_NO_ID):
id = self._newID()
setattr(obj, DM_ID_ATTR, id)
return id
def _getObjectID(self, obj):
try:
id = getattr(obj, DM_ID_ATTR)
except AttributeError:
id = DM_NO_ID
return id
def _newID(self):
self.__lastID += 1
return self.__lastID
def _newDependencyCollection(self):
return []
globalDM = DependencyMgr()
def addDependency(parent, child):
getGlobalDM().addDependency(parent, child)
def removeDependency(parent, child):
getGlobalDM().removeDependency(parent, child)
def clearDependencies(parent):
return getGlobalDM().clearDependencies(parent)
def hasDependency(parent):
return getGlobalDM().hasDependency(parent)
def getDependencies(parent):
return getGlobalDM().getDependencies(parent)
def getState():
return getGlobalDM().getState()
def dumpState(out):
getGlobalDM().dumpState(out)
def getGlobalDM():
return globalDM

View File

@@ -0,0 +1,39 @@
#----------------------------------------------------------------------------
# Name: fileutils.py
# Purpose: Active grid miscellaneous utilities
#
# Author: Jeff Norton
#
# Created: 12/10/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import os
def createFile(filename, mode='w'):
f = None
try:
f = file(filename, mode)
except:
os.makedirs(filename[:filename.rindex(os.sep)])
f = file(filename, mode)
return f
def compareFiles(file1, file2):
file1.seek(0)
file2.seek(0)
while True:
line1 = file1.readline()
line2 = file2.readline()
if (len(line1) == 0):
if (len(line2) == 0):
return 0
else:
return -1
elif (len(line2) == 0):
return -1
elif (line1 != line2):
return -1

View File

@@ -0,0 +1,36 @@
#----------------------------------------------------------------------------
# Name: gettersetter.py
# Purpose:
#
# Author: Peter Yared
#
# Created: 7/28/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
def gettersetter(list):
for attr in list:
lowercase = attr[0].lower() + attr[1:]
uppercase = attr[0].upper() + attr[1:]
print " def get%s(self):" % uppercase
print " return self._%s" % lowercase
print
print " def set%s(self, %s):" % (uppercase, lowercase)
print " self._%s = %s" % (lowercase, lowercase)
print
def listgettersetter(list):
for attr in list:
lowercase = attr[0].lower() + attr[1:]
uppercase = attr[0].upper() + attr[1:]
print " def get%s(self):" % uppercase
print " return self._%s" % lowercase
print
print " def add%s(self, %s):" % (uppercase[:-1], lowercase[:-1])
print " self._%s.append(%s)" % (lowercase, lowercase[:-1])
print
print " def remove%s(self, %s):" % (uppercase[:-1], lowercase[:-1])
print " self._%s.remove(%s)" % (lowercase, lowercase[:-1])
print

View File

@@ -0,0 +1,649 @@
#----------------------------------------------------------------------------
# Name: xmlmarshaller.py
# Purpose:
#
# Author: John Spurling
#
# Created: 7/28/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
from activegrid import util
import inspect
from types import *
import xml.sax
import xml.sax.handler
import __builtin__
from xml.sax import saxutils
### ToDO remove maxOccurs "unbounded" resolves to -1 hacks after bug 177 is fixed
"""
More documentation later, but here are some special Python attributes
that McLane recognizes:
name: __xmlname__
type: string
description: the name of the xml element for the marshalled object
name: __xmlattributes__
type: tuple or list
description: the name(s) of the Python string attribute(s) to be
marshalled as xml attributes instead of nested xml elements. currently
these can only be strings since there's not a way to get the type
information back when unmarshalling.
name: __xmlexclude__
type: tuple or list
description: the name(s) of the python attribute(s) to skip when
marshalling.
name: __xmlrename__
type: dict
description: describes an alternate Python <-> XML name mapping.
Normally the name mapping is the identity function. __xmlrename__
overrides that. The keys are the Python names, the values are their
associated XML names.
name: __xmlflattensequence__
type: dict, tuple, or list
description: the name(s) of the Python sequence attribute(s) whose
items are to be marshalled as a series of xml elements (with an
optional keyword argument that specifies the element name to use) as
opposed to containing them in a separate sequence element, e.g.:
myseq = (1, 2)
<!-- normal way of marshalling -->
<myseq>
<item objtype='int'>1</item>
<item objtype='int'>2</item>
</myseq>
<!-- with __xmlflattensequence__ set to {'myseq': 'squish'} -->
<squish objtype='int'>1</squish>
<squish objtype='int'>2</squish>
name: __xmlnamespaces__
type: dict
description: a dict of the namespaces that the object uses. Each item
in the dict should consist of a prefix,url combination where the key is
the prefix and url is the value, e.g.:
__xmlnamespaces__ = { "xsd":"http://www.w3c.org/foo.xsd" }
name: __xmldefaultnamespace__
type: String
description: the prefix of a namespace defined in __xmlnamespaces__ that
should be used as the default namespace for the object.
name: __xmlattrnamespaces__
type: dict
description: a dict assigning the Python object's attributes to the namespaces
defined in __xmlnamespaces__. Each item in the dict should consist of a
prefix,attributeList combination where the key is the prefix and the value is
a list of the Python attribute names. e.g.:
__xmlattrnamespaces__ = { "ag":["firstName", "lastName", "addressLine1", "city"] }
"""
################################################################################
#
# module exceptions
#
################################################################################
class Error(Exception):
"""Base class for errors in this module."""
pass
class UnhandledTypeException(Error):
"""Exception raised when attempting to marshal an unsupported
type.
"""
def __init__(self, typename):
self.typename = typename
def __str__(self):
return "%s is not supported for marshalling." % str(self.typename)
class XMLAttributeIsNotStringType(Error):
"""Exception raised when an object's attribute is specified to be
marshalled as an XML attribute of the enclosing object instead of
a nested element.
"""
def __init__(self, attrname, typename):
self.attrname = attrname
self.typename = typename
def __str__(self):
return """%s was set to be marshalled as an XML attribute
instead of a nested element, but the object's type is %s, not
string.""" % (self.attrname, self.typename)
################################################################################
#
# constants and such
#
################################################################################
XMLNS = 'xmlns'
XMLNS_PREFIX = XMLNS + ':'
XMLNS_PREFIX_LENGTH = len(XMLNS_PREFIX)
BASETYPE_ELEMENT_NAME = 'item'
MEMBERS_TO_SKIP = ('__module__', '__doc__', '__xmlname__', '__xmlattributes__',
'__xmlexclude__', '__xmlflattensequence__', '__xmlnamespaces__',
'__xmldefaultnamespace__', '__xmlattrnamespaces__')
WELL_KNOWN_OBJECTS = { "xs:element" : "activegrid.model.schema.XsdElement",
"xs:complexType" : "activegrid.model.schema.XsdComplexType",
"xs:complexType" : "activegrid.model.schema.XsdComplexType",
"xs:element" : "activegrid.model.schema.XsdElement",
"xs:key" : "activegrid.model.schema.XsdKey",
"xs:field" : "activegrid.model.schema.XsdKeyField",
"xs:keyref" : "activegrid.model.schema.XsdKeyRef",
"xs:selector" : "activegrid.model.schema.XsdKeySelector",
"xs:schema" : "activegrid.model.schema.Schema",
"ag:schemaOptions":"activegrid.model.schema.SchemaOptions",
"ag:debug" : "activegrid.model.processmodel.DebugOperation",
}
################################################################################
#
# classes and functions
#
################################################################################
def _objectfactory(objname, objargs=None, xsname=None):
try:
'''dynamically create an object based on the objname and return
it. look it up in the BASETYPE_ELEMENT_MAP first.
'''
## print "_objectfactory creating an object of type %s and value %s, xsname=%s" % (objname, objargs, xsname)
# split the objname into the typename and module path,
# importing the module if need be.
if not isinstance(objargs, list):
objargs = [objargs]
if (xsname):
try:
objname = WELL_KNOWN_OBJECTS[xsname]
except KeyError:
pass
objtype = objname.split('.')[-1]
pathlist = objname.split('.')
modulename = '.'.join(pathlist[0:-1])
## print "[objectfactory] objtype is %s" % objtype
## print "[objectfactory] objargs is %s" % `objargs`
## since the bool constructor will turn a string of non-zero
## length into True, we call it with no argument (yielding a
## False) if the string contains 'false'
if objtype == 'bool' and objargs[0].lower() == 'false':
objargs = None
## if objtype == 'str':
## print type(objargs)
## print "string we're unescaping: '%s'" % objargs[0]
## objargs = saxutils.unescape(objargs[0])
if objtype in ('float', 'int', 'str', 'long'):
objargs = [x.strip() for x in objargs]
if objtype == 'str':
objargs = [saxutils.unescape(x) for x in objargs]
if __builtin__.__dict__.has_key(objname):
module = __builtin__
else:
if modulename:
module = __import__(modulename)
for name in pathlist[1:-1]:
module = module.__dict__[name]
if objargs:
return module.__dict__[objtype](*objargs)
else:
if objtype == 'None':
return None
return module.__dict__[objtype]()
except KeyError:
raise KeyError("Could not find class %s" % objname)
class Element:
def __init__(self, name, attrs=None):
self.name = name
self.attrs = attrs
self.content = ''
self.children = []
def getobjtype(self):
if self.attrs.has_key('objtype'):
return self.attrs.getValue('objtype')
else:
return 'str'
class XMLObjectFactory(xml.sax.ContentHandler):
def __init__(self):
self.rootelement = None
self.elementstack = []
xml.sax.handler.ContentHandler.__init__(self)
## ContentHandler methods
def startElement(self, name, attrs):
if name.find(':') > -1: # Strip namespace prefixes for now until actually looking them up in xsd
name = name[name.index(':') + 1:]
## for attrname in attrs.getNames():
## print "%s: %s" % (attrname, attrs.getValue(attrname))
element = Element(name, attrs.copy())
self.elementstack.append(element)
## print self.elementstack
def characters(self, content):
## print "got content: %s" % content
if content:
self.elementstack[-1].content += content
def endElement(self, name):
## print "[endElement] name of element we're at the end of: %s" % name
xsname = name
if name.find(':') > -1: # Strip namespace prefixes for now until actually looking them up in xsd
name = name[name.index(':') + 1:]
element = self.elementstack.pop()
objtype = element.getobjtype()
constructorarglist = []
if element.content:
strippedElementContent = element.content.strip()
if strippedElementContent:
constructorarglist.append(element.content)
obj = _objectfactory(objtype, constructorarglist, xsname)
complexType = None
if hasattr(obj, '__xsdcomplextype__'):
complexType = getattr(obj, '__xsdcomplextype__')
if len(self.elementstack) > 0:
self.elementstack[-1].children.append((name, obj))
else:
self.rootelement = obj
if element.attrs and not isinstance(obj, list):
for attrname, attr in element.attrs.items():
if attrname == XMLNS or attrname.startswith(XMLNS_PREFIX):
if attrname.startswith(XMLNS_PREFIX):
ns = attrname[XMLNS_PREFIX_LENGTH:]
else:
ns = ""
if not hasattr(obj, '__xmlnamespaces__'):
obj.__xmlnamespaces__ = {ns:attr}
elif ns not in obj.__xmlnamespaces__:
if (hasattr(obj.__class__, '__xmlnamespaces__')
and obj.__xmlnamespaces__ is obj.__class__.__xmlnamespaces__):
obj.__xmlnamespaces__ = dict(obj.__xmlnamespaces__)
obj.__xmlnamespaces__[ns] = attr
elif not attrname == 'objtype':
if attrname.find(':') > -1: # Strip namespace prefixes for now until actually looking them up in xsd
attrname = attrname[attrname.index(':') + 1:]
if complexType:
xsdElement = complexType.findElement(attrname)
if xsdElement:
type = xsdElement.type
if type:
type = xsdToPythonType(type)
### ToDO remove maxOccurs hack after bug 177 is fixed
if attrname == "maxOccurs" and attr == "unbounded":
attr = "-1"
attr = _objectfactory(type, attr)
util.setattrignorecase(obj, _toAttrName(obj, attrname), attr)
## obj.__dict__[_toAttrName(obj, attrname)] = attr
# stuff any child attributes meant to be in a sequence via the __xmlflattensequence__
flattenDict = {}
if hasattr(obj, '__xmlflattensequence__'):
for sequencename, xmlnametuple in obj.__xmlflattensequence__.items():
for xmlname in xmlnametuple:
flattenDict[xmlname] = sequencename
# reattach an object's attributes to it
for childname, child in element.children:
if flattenDict.has_key(childname):
sequencename = _toAttrName(obj, flattenDict[childname])
try:
sequencevalue = obj.__dict__[sequencename]
except AttributeError:
sequencevalue = None
if sequencevalue == None:
sequencevalue = []
obj.__dict__[sequencename] = sequencevalue
sequencevalue.append(child)
elif isinstance(obj, list):
obj.append(child)
else:
## print "childname = %s, obj = %s, child = %s" % (childname, repr(obj), repr(child))
util.setattrignorecase(obj, _toAttrName(obj, childname), child)
## obj.__dict__[_toAttrName(obj, childname)] = child
if complexType:
for element in complexType.elements:
if element.default:
elementName = _toAttrName(obj, element.name)
if ((elementName not in obj.__dict__) or (obj.__dict__[elementName] == None)):
pythonType = xsdToPythonType(element.type)
defaultValue = _objectfactory(pythonType, element.default)
obj.__dict__[elementName] = defaultValue
def getRootObject(self):
return self.rootelement
def _toAttrName(obj, name):
if (hasattr(obj, "__xmlrename__")):
for key, val in obj.__xmlrename__.iteritems():
if (name == val):
name = key
break
## if (name.startswith("__") and not name.endswith("__")):
## name = "_%s%s" % (obj.__class__.__name__, name)
return name
__typeMappingXsdToPython = {
"string": "str",
"char": "str",
"varchar": "str",
"date": "str", # ToDO Need to work out how to create python date types
"boolean": "bool",
"decimal": "float", # ToDO Does python have a better fixed point type?
"int": "int",
"long": "long",
"float": "float",
"bool": "bool",
"str": "str",
"unicode": "unicode",
}
def xsdToPythonType(xsdType):
try:
return __typeMappingXsdToPython[xsdType]
except KeyError:
raise Exception("Unknown xsd type %s" % xsdType)
def _getXmlValue(pythonValue):
if (isinstance(pythonValue, bool)):
return str(pythonValue).lower()
else:
return str(pythonValue)
def unmarshal(xmlstr):
objectfactory = XMLObjectFactory()
xml.sax.parseString(xmlstr, objectfactory)
return objectfactory.getRootObject()
def marshal(obj, elementName=None, nameSpacePrefix='', nameSpaces=None, prettyPrint=False, indent=0):
if prettyPrint or indent:
prefix = ' '*indent
newline = '\n'
increment = 4
else:
prefix = ''
newline = ''
increment = 0
## Determine the XML element name. If it isn't specified in the
## parameter list, look for it in the __xmlname__ Python
## attribute, else use the default generic BASETYPE_ELEMENT_NAME.
if not nameSpaces: nameSpaces = {} # Need to do this since if the {} is a default parameter it gets shared by all calls into the function
nameSpaceAttrs = ''
if hasattr(obj, '__xmlnamespaces__'):
for nameSpaceKey, nameSpaceUrl in getattr(obj, '__xmlnamespaces__').items():
if nameSpaceUrl in nameSpaces:
nameSpaceKey = nameSpaces[nameSpaceUrl]
else:
## # TODO: Wait to do this until there is shared state for use when going through the object graph
## origNameSpaceKey = nameSpaceKey # Make sure there is no key collision, ie: same key referencing two different URL's
## i = 1
## while nameSpaceKey in nameSpaces.values():
## nameSpaceKey = origNameSpaceKey + str(i)
## i += 1
nameSpaces[nameSpaceUrl] = nameSpaceKey
if nameSpaceKey == '':
nameSpaceAttrs += ' xmlns="%s" ' % (nameSpaceUrl)
else:
nameSpaceAttrs += ' xmlns:%s="%s" ' % (nameSpaceKey, nameSpaceUrl)
nameSpaceAttrs = nameSpaceAttrs.rstrip()
if hasattr(obj, '__xmldefaultnamespace__'):
nameSpacePrefix = getattr(obj, '__xmldefaultnamespace__') + ':'
if not elementName:
if hasattr(obj, '__xmlname__'):
elementName = nameSpacePrefix + obj.__xmlname__
else:
elementName = nameSpacePrefix + BASETYPE_ELEMENT_NAME
else:
elementName = nameSpacePrefix + elementName
members_to_skip = []
## Add more members_to_skip based on ones the user has selected
## via the __xmlexclude__ attribute.
if hasattr(obj, '__xmlexclude__'):
members_to_skip += list(obj.__xmlexclude__)
# Marshal the attributes that are selected to be XML attributes.
objattrs = ''
className = obj.__class__.__name__
classNamePrefix = "_" + className
if hasattr(obj, '__xmlattributes__'):
xmlattributes = obj.__xmlattributes__
members_to_skip += xmlattributes
for attr in xmlattributes:
internalAttrName = attr
if (attr.startswith("__") and not attr.endswith("__")):
internalAttrName = classNamePrefix + attr
# Fail silently if a python attribute is specified to be
# an XML attribute but is missing.
try:
value = obj.__dict__[internalAttrName]
except KeyError:
continue
## # But, check and see if it is a property first:
## if (hasPropertyValue(obj, attr)):
## value = getattr(obj, attr)
## else:
## continue
xsdElement = None
if hasattr(obj, '__xsdcomplextype__'):
complexType = getattr(obj, '__xsdcomplextype__')
xsdElement = complexType.findElement(attr)
if xsdElement:
default = xsdElement.default
if default == value or default == _getXmlValue(value):
continue
elif value == None:
continue
# ToDO remove maxOccurs hack after bug 177 is fixed
if attr == "maxOccurs" and value == -1:
value = "unbounded"
if isinstance(value, bool):
if value == True:
value = "true"
else:
value = "false"
attrNameSpacePrefix = ''
if hasattr(obj, '__xmlattrnamespaces__'):
for nameSpaceKey, nameSpaceAttributes in getattr(obj, '__xmlattrnamespaces__').items():
if nameSpaceKey == nameSpacePrefix[:-1]: # Don't need to specify attribute namespace if it is the same as it selement
continue
if attr in nameSpaceAttributes:
attrNameSpacePrefix = nameSpaceKey + ':'
break
## if attr.startswith('_'):
## attr = attr[1:]
if (hasattr(obj, "__xmlrename__") and attr in obj.__xmlrename__):
attr = obj.__xmlrename__[attr]
objattrs += ' %s%s="%s"' % (attrNameSpacePrefix, attr, value)
objtype = type(obj)
if isinstance(obj, NoneType):
return ''
# return '%s<%s objtype="None"/>%s' % (prefix, elementName, newline)
elif isinstance(obj, bool):
return '%s<%s objtype="bool">%s</%s>%s' % (prefix, elementName, obj, elementName, newline)
elif isinstance(obj, int):
return '''%s<%s objtype="int">%s</%s>%s''' % (prefix, elementName, str(obj), elementName, newline)
elif isinstance(obj, long):
return '%s<%s objtype="long">%s</%s>%s' % (prefix, elementName, str(obj), elementName, newline)
elif isinstance(obj, float):
return '%s<%s objtype="float">%s</%s>%s' % (prefix, elementName, str(obj), elementName, newline)
elif isinstance(obj, basestring):
return '''%s<%s>%s</%s>%s''' % (prefix, elementName, saxutils.escape(obj), elementName, newline)
## elif isinstance(obj, unicode):
## return '''%s<%s>%s</%s>%s''' % (prefix, elementName, obj, elementName, newline)
elif isinstance(obj, list):
if len(obj) < 1:
return ''
xmlString = '%s<%s objtype="list">%s' % (prefix, elementName, newline)
for item in obj:
xmlString += marshal(item, nameSpaces=nameSpaces, indent=indent+increment)
xmlString += '%s</%s>%s' % (prefix, elementName, newline)
return xmlString
elif isinstance(obj, tuple):
if len(obj) < 1:
return ''
xmlString = '%s<%s objtype="list" mutable="false">%s' % (prefix, elementName, newline)
for item in obj:
xmlString += marshal(item, nameSpaces=nameSpaces, indent=indent+increment)
xmlString += '%s</%s>%s' % (prefix, elementName, newline)
return xmlString
elif isinstance(obj, dict):
xmlString = '%s<%s objtype="dict">%s' % (prefix, elementName, newline)
subprefix = prefix + ' '*increment
subindent = indent + 2*increment
for key, val in obj.iteritems():
xmlString += "%s<key>%s%s%s</key>%s%s<value>%s%s%s</value>%s" \
% (subprefix, newline, marshal(key, indent=subindent), subprefix, newline, subprefix, newline, marshal(val, nameSpaces=nameSpaces, indent=subindent), subprefix, newline)
xmlString += '%s</%s>%s' % (prefix, elementName, newline)
return xmlString
else:
moduleName = obj.__class__.__module__
if (moduleName == "activegrid.model.schema"):
xmlString = '%s<%s%s%s' % (prefix, elementName, nameSpaceAttrs, objattrs)
else:
xmlString = '%s<%s%s%s objtype="%s.%s"' % (prefix, elementName, nameSpaceAttrs, objattrs, moduleName, className)
# get the member, value pairs for the object, filtering out
# the types we don't support.
xmlMemberString = ''
if hasattr(obj, '__xmlbody__'):
xmlMemberString = getattr(obj, obj.__xmlbody__)
else:
entryList = obj.__dict__.items()
## # Add in properties
## for key in obj.__class__.__dict__.iterkeys():
## if (key not in members_to_skip and key not in obj.__dict__
## and hasPropertyValue(obj, key)):
## value = getattr(obj, key)
## entryList.append((key, value))
entryList.sort()
for name, value in entryList:
## # special name handling for private "__*" attributes:
## # remove the _<class-name> added by Python
## if name.startswith(classNamePrefix): name = name[len(classNamePrefix):]
if name in members_to_skip: continue
if name.startswith('__') and name.endswith('__'): continue
## idx = name.find('__')
## if idx > 0:
## newName = name[idx+2:]
## if newName:
## name = newName
subElementNameSpacePrefix = nameSpacePrefix
if hasattr(obj, '__xmlattrnamespaces__'):
for nameSpaceKey, nameSpaceValues in getattr(obj, '__xmlattrnamespaces__').items():
if name in nameSpaceValues:
subElementNameSpacePrefix = nameSpaceKey + ':'
break
# handle sequences listed in __xmlflattensequence__
# specially: instead of listing the contained items inside
# of a separate list, as god intended, list them inside
# the object containing the sequence.
if hasattr(obj, '__xmlflattensequence__') and name in obj.__xmlflattensequence__ and value:
try:
xmlnametuple = obj.__xmlflattensequence__[name]
xmlname = None
if len(xmlnametuple) == 1:
xmlname = xmlnametuple[0]
except:
xmlname = name
## xmlname = name.lower()
for seqitem in value:
xmlMemberString += marshal(seqitem, xmlname, subElementNameSpacePrefix, nameSpaces=nameSpaces, indent=indent+increment)
else:
if (hasattr(obj, "__xmlrename__") and name in obj.__xmlrename__):
xmlname = obj.__xmlrename__[name]
else:
xmlname = name
## xmlname = name.lower()
## # skip
## if xmlname.startswith('_') and not xmlname.startswith('__'):
## xmlname = xmlname[1:]
## if (indent > 30):
## print "getting pretty deep, xmlname = ", xmlname
xmlMemberString += marshal(value, xmlname, subElementNameSpacePrefix, nameSpaces=nameSpaces, indent=indent+increment)
# if we have nested elements, add them here, otherwise close the element tag immediately.
if xmlMemberString:
xmlString += '>'
if hasattr(obj, '__xmlbody__'):
xmlString += xmlMemberString
xmlString += '</%s>%s' % (elementName, newline)
else:
xmlString += newline
xmlString += xmlMemberString
xmlString += '%s</%s>%s' % (prefix, elementName, newline)
else:
xmlString = xmlString + '/>%s' % newline
return xmlString
# We don't use this anymore but in case we want to get properties this is how
# you do it
def hasPropertyValue(obj, attr):
hasProp = False
try:
prop = obj.__class__.__dict__[attr]
if (isinstance(prop, property)):
hasProp = hasattr(obj, attr)
if (hasProp):
# It's a property and it has a value but sometimes we don't want it.
# If there is a _hasattr method execute it and the
# result will tell us whether to include this value
try:
hasProp = obj._hasattr(attr)
except:
pass
except KeyError:
pass
return hasProp
if __name__ == '__main__':
from xmlmarshallertests import Person, marshalledint, marshalledlist
l = [1, 2, 3]
d = {'1': 1, '2': 2}
outerlist = [l]
xmlstr = marshal(d, "d", prettyPrint=True)
print xmlstr
person = Person()
person.firstName = "Albert"
person.lastName = "Camus"
person.addressLine1 = "23 Absurd St."
person.city = "Ennui"
person.state = "MO"
person.zip = "54321"
person._phoneNumber = "808-303-2323"
person.favoriteWords = ['angst', 'ennui', 'existence']
person.weight = 150
xmlstring = marshal(person, 'person', prettyPrint=True)
print xmlstring
obj = unmarshal(marshalledlist)
print "obj has type %s and value %s" % (type(obj), str(obj))
for item in obj:
print "item: %s" % str(item)

View File

@@ -0,0 +1,183 @@
#----------------------------------------------------------------------------
# Name: xmlmarshallertests.py
# Purpose:
#
# Author: John Spurling
#
# Created: 8/16/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import unittest
import xmlmarshaller
from xmlprettyprinter import xmlprettyprint
marshalledPersonObject = """
<person objtype="Person">
<firstName>Albert</firstName>
<lastName>Camus</lastName>
<address>23 Absurd St.</address>
<city>Ennui</city>
<state>MO</state>
<zip>54321</zip>
<_phoneNumber>808-303-2323</_phoneNumber>
<favoriteWords objtype="list">
<item>angst</item>
<item>ennui</item>
<item>existence</item>
</favoriteWords>
<weight objtype="float">150</weight>
</person>
"""
marshalledint = '''
<item objtype="int">23</item>
'''
marshalledlist = '''
<mylist objtype="list">
<item>foo</item>
<item>bar</item>
</mylist>
'''
## a dummy class taken from the old XmlMarshaller module.
## class Person:
## def __init__(self):
## # These are not necessary but are nice if you want to tailor
## # the Python object <-> XML binding
## # The xml element name to use for this object, otherwise it
## # will use a fully qualified Python name like __main__.Person
## # which can be ugly.
## self.__xmlname__ = "person"
## self.firstName = None
## self.lastName = None
## self.addressLine1 = None
## self.addressLine2 = None
## self.city = None
## self.state = None
## self.zip = None
## self._phoneNumber = None
## self.favoriteWords = None
## self.weight = None
class Person:
__xmlflattensequence__ = {'asequence': ('the_earth_is_flat',)}
class XmlMarshallerTestFunctions(unittest.TestCase):
def setUp(self):
'''common setup code goes here.'''
pass
def testInt(self):
xml = xmlmarshaller.marshal(1)
print "\n#########################################"
print "# testString test case #"
print "#########################################"
print "marshalled int object:\n"
print xmlprettyprint(xml)
def testDict(self):
xml = xmlmarshaller.marshal({'one': 1,
'two': 2,
'three': 3})
print "\n#########################################"
print "# testString test case #"
print "#########################################"
print "marshalled dict object:\n"
print xmlprettyprint(xml)
def testBool(self):
xmltrue = xmlmarshaller.marshal(True)
xmlfalse = xmlmarshaller.marshal(False)
print "\n#########################################"
print "# testBool test case #"
print "#########################################"
print "marshalled boolean true object:\n"
print xmlprettyprint(xmltrue)
print "\nmarshalled boolean false object:\n"
print xmlprettyprint(xmlfalse)
pytrue = xmlmarshaller.unmarshal(xmltrue)
assert pytrue is True
pyfalse = xmlmarshaller.unmarshal(xmlfalse)
assert pyfalse is False
def testString(self):
xml = xmlmarshaller.marshal(
"all your marshalled objects are belong to us")
print "\n#########################################"
print "# testString test case #"
print "#########################################"
print xmlprettyprint(xml)
def testEmptyElement(self):
person = Person()
person.firstName = "Albert"
person.__xmlattributes__ = ('firstName',)
xml = xmlmarshaller.marshal(person, 'person')
print "\n#########################################"
print "# testEmptyElement test case #"
print "#########################################"
print xml
assert (xml == """<person objtype="__main__.Person" firstName="Albert"/>""")
def testXMLFlattenSequence(self):
person = Person()
person.asequence = ('one', 'two')
xml = xmlmarshaller.marshal(person, 'person')
print "\n#########################################"
print "# testXMLFlattenSequence test case #"
print "#########################################"
print xml
assert (xml == """<person objtype="__main__.Person"><the_earth_is_flat>one</the_earth_is_flat><the_earth_is_flat>two</the_earth_is_flat></person>""")
unmarshalledperson = xmlmarshaller.unmarshal(xml)
assert(hasattr(unmarshalledperson, 'asequence'))
assert(len(unmarshalledperson.asequence) == 2)
def testInstance(self):
print "\n#########################################"
print "# testInstance test case #"
print "#########################################"
class Foo:
def __init__(self):
self.alist = [1,2]
self.astring = 'f00'
f = Foo()
xml = xmlmarshaller.marshal(f, 'foo')
print xml
def testPerson(self):
person = Person()
person.firstName = "Albert"
person.lastName = "Camus"
person.addressLine1 = "23 Absurd St."
person.city = "Ennui"
person.state = "MO"
person.zip = "54321"
person._phoneNumber = "808-303-2323"
person.favoriteWords = ['angst', 'ennui', 'existence']
person.weight = 150
# __xmlattributes__ = ('fabulousness',)
person.fabulousness = "tres tres"
xml = xmlmarshaller.marshal(person)
print "\n#########################################"
print "# testPerson test case #"
print "#########################################"
print "Person object marshalled into XML:\n"
print xml
# When encountering a "person" element, use the Person class
## elementMappings = { "person" : Person }
## obj = unmarshal(xml, elementMappings = elementMappings)
## print "Person object recreated from XML with attribute types indicated:"
## print obj.person.__class__
## for (attr, value) in obj.person.__dict__.items():
## if not attr.startswith("__"):
## print attr, "=", value, type(value)
## print
if __name__ == "__main__":
unittest.main()

View File

@@ -0,0 +1,63 @@
#----------------------------------------------------------------------------
# Name: xmlprettyprinter.py
# Purpose:
#
# Author: John Spurling
#
# Created: 9/21/04
# CVS-ID: $Id$
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
# License: wxWindows License
#----------------------------------------------------------------------------
import xml.sax
import xml.sax.handler
class XMLPrettyPrinter(xml.sax.ContentHandler):
def __init__(self, indentationChar=' ', newlineChar='\n'):
self.xmlOutput = ''
self.indentationLevel = 0
self.indentationChar = indentationChar
self.elementStack = []
self.newlineChar = newlineChar
self.hitCharData = False
## ContentHandler methods
def startElement(self, name, attrs):
indentation = self.newlineChar + (self.indentationLevel * self.indentationChar)
# build attribute string
attrstring = ''
for attr in attrs.getNames():
value = attrs[attr]
attrstring += ' %s="%s"' % (attr, value)
self.xmlOutput += '%s<%s%s>' % (indentation, name, attrstring)
self.indentationLevel += 1
self.elementStack.append(name)
self.hitCharData = False
def characters(self, content):
self.xmlOutput += content
self.hitCharData = True
def endElement(self, name):
self.indentationLevel -= 1
indentation = ''
if not self.hitCharData:
## indentation += self.newlineChar + (self.indentationLevel * self.indentationChar)
indentation += self.indentationLevel * self.indentationChar
else:
self.hitCharData = False
self.xmlOutput += '%s</%s>%s' % (indentation, self.elementStack.pop(), self.newlineChar)
def getXMLString(self):
return self.xmlOutput[1:]
def xmlprettyprint(xmlstr, spaces=4):
xpp = XMLPrettyPrinter(indentationChar=' ' * spaces)
xml.sax.parseString(xmlstr, xpp)
return xpp.getXMLString()
if __name__ == '__main__':
simpleTestString = """<one>some text<two anattr="booga">two's data</two></one>"""
print prettyprint(simpleTestString)