Refactoring

- Change saved previews to PNG
  - Split lib.gui.utils
  - Disable flake8 on __init__ imports
This commit is contained in:
torzdf
2022-10-15 19:17:24 +01:00
parent 47867a0dd4
commit f32f460e3f
9 changed files with 1548 additions and 1503 deletions

View File

@@ -494,22 +494,21 @@ class Train(): # pylint:disable=too-few-public-methods
The preview image to be displayed and/or written out
name: str, optional
The name of the image for saving or display purposes. If an empty string is passed
then it will automatically be names. Default: ""
then it will automatically be named. Default: ""
"""
logger.debug("Updating preview: (name: %s)", name)
try:
scriptpath = os.path.realpath(os.path.dirname(sys.argv[0]))
if self._args.write_image:
logger.debug("Saving preview to disk")
img = "training_preview.jpg"
img = "training_preview.png"
imgfile = os.path.join(scriptpath, img)
cv2.imwrite(imgfile, image) # pylint: disable=no-member
logger.debug("Saved preview to: '%s'", img)
if self._args.redirect_gui:
logger.debug("Generating preview for GUI")
img = ".gui_training_preview.jpg"
imgfile = os.path.join(scriptpath, "lib", "gui",
".cache", "preview", img)
img = ".gui_training_preview.png"
imgfile = os.path.join(scriptpath, "lib", "gui", ".cache", "preview", img)
cv2.imwrite(imgfile, image) # pylint: disable=no-member
logger.debug("Generated preview for GUI: '%s'", imgfile)
if self._args.preview: