|
@@ -199,40 +199,28 @@ class CardGridGenerator(Extension):
|
|
|
root = doc.rootNode()
|
|
root = doc.rootNode()
|
|
|
root.addChildNode(layer, None)
|
|
root.addChildNode(layer, None)
|
|
|
|
|
|
|
|
- # Create vertical cropmarks.
|
|
|
|
|
blackPixel = b'\x00\x00\x00\xff'
|
|
blackPixel = b'\x00\x00\x00\xff'
|
|
|
cropMarkWidth = 2
|
|
cropMarkWidth = 2
|
|
|
- cropMarkHeight = 48
|
|
|
|
|
- cropMark = QByteArray(blackPixel * cropMarkWidth * cropMarkHeight)
|
|
|
|
|
- for x in xSetCardsOnly:
|
|
|
|
|
- yToDo = []
|
|
|
|
|
- if cropAround:
|
|
|
|
|
- yToDo.append(ySet[0] - cropMarkHeight) # top
|
|
|
|
|
- yToDo.append(ySet[-1]) # bottom
|
|
|
|
|
-
|
|
|
|
|
- if cropBetween:
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # Create outer cropmarks.
|
|
|
|
|
+ if cropAround:
|
|
|
|
|
+ cropMarkHeight = 48
|
|
|
|
|
+ cropMark = QByteArray(blackPixel * cropMarkWidth * cropMarkHeight)
|
|
|
|
|
+ for x in xSetCardsOnly:
|
|
|
|
|
+ layer.setPixelData(cropMark, x-1, ySet[0]-cropMarkHeight, cropMarkWidth, cropMarkHeight) # top vertical line
|
|
|
|
|
+ layer.setPixelData(cropMark, x-1, ySet[-1], cropMarkWidth, cropMarkHeight) # bottom vertical line
|
|
|
|
|
+ for y in ySetCardsOnly:
|
|
|
|
|
+ layer.setPixelData(cropMark, xSet[0]-cropMarkHeight, y-1, cropMarkHeight, cropMarkWidth) # left horizontal line
|
|
|
|
|
+ layer.setPixelData(cropMark, xSet[-1], y-1, cropMarkHeight, cropMarkWidth) # right horizontal line
|
|
|
|
|
+
|
|
|
|
|
+ # Create inner cropmarks.
|
|
|
|
|
+ if cropBetween:
|
|
|
|
|
+ cropMarkHeight = 36
|
|
|
|
|
+ cropMark = QByteArray(blackPixel * cropMarkWidth * cropMarkHeight)
|
|
|
|
|
+ for x in xSetCardsOnly:
|
|
|
for y in ySetCardsOnly:
|
|
for y in ySetCardsOnly:
|
|
|
- yToDo.append(int(y - cropMarkHeight/2))
|
|
|
|
|
-
|
|
|
|
|
- for y in yToDo:
|
|
|
|
|
- layer.setPixelData(cropMark, x - 1, y, cropMarkWidth, cropMarkHeight)
|
|
|
|
|
-
|
|
|
|
|
- # Create horizontal cropmarks.
|
|
|
|
|
- cropMarkWidth = 48
|
|
|
|
|
- cropMarkHeight = 2
|
|
|
|
|
- cropMark = QByteArray(blackPixel * cropMarkWidth * cropMarkHeight)
|
|
|
|
|
- for y in ySetCardsOnly:
|
|
|
|
|
- xToDo = []
|
|
|
|
|
- if cropAround:
|
|
|
|
|
- xToDo.append(xSet[0] - cropMarkWidth) # left
|
|
|
|
|
- xToDo.append(xSet[-1]) # right
|
|
|
|
|
-
|
|
|
|
|
- if cropBetween:
|
|
|
|
|
- for x in xSetCardsOnly:
|
|
|
|
|
- xToDo.append(int(x - cropMarkWidth/2))
|
|
|
|
|
-
|
|
|
|
|
- for x in xToDo:
|
|
|
|
|
- layer.setPixelData(cropMark, x, y - 1, cropMarkWidth, cropMarkHeight)
|
|
|
|
|
|
|
+ layer.setPixelData(cropMark, x-1, int(y - cropMarkHeight/2), cropMarkWidth, cropMarkHeight) # vertical line
|
|
|
|
|
+ layer.setPixelData(cropMark, int(x - cropMarkHeight/2), y-1, cropMarkHeight, cropMarkWidth) # horizontal line
|
|
|
|
|
|
|
|
# Refresh the view, or the cropmarks will not be immediately shown.
|
|
# Refresh the view, or the cropmarks will not be immediately shown.
|
|
|
doc.refreshProjection()
|
|
doc.refreshProjection()
|