Просмотр исходного кода

Fix missing cropmarks at 0 bleed, adjust UI and comments

Weiyi Lou 20 часов назад
Родитель
Сommit
fa2a5b48a7

+ 15 - 18
card_grid_generator/card_grid_generator_extension.py

@@ -36,33 +36,26 @@ class CardGridGenerator(Extension):
         # Card dimension row.
         self.widthInput = QLineEdit('750')
         self.heightInput = QLineEdit('1050')
+        self.bleedInput = QLineEdit('36')
         self.unitInput = QComboBox()
         self.unitInput.addItems( ['px', 'mm', 'inch'] )
         row1 = QHBoxLayout()
-        row1.addWidget(QLabel('Card size: W:'))
+        row1.addWidget(QLabel('Card size - W:'))
         row1.addWidget(self.widthInput)
         row1.addWidget(QLabel(' x H:'))
         row1.addWidget(self.heightInput)
+        row1.addWidget(QLabel(' + Bleed:'))
+        row1.addWidget(self.bleedInput)
         row1.addWidget(self.unitInput)
         layout.addLayout(row1)
 
-        # Bleed dimension row.
-        self.bleedInput = QLineEdit('36')
-        self.guidesCheck = QCheckBox('Guides')
-        self.guidesCheck.setChecked(True)
-        row2 = QHBoxLayout()
-        row2.addWidget(QLabel('Bleed size:'))
-        row2.addWidget(self.bleedInput)
-        row2.addWidget(self.guidesCheck)
-        layout.addLayout(row2)
-
         # How many cards row.
         self.rowsInput = QLineEdit('0')
         self.colsInput = QLineEdit('0')
         self.maxCheck = QCheckBox('Max Possible')
         self.maxCheck.setChecked(True)
         row3 = QHBoxLayout()
-        row3.addWidget(QLabel('Grid: Columns:'))
+        row3.addWidget(QLabel('Grid - Columns:'))
         row3.addWidget(self.colsInput)
         row3.addWidget(QLabel('Rows:'))
         row3.addWidget(self.rowsInput)
@@ -70,11 +63,14 @@ class CardGridGenerator(Extension):
         layout.addLayout(row3)
 
         # Cropmark options.
+        self.guidesCheck = QCheckBox('Guides')
+        self.guidesCheck.setChecked(True)
         self.cropmarksCheck = QCheckBox('Cropmarks')
         self.cropmarksCheck.setChecked(True)
         self.cropmarkTypeInput = QComboBox()
         self.cropmarkTypeInput.addItems( ['Around', 'Between', 'All'] )
         row4 = QHBoxLayout()
+        row4.addWidget(self.guidesCheck)
         row4.addWidget(self.cropmarksCheck)
         row4.addWidget(QLabel('Cropmark Type:'))
         row4.addWidget(self.cropmarkTypeInput)
@@ -142,18 +138,19 @@ class CardGridGenerator(Extension):
             colCount = int(self.colsInput.text())
             rowCount = int(self.rowsInput.text())
 
-        # Calculate offset for centering.
+        # Calculate left-most card starting coords, offset for centering.
         # Remainder pixels of row and column, divide by 2.
-        # Bias odd pixel calculations to top left via floor.
+        # Bias odd pixel lengths to top left (via floor).
         widthOffset = floor((docWidth - colCount * cardBledWidth) / 2)
         heightOffset = floor((docHeight - rowCount * cardBledHeight) / 2)
 
-        # Create xSet and ySet (remember, both bleed + edge dimensions).
-        # Also create Cards-Only sets for cropmarks.
+        # Create xSet and ySet (arrays of x and y coords for guide creating,
+        # with both bleed + edge dimensions).
+        # Also create Cards-Only sets for "between" cropmarks.
         xSet = [widthOffset]
         ySet = [heightOffset]
-        xSetCardsOnly = []
-        ySetCardsOnly = []
+        xSetCardsOnly = [widthOffset]
+        ySetCardsOnly = [heightOffset]
 
         for i in range(colCount):
             base = widthOffset + i * cardBledWidth

+ 1 - 1
export_layers_enhanced/uiexportlayers.py

@@ -54,7 +54,7 @@ class UIExportLayers(object):
         self.resSpinBox = QSpinBox()
 
         self.buttonBox = QDialogButtonBox(
-            QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
+            QDialogButtonBox.Ok | QDialogButtonBox.Close)
 
         self.kritaInstance = krita.Krita.instance()
         self.documentsList = []