Преглед изворни кода

Update card grid layer name, fix decimal guides

Guides were being between pixels because of float values being passed
in. We sanitise height/width/bleed values to only be integers.
Weiyi Lou пре 3 година
родитељ
комит
fbc7ee709a
1 измењених фајлова са 7 додато и 4 уклоњено
  1. 7 4
      card_grid_generator/card_grid_generator_extension.py

+ 7 - 4
card_grid_generator/card_grid_generator_extension.py

@@ -119,9 +119,12 @@ class CardGridGenerator(Extension):
             multiplier = docPPI
         if self.unitInput.currentText() == "mm":
             multiplier = docPPI/25.4
-        bleedSize = float(self.bleedInput.text()) * multiplier
-        cardWidth = float(self.widthInput.text()) * multiplier
-        cardHeight = float(self.heightInput.text()) * multiplier
+        bleed = self.bleedInput.text()
+        width = self.widthInput.text()
+        height = self.heightInput.text()
+        bleedSize = int(float(bleed) * multiplier)
+        cardWidth = int(float(width) * multiplier)
+        cardHeight = int(float(height) * multiplier)
 
         # Card dimensions with bleed.
         cardBledWidth = cardWidth + bleedSize * 2
@@ -192,7 +195,7 @@ class CardGridGenerator(Extension):
             cropBetween = cropmarkType in ["Between", "All"]
 
             # Cropmarks will be on a new layer.
-            layer = doc.createNode('CardGridCropmarks', 'paintLayer')
+            layer = doc.createNode(f"""Cropmarks {width}x{height}x{bleed}""", 'paintLayer')
             root = doc.rootNode()
             root.addChildNode(layer, None)