summaryrefslogtreecommitdiff
path: root/src/editorui/editormain.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/editorui/editormain.py')
-rw-r--r--src/editorui/editormain.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/editorui/editormain.py b/src/editorui/editormain.py
index b74967b..136eee1 100644
--- a/src/editorui/editormain.py
+++ b/src/editorui/editormain.py
@@ -23,6 +23,8 @@ class KPMapScene(QtGui.QGraphicsScene):
self.ticker.valueChanged.connect(self.thing)
self.ticker.setUpdateInterval(16.6666666666667)
+ self.grid = False
+
def playPause(self):
if self.playing == False:
@@ -49,6 +51,89 @@ class KPMapScene(QtGui.QGraphicsScene):
self.views()[0].viewport().update()
+ def drawForeground(self, painter, rect):
+ if not self.grid: return
+
+ Zoom = KP.mainWindow.ZoomLevel
+ drawLine = painter.drawLine
+
+ if Zoom >= 4:
+ startx = rect.x()
+ startx -= (startx % 24)
+ endx = startx + rect.width() + 24
+
+ starty = rect.y()
+ starty -= (starty % 24)
+ endy = starty + rect.height() + 24
+
+ painter.setPen(QtGui.QPen(QtGui.QColor.fromRgb(255,255,255,100), 1, QtCore.Qt.DotLine))
+
+ x = startx
+ y1 = rect.top()
+ y2 = rect.bottom()
+ while x <= endx:
+ drawLine(x, starty, x, endy)
+ x += 24
+
+ y = starty
+ x1 = rect.left()
+ x2 = rect.right()
+ while y <= endy:
+ drawLine(startx, y, endx, y)
+ y += 24
+
+
+ if Zoom >= 2:
+ startx = rect.x()
+ startx -= (startx % 96)
+ endx = startx + rect.width() + 96
+
+ starty = rect.y()
+ starty -= (starty % 96)
+ endy = starty + rect.height() + 96
+
+ painter.setPen(QtGui.QPen(QtGui.QColor.fromRgb(255,255,255,100), 1, QtCore.Qt.DashLine))
+
+ x = startx
+ y1 = rect.top()
+ y2 = rect.bottom()
+ while x <= endx:
+ drawLine(x, starty, x, endy)
+ x += 96
+
+ y = starty
+ x1 = rect.left()
+ x2 = rect.right()
+ while y <= endy:
+ drawLine(startx, y, endx, y)
+ y += 96
+
+
+ startx = rect.x()
+ startx -= (startx % 192)
+ endx = startx + rect.width() + 192
+
+ starty = rect.y()
+ starty -= (starty % 192)
+ endy = starty + rect.height() + 192
+
+ painter.setPen(QtGui.QPen(QtGui.QColor.fromRgb(255,255,255,100), 2, QtCore.Qt.DashLine))
+
+ x = startx
+ y1 = rect.top()
+ y2 = rect.bottom()
+ while x <= endx:
+ drawLine(x, starty, x, endy)
+ x += 192
+
+ y = starty
+ x1 = rect.left()
+ x2 = rect.right()
+ while y <= endy:
+ drawLine(startx, y, endx, y)
+ y += 192
+
+
def drawBackground(self, painter, rect):
painter.fillRect(rect, QtGui.QColor(209, 218, 236))