diff --git a/setup.py b/setup.py
index 4a4511f..dd546e2 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup
import os
-__version__ = '2.0.0.rc3'
+__version__ = '2.0.0.rc4'
def package_files(directory):
diff --git a/src/components/image.py b/src/components/image.py
index 1555541..63bee1a 100644
--- a/src/components/image.py
+++ b/src/components/image.py
@@ -8,7 +8,7 @@ from toolkit.frame import BlankFrame
class Component(Component):
name = 'Image'
- version = '1.0.0'
+ version = '1.0.1'
def widget(self, *args):
super().widget(*args)
@@ -16,6 +16,7 @@ class Component(Component):
self.trackWidgets({
'imagePath': self.page.lineEdit_image,
'scale': self.page.spinBox_scale,
+ 'stretchScale': self.page.spinBox_scale_stretch,
'rotate': self.page.spinBox_rotate,
'color': self.page.spinBox_color,
'xPosition': self.page.spinBox_x,
@@ -51,6 +52,7 @@ class Component(Component):
def drawFrame(self, width, height):
frame = BlankFrame(width, height)
if self.imagePath and os.path.exists(self.imagePath):
+ scale = self.scale if not self.stretched else self.stretchScale
image = Image.open(self.imagePath)
# Modify image's appearance
@@ -62,9 +64,9 @@ class Component(Component):
image = image.transpose(Image.FLIP_LEFT_RIGHT)
if self.stretched and image.size != (width, height):
image = image.resize((width, height), Image.ANTIALIAS)
- if self.scale != 100:
- newHeight = int((image.height / 100) * self.scale)
- newWidth = int((image.width / 100) * self.scale)
+ if scale != 100:
+ newHeight = int((image.height / 100) * scale)
+ newWidth = int((image.width / 100) * scale)
image = image.resize((newWidth, newHeight), Image.ANTIALIAS)
# Paste image at correct position
@@ -100,3 +102,25 @@ class Component(Component):
def commandHelp(self):
print('Load an image:\n path=/filepath/to/image.png')
+
+ def savePreset(self):
+ # Maintain the illusion that the scale spinbox is one widget
+ scaleBox = self.page.spinBox_scale
+ stretchScaleBox = self.page.spinBox_scale_stretch
+ if self.page.checkBox_stretch.isChecked():
+ scaleBox.setValue(stretchScaleBox.value())
+ else:
+ stretchScaleBox.setValue(scaleBox.value())
+ return super().savePreset()
+
+ def update(self):
+ # Maintain the illusion that the scale spinbox is one widget
+ scaleBox = self.page.spinBox_scale
+ stretchScaleBox = self.page.spinBox_scale_stretch
+ if self.page.checkBox_stretch.isChecked():
+ scaleBox.setVisible(False)
+ stretchScaleBox.setVisible(True)
+ else:
+ scaleBox.setVisible(True)
+ stretchScaleBox.setVisible(False)
+ super().update()
diff --git a/src/components/image.ui b/src/components/image.ui
index 1837b64..2dad127 100644
--- a/src/components/image.ui
+++ b/src/components/image.ui
@@ -293,6 +293,22 @@
+ -
+
+
+ %
+
+
+ 10
+
+
+ 400
+
+
+ 100
+
+
+
-
diff --git a/src/components/life.py b/src/components/life.py
index 08360a2..147d4d5 100644
--- a/src/components/life.py
+++ b/src/components/life.py
@@ -4,12 +4,13 @@ import os
import math
from component import Component
+from toolkit import alphabetizeDict
from toolkit.frame import BlankFrame, scale
class Component(Component):
name = 'Conway\'s Game of Life'
- version = '1.0.0a'
+ version = '1.0.0'
def widget(self, *args):
super().widget(*args)
@@ -329,12 +330,12 @@ class Component(Component):
def savePreset(self):
pr = super().savePreset()
- pr['GRID'] = self.startingGrid
+ pr['GRID'] = alphabetizeDict(self.startingGrid)
return pr
def loadPreset(self, pr, *args):
super().loadPreset(pr, *args)
- self.startingGrid = pr['GRID']
+ self.startingGrid = dict(pr['GRID'])
def nearbyCoords(x, y):