def __init__(
self, parent=None, id=-1, pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.TAB_TRAVERSAL|wx.NO_BORDER|wx.FULL_REPAINT_ON_RESIZE,
name='SquareMap', model = None,
adapter = None,
labels = True,
highlight = True,
padding = 2,
margin = 0,
square_style = False,
):
"""Initialise the SquareMap
adapter -- a DefaultAdapter or same-interface instance providing SquareMap data api
labels -- set to True (default) to draw textual labels within the boxes
highlight -- set to True (default) to highlight nodes on mouse-over
padding -- spacing within each square and its children (within the square's border)
margin -- spacing around each square (on all sides)
square_style -- use a more-recursive, less-linear, more "square" layout style which
works better on objects with large numbers of children, such as Meliae memory
dumps, works fine on profile views as well, but the layout is less obvious wrt
what node is "next" "previous" etc.
"""
super( SquareMap, self ).__init__(
parent, id, pos, size, style, name
)
self.model = model
self.padding = padding
self.square_style = square_style
self.margin = margin
self.labels = labels
self.highlight = highlight
self.selectedNode = None
self.highlightedNode = None
self._buffer = wx.Bitmap(20, 20) # Have a default buffer ready
self.Bind( wx.EVT_PAINT, self.OnPaint)
self.Bind( wx.EVT_SIZE, self.OnSize )
if highlight:
self.Bind( wx.EVT_MOTION, self.OnMouse )
self.Bind( wx.EVT_LEFT_UP, self.OnClickRelease )
self.Bind( wx.EVT_LEFT_DCLICK, self.OnDoubleClick )
self.Bind( wx.EVT_KEY_UP, self.OnKeyUp )
self.hot_map = []
self.adapter = adapter or DefaultAdapter()
self.DEFAULT_PEN = wx.Pen( wx.BLACK, 1, wx.SOLID )
self.SELECTED_PEN = wx.Pen( wx.WHITE, 2, wx.SOLID )
self.OnSize(None)
评论列表
文章目录