Add scale settings
This commit is contained in:
parent
84ca8068ee
commit
c8aacaec4a
@ -69,6 +69,8 @@ defaultProfile["stretch"] = True
|
||||
defaultProfile["rotate"] = True
|
||||
defaultProfile["offset-x"] = 0
|
||||
defaultProfile["offset-y"] = 0
|
||||
defaultProfile["scale-x"] = 1.00
|
||||
defaultProfile["scale-y"] = 1.00
|
||||
|
||||
# Profiles
|
||||
def saveProfile(profile,profileName):
|
||||
@ -245,7 +247,7 @@ class mainWindow(QMainWindow):
|
||||
self.cTitle = prettyDistro
|
||||
self.setWindowTitle(self.cTitle)
|
||||
self.cWidth = 300
|
||||
self.cHeight = 256
|
||||
self.cHeight = 265
|
||||
self.resize(self.cWidth,self.cHeight)
|
||||
self.cCreateElements()
|
||||
|
||||
@ -281,6 +283,8 @@ class mainWindow(QMainWindow):
|
||||
self.cStretchTick.setChecked(self.cProfile["stretch"])
|
||||
self.cOffsetHorzInput.setText(str(self.cProfile["offset-x"]))
|
||||
self.cOffsetVertInput.setText(str(self.cProfile["offset-y"]))
|
||||
self.cScaleHorzInput.setText(str(self.cProfile["scale-x"]))
|
||||
self.cScaleVertInput.setText(str(self.cProfile["scale-y"]))
|
||||
|
||||
def cSaveProfile(self):
|
||||
self.setEnabled(False)
|
||||
@ -332,6 +336,10 @@ class mainWindow(QMainWindow):
|
||||
profile["offset-x"] = int(self.cOffsetHorzInput.text())
|
||||
error = "Offset vertical"
|
||||
profile["offset-y"] = int(self.cOffsetVertInput.text())
|
||||
error = "Scale horizontal"
|
||||
profile["scale-x"] = float(self.cScaleHorzInput.text())
|
||||
error = "Scale vertical"
|
||||
profile["scale-y"] = float(self.cScaleVertInput.text())
|
||||
except:
|
||||
return error
|
||||
return profile
|
||||
@ -398,8 +406,8 @@ class mainWindow(QMainWindow):
|
||||
imStartY = printerPrintOffset[1]
|
||||
|
||||
if profile["stretch"]:
|
||||
imEndX = imStartX + printerPrintSize[0]
|
||||
imEndY = imStartY + printerPrintSize[1]
|
||||
imEndX = printerPrintSize[0]
|
||||
imEndY = printerPrintSize[1]
|
||||
else:
|
||||
imEndX = imStartX + bmp.size[0]
|
||||
imEndY = imStartY + bmp.size[1]
|
||||
@ -409,6 +417,13 @@ class mainWindow(QMainWindow):
|
||||
imStartY += profile["offset-y"]
|
||||
imEndY += profile["offset-y"]
|
||||
|
||||
addX = round((imEndX - imStartX) * profile["scale-x"]) - (imEndX - imStartX)
|
||||
addY = round((imEndY - imStartY) * profile["scale-y"]) - (imEndY - imStartY)
|
||||
imEndX = imEndX + (round(addX*0.5))
|
||||
imEndY = imEndY + (round(addY*0.5))
|
||||
imStartX = imStartX - (round(addX*0.5))
|
||||
imStartY = imStartY - (round(addY*0.5))
|
||||
|
||||
copies = profile["amount"]
|
||||
dib = PIL.ImageWin.Dib(bmp)
|
||||
while copies > 0:
|
||||
@ -502,7 +517,7 @@ class mainWindow(QMainWindow):
|
||||
|
||||
# Offset horizontal
|
||||
layout = self.cCreateLayout()
|
||||
self.cOffsetHorzLabel = QLabel("Offset horizontal:")
|
||||
self.cOffsetHorzLabel = QLabel("Offset horizontal (px):")
|
||||
#self.cOffsetHorzLabel.setStyleSheet("font-weight: bold")
|
||||
layout.addWidget(self.cOffsetHorzLabel)
|
||||
line = createLine()
|
||||
@ -512,7 +527,7 @@ class mainWindow(QMainWindow):
|
||||
|
||||
# Offset vertical
|
||||
layout = self.cCreateLayout()
|
||||
self.cOffsetVertLabel = QLabel("Offset vertical:")
|
||||
self.cOffsetVertLabel = QLabel("Offset vertical (px):")
|
||||
#self.cOffsetVertLabel.setStyleSheet("font-weight: bold")
|
||||
layout.addWidget(self.cOffsetVertLabel)
|
||||
line = createLine()
|
||||
@ -520,6 +535,26 @@ class mainWindow(QMainWindow):
|
||||
self.cOffsetVertInput = QLineEdit()
|
||||
layout.addWidget(self.cOffsetVertInput)
|
||||
|
||||
# Scale horizontal
|
||||
layout = self.cCreateLayout()
|
||||
self.cScaleHorzLabel = QLabel("Scale horizontal (*):")
|
||||
#self.cScaleHorzLabel.setStyleSheet("font-weight: bold")
|
||||
layout.addWidget(self.cScaleHorzLabel)
|
||||
line = createLine()
|
||||
layout.addWidget(line)
|
||||
self.cScaleHorzInput = QLineEdit()
|
||||
layout.addWidget(self.cScaleHorzInput)
|
||||
|
||||
# Scale vertical
|
||||
layout = self.cCreateLayout()
|
||||
self.cScaleVertLabel = QLabel("Scale vertical (*):")
|
||||
#self.cScaleVertLabel.setStyleSheet("font-weight: bold")
|
||||
layout.addWidget(self.cScaleVertLabel)
|
||||
line = createLine()
|
||||
layout.addWidget(line)
|
||||
self.cScaleVertInput = QLineEdit()
|
||||
layout.addWidget(self.cScaleVertInput)
|
||||
|
||||
line = createLine("solid")
|
||||
self.cLayout.addWidget(line)
|
||||
|
||||
@ -587,6 +622,14 @@ class mainWindow(QMainWindow):
|
||||
limitWidgetSize(self.cOffsetVertLabel)
|
||||
self.cOffsetVertInput.setMaximumWidth(64)
|
||||
|
||||
# Scale horizontal
|
||||
limitWidgetSize(self.cScaleHorzLabel)
|
||||
self.cScaleHorzInput.setMaximumWidth(64)
|
||||
|
||||
# Scale vertical
|
||||
limitWidgetSize(self.cScaleVertLabel)
|
||||
self.cScaleVertInput.setMaximumWidth(64)
|
||||
|
||||
# Information
|
||||
limitWidgetSize(self.cInfoResolutionLabel)
|
||||
limitWidgetSize(self.cInfoResolutionValue)
|
||||
|
Loading…
Reference in New Issue
Block a user