Ability to replace image without closing project

What do you want to achieve?

After adding an image to the assets and using it in a widget, I’d like the ability to change that image file without closing and reopening SquareLine Studio.

On Windows at least, SquareLine Studio tends to hold the file open, so attempting to overwrite an image file fails like this:

Sometimes it asks for an administrative override or to try again, but that doesn’t help until SquareLine Studio is closed.

Here’s how I would like this to work:

  1. Create image asset as usual, SquareLine Studio opens the file, renders it, subscribes to filesystem updates using Apple:KQueue/Apple:FSEvents/Linux:inotify/Windows:FileSystemWatcher/Unity:IHopeItHasANicePortableWayToDoThisForYou, closes the file.
  2. Use asset in a few widgets on screens
  3. Replace the image file in the asset directory
  4. SquareLine Studio detects that a file in the asset directory has been written-to and closed using the information in step 1
  5. SquareLine Studio reloads the image, and either updates the LVGL image or makes a new LVGL image and updates the widgets to use it.
  6. Image update appear on-screen in the SquareLine Studio editor.

It’s ok if I have to click pause/play to reload the images if simulator is currently running.

Mention some use cases

Sometimes the first image we have isn’t quite right, so we want to update the image file.

Sometimes we want to replace a widely-used image.

Do you see alternative options and workaround to achieve it?

One workaround is to close SquareLine, replace the file, reopen SquareLine. But when working with large projects this is quite slow.

Another workaround is to create a new image asset, then replace every usage of the old image with the new asset, then remember to delete the old asset, but there’s not way to know you found them all, and sometimes we forget to delete the old image anyways.

Hi, thanks for reporting this. We’ll look into it and try to identify what’s causing SquareLine Studio to keep the asset file locked on Windows.

1 Like

My apologies - it seems to always work up to 1 times, but fails subsequent times, which made it confusing to identify.

Hi, thanks for clarifying the reproduction steps. We’re looking into the issue, and it will be fixed in the next release.

1 Like