MCPcopy Create free account
hub / github.com/SimHacker/micropolis / CellTool

Class CellTool

MicropolisCore/src/pyMicropolis/cellEngine/celltool.py:78–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76
77
78class CellTool(tiletool.TileTool):
79
80
81 def __init__(
82 self,
83 cellValue=0,
84 **args):
85
86 tiletool.TileTool.__init__(
87 self,
88 **args)
89
90 self.cellValue = cellValue
91
92
93 def drawCell(self, view, x, y, value):
94
95 engine = view.engine.SetCell(x, y, value)
96
97
98 def handleMouseDown(self, view, event):
99
100 self.handleMouseDrag(view, event)
101
102
103 def handleMouseDrag(self, view, event):
104
105 x, y = view.getEventXY(event)
106 x = int(x)
107 y = int(y)
108 #print "DRAG", self.lastX, self.lastY, x, y, "index", self.toolIndex, view.engine.toolDrag
109 self.drawCell(view, x, y, self.cellValue)
110
111
112 def handleMouseUp(self, view, event):
113
114 #print "UP"
115 self.handleMouseDrag(view, event)
116
117
118 def tick(self, view):
119
120 pass
121
122
123########################################################################

Callers 1

celltool.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected