parameters: (self)
docstring: Change canvas background image
docstring_summary: Change canvas background image
docstring_tokens: Change canvas background image
function: def onChangeImage(self):
          """Change canvas background image"""
          image_path = self.getNewImage()
          if not image_path:
              return False
          try:
              width, height = imageProp(image_path)
          except ValueError as e:
              showWarning(
                  f"<b>Unsupported image</b> in file <i>{image_path}</i>:"
                  f"<br><br>{str(e)}")
              return False
          bkgd_url = path2url(image_path)
          self.imgoccedit.svg_edit.eval("""
                          svgCanvas.setBackground('#FFF', '%s');
                          svgCanvas.setResolution(%s, %s);
                      """ % (bkgd_url, width, height))
          self.image_path = image_path
function_tokens: def onChangeImage ( self ) : image_path = self . getNewImage ( ) if not image_path : return False try : width , height = imageProp ( image_path ) except ValueError as e : showWarning ( f"<b>Unsupported image</b> in file <i>{image_path}</i>:" f"<br><br>{str(e)}" ) return False bkgd_url = path2url ( image_path ) self . imgoccedit . svg_edit . eval ( """
                          svgCanvas.setBackground('#FFF', '%s');
                          svgCanvas.setResolution(%s, %s);
                      """ % ( bkgd_url , width , height ) ) self . image_path = image_path