From 024fec60eb90595bf26cd3d5ebc4d8fed2f7302c Mon Sep 17 00:00:00 2001 From: Wataru Kanzaki Date: Tue, 14 Nov 2017 10:43:49 -0500 Subject: [PATCH 1/3] * fixed missing import --- anim_picker/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anim_picker/gui.py b/anim_picker/gui.py index 764a8b5..94f3174 100644 --- a/anim_picker/gui.py +++ b/anim_picker/gui.py @@ -19,7 +19,7 @@ from handlers import python_handlers from handlers import qt_handlers -from handlers.qt_handlers import QtCore, QtWidgets, QtOpenGL, QtWidgets +from handlers.qt_handlers import QtCore, QtWidgets, QtOpenGL, QtWidgets, QtGui from handlers import __EDIT_MODE__ from handlers import __SELECTION__ From b2b5095f9ddd3f71af11a4e8af863d80aff4d7e2 Mon Sep 17 00:00:00 2001 From: Wataru Kanzaki Date: Tue, 14 Nov 2017 11:36:57 -0500 Subject: [PATCH 2/3] * If the background image is not found, try to look for it in the module's images subfolder. --- anim_picker/gui.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/anim_picker/gui.py b/anim_picker/gui.py index 94f3174..fea94c9 100644 --- a/anim_picker/gui.py +++ b/anim_picker/gui.py @@ -1391,10 +1391,19 @@ def set_background(self, path=None): if not path: return path = unicode(path) - + # Check that path exists - if not (path and os.path.exists(path)): - print '# background image not found: "%s"'%path + # and try to load it from the module's images folder + # if the path doesn't exist + if path: + if not os.path.exists(path): + newpath = unicode(os.path.join(get_images_folder_path(), os.path.split(path)[1])) + if os.path.exists(newpath): + path = newpath + else: + print '# background image not found: "%s"'%path + return + else: return self.background_image_path = path From ef17cb3f4caf024d316ca565c4f3a99c50829677 Mon Sep 17 00:00:00 2001 From: Wataru Kanzaki Date: Tue, 14 Nov 2017 11:53:46 -0500 Subject: [PATCH 3/3] * If the snapshot image is not found, try to load it from the module's images folder --- anim_picker/gui.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/anim_picker/gui.py b/anim_picker/gui.py index fea94c9..5eb3689 100644 --- a/anim_picker/gui.py +++ b/anim_picker/gui.py @@ -506,11 +506,21 @@ def _get_default_snapshot(self, name='undefined'): def set_background(self, path=None): '''Set character snapshot picture ''' - if not (path and os.path.exists(unicode(path))): + if path: + if os.path.exists(path): + self.background = unicode(path) + else: + # try to find the snapshot pic in the module's images folder as a fallback + newpath = unicode(os.path.join(get_images_folder_path(), os.path.split(path)[1])) + if os.path.exists(newpath): + path = newpath + self.background = unicode(path) + else: + path = self._get_default_snapshot() + self.background = None + else: path = self._get_default_snapshot() self.background = None - else: - self.background = unicode(path) # Load image image = QtGui.QImage(path)