aboutsummaryrefslogtreecommitdiff
path: root/components/image.py
diff options
context:
space:
mode:
authortassaron2017-06-22 18:40:34 -0400
committertassaron2017-06-22 18:40:34 -0400
commit5c74d496a960042ed4a4279328dc81e23dfdc1d9 (patch)
treef11c4f6fe69ab202688b55100ec841bb24f8804f /components/image.py
parent82011de966f95afa88ec9e11e0ce86cbd04d5fc0 (diff)
preset-loading and basic args from commandline
also made some docstrings more informative
Diffstat (limited to 'components/image.py')
-rw-r--r--components/image.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/components/image.py b/components/image.py
index b6aa29b..d0e1894 100644
--- a/components/image.py
+++ b/components/image.py
@@ -92,3 +92,20 @@ class Component(__base__.Component):
self.settings.setValue("backgroundDir", os.path.dirname(filename))
self.page.lineEdit_image.setText(filename)
self.update()
+
+ def command(self, arg):
+ if not arg.startswith('preset='):
+ if os.path.exists(arg):
+ try:
+ Image.open(arg)
+ self.imagePath = arg
+ self.stretched = True
+ return True
+ except OSError as e:
+ print("Not a supported image format")
+ quit(1)
+ super().command(arg)
+
+ def commandHelp(self):
+ print('Give a complete filepath to an image to load that '
+ 'image with default settings.')