color component size, position, and gradient options
This commit is contained in:
parent
4b1058781d
commit
4de39ebe07
|
@ -1,6 +1,7 @@
|
|||
from PIL import Image, ImageDraw
|
||||
from PyQt4 import uic, QtGui, QtCore
|
||||
from PyQt4.QtGui import QColor
|
||||
from PIL.ImageQt import ImageQt
|
||||
import os
|
||||
from . import __base__
|
||||
|
||||
|
@ -48,6 +49,26 @@ class Component(__base__.Component):
|
|||
page.lineEdit_color2.textChanged.connect(self.update)
|
||||
page.spinBox_x.valueChanged.connect(self.update)
|
||||
page.spinBox_y.valueChanged.connect(self.update)
|
||||
page.spinBox_width.valueChanged.connect(self.update)
|
||||
page.spinBox_height.valueChanged.connect(self.update)
|
||||
page.checkBox_trans.stateChanged.connect(self.update)
|
||||
|
||||
self.fillLabels = [ \
|
||||
'Solid',
|
||||
'Linear Gradient',
|
||||
'Radial Gradient',
|
||||
]
|
||||
for label in self.fillLabels:
|
||||
page.comboBox_fill.addItem(label)
|
||||
page.comboBox_fill.setCurrentIndex(0)
|
||||
page.comboBox_fill.currentIndexChanged.connect(self.update)
|
||||
page.spinBox_radialGradient_end.valueChanged.connect(self.update)
|
||||
page.spinBox_radialGradient_start.valueChanged.connect(self.update)
|
||||
page.spinBox_radialGradient_spread.valueChanged.connect(self.update)
|
||||
page.spinBox_linearGradient_end.valueChanged.connect(self.update)
|
||||
page.spinBox_linearGradient_start.valueChanged.connect(self.update)
|
||||
page.checkBox_stretch.stateChanged.connect(self.update)
|
||||
|
||||
self.page = page
|
||||
return page
|
||||
|
||||
|
@ -56,6 +77,30 @@ class Component(__base__.Component):
|
|||
self.color2 = self.RGBFromString(self.page.lineEdit_color2.text())
|
||||
self.x = self.page.spinBox_x.value()
|
||||
self.y = self.page.spinBox_y.value()
|
||||
self.sizeWidth = self.page.spinBox_width.value()
|
||||
self.sizeHeight = self.page.spinBox_height.value()
|
||||
self.trans = self.page.checkBox_trans.isChecked()
|
||||
|
||||
self.RG_start = self.page.spinBox_radialGradient_start.value()
|
||||
self.RG_end = self.page.spinBox_radialGradient_end.value()
|
||||
self.RG_spread = self.page.spinBox_radialGradient_spread.value()
|
||||
self.stretch = self.page.checkBox_stretch.isChecked()
|
||||
self.LG_start = self.page.spinBox_linearGradient_start.value()
|
||||
self.LG_end = self.page.spinBox_linearGradient_end.value()
|
||||
|
||||
self.fillType = self.page.comboBox_fill.currentIndex()
|
||||
if self.fillType == 0:
|
||||
self.page.lineEdit_color2.setEnabled(False)
|
||||
self.page.pushButton_color2.setEnabled(False)
|
||||
self.page.checkBox_trans.setEnabled(False)
|
||||
self.page.checkBox_stretch.setEnabled(False)
|
||||
else:
|
||||
self.page.lineEdit_color2.setEnabled(True)
|
||||
self.page.pushButton_color2.setEnabled(True)
|
||||
self.page.checkBox_trans.setEnabled(True)
|
||||
self.page.checkBox_stretch.setEnabled(True)
|
||||
self.page.fillWidget.setCurrentIndex(self.fillType)
|
||||
|
||||
self.parent.drawPreview()
|
||||
super().update()
|
||||
|
||||
|
@ -75,23 +120,77 @@ class Component(__base__.Component):
|
|||
|
||||
def drawFrame(self, width, height):
|
||||
r, g, b = self.color1
|
||||
return Image.new("RGBA", (width, height), (r, g, b, 255))
|
||||
shapeSize = (self.sizeWidth, self.sizeHeight)
|
||||
# in default state, skip all this logic and return a plain fill
|
||||
if self.fillType==0 and shapeSize == (width, height) \
|
||||
and self.x == 0 and self.y == 0:
|
||||
return Image.new("RGBA", (width, height), (r, g, b, 255))
|
||||
|
||||
frame = self.blankFrame(width, height)
|
||||
|
||||
# Return a solid image at x, y
|
||||
if self.fillType == 0:
|
||||
image = Image.new("RGBA", shapeSize, (r, g, b, 255))
|
||||
frame.paste(image, box=(self.x, self.y))
|
||||
return frame
|
||||
|
||||
# Now fills that require using Qt...
|
||||
elif self.fillType > 0:
|
||||
image = ImageQt(frame)
|
||||
painter = QtGui.QPainter(image)
|
||||
if self.stretch:
|
||||
w = width; h = height
|
||||
else:
|
||||
w = self.sizeWidth; h = self.sizeWidth
|
||||
|
||||
if self.fillType == 1: # Linear Gradient
|
||||
brush = QtGui.QLinearGradient(
|
||||
self.LG_start,
|
||||
self.LG_end,
|
||||
w, h)
|
||||
|
||||
elif self.fillType == 2: # Radial Gradient
|
||||
brush = QtGui.QRadialGradient(
|
||||
self.RG_start,
|
||||
self.RG_end,
|
||||
w, h,
|
||||
self.RG_spread)
|
||||
|
||||
brush.setColorAt(0.0, QColor(*self.color1))
|
||||
if self.trans:
|
||||
brush.setColorAt(1.0, QColor(0, 0, 0, 0))
|
||||
else:
|
||||
brush.setColorAt(1.0, QColor(*self.color2))
|
||||
painter.setBrush(brush)
|
||||
painter.drawRect(self.x, self.y,
|
||||
self.sizeWidth, self.sizeHeight)
|
||||
painter.end()
|
||||
imBytes = image.bits().asstring(image.numBytes())
|
||||
return Image.frombytes('RGBA', (width, height), imBytes)
|
||||
|
||||
def loadPreset(self, pr, presetName=None):
|
||||
super().loadPreset(pr, presetName)
|
||||
|
||||
self.page.comboBox_fill.setCurrentIndex(pr['fillType'])
|
||||
self.page.lineEdit_color1.setText('%s,%s,%s' % pr['color1'])
|
||||
self.page.lineEdit_color2.setText('%s,%s,%s' % pr['color2'])
|
||||
self.page.spinBox_x.setValue(pr['x'])
|
||||
self.page.spinBox_y.setValue(pr['y'])
|
||||
self.page.lineEdit_color2.setText('%s,%s,%s' % pr['color2'])
|
||||
self.page.spinBox_width.setValue(pr['width'])
|
||||
self.page.spinBox_height.setValue(pr['height'])
|
||||
self.page.checkBox_trans.setChecked(pr['trans'])
|
||||
|
||||
self.page.spinBox_radialGradient_start.setValue(pr['RG_start'])
|
||||
self.page.spinBox_radialGradient_end.setValue(pr['RG_end'])
|
||||
self.page.spinBox_radialGradient_spread.setValue(pr['RG_spread'])
|
||||
self.page.spinBox_linearGradient_start.setValue(pr['LG_start'])
|
||||
self.page.spinBox_linearGradient_end.setValue(pr['LG_end'])
|
||||
self.page.checkBox_stretch.setChecked(pr['stretch'])
|
||||
|
||||
btnStyle1 = "QPushButton { background-color : %s; outline: none; }" \
|
||||
% QColor(*pr['color1']).name()
|
||||
|
||||
btnStyle2 = "QPushButton { background-color : %s; outline: none; }" \
|
||||
% QColor(*pr['color2']).name()
|
||||
|
||||
self.page.pushButton_color1.setStyleSheet(btnStyle1)
|
||||
self.page.pushButton_color2.setStyleSheet(btnStyle2)
|
||||
|
||||
|
@ -102,6 +201,16 @@ class Component(__base__.Component):
|
|||
'color2': self.color2,
|
||||
'x': self.x,
|
||||
'y': self.y,
|
||||
'fillType': self.fillType,
|
||||
'width': self.sizeWidth,
|
||||
'height': self.sizeHeight,
|
||||
'trans': self.trans,
|
||||
'RG_start': self.RG_start,
|
||||
'RG_end': self.RG_end,
|
||||
'RG_spread': self.RG_spread,
|
||||
'stretch': self.stretch,
|
||||
'LG_start': self.LG_start,
|
||||
'LG_end': self.LG_end,
|
||||
}
|
||||
|
||||
def pickColor(self, num):
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_textLayout">
|
||||
<widget class="QLabel" name="label_xTitleAlign_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -167,22 +167,78 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fill </string>
|
||||
<string>Width</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_fill">
|
||||
<widget class="QSpinBox" name="spinBox_width">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<widget class="QLabel" name="label_yTitleAlign_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_height">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -231,32 +287,16 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
<number>-10000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_yTitleAlign">
|
||||
<property name="sizePolicy">
|
||||
|
@ -284,159 +324,316 @@
|
|||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
<property name="minimum">
|
||||
<number>-10000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_textLayout">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fill </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_fill">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_trans">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Transparent</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_stretch">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stretch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="fillWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="blank"/>
|
||||
<widget class="QWidget" name="linearGradient">
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>-1</x>
|
||||
<y>0</y>
|
||||
<width>561</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_xTitleAlign_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_linearGradient_start">
|
||||
<property name="minimum">
|
||||
<number>-10000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>End</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_linearGradient_end">
|
||||
<property name="minimum">
|
||||
<number>-10000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="radialGradient">
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
<width>561</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_xTitleAlign_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_radialGradient_start">
|
||||
<property name="minimum">
|
||||
<number>-10000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>End</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_radialGradient_end">
|
||||
<property name="minimum">
|
||||
<number>-10000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Spread</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_radialGradient_spread">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::PlusMinus</enum>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_xTitleAlign_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Width</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_width">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_yTitleAlign_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_height">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
|
@ -301,7 +301,9 @@ class MainWindow(QtCore.QObject):
|
|||
def autosaveExists(self):
|
||||
if self.currentProject and os.path.exists(self.autosavePath) \
|
||||
and filecmp.cmp(self.autosavePath, self.currentProject):
|
||||
return True
|
||||
with open(self.autosavePath, 'r') as f:
|
||||
p = [line for line in f]
|
||||
return True if len(p) > 1 else False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1028</width>
|
||||
<height>592</height>
|
||||
<width>1008</width>
|
||||
<height>575</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
|
Reference in New Issue