Reload Pictures in Gedi

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
Search

Post Reply
3 posts • Page 1 of 1
dbindernagel
Posts: 151
Joined: Mon Feb 23, 2015 1:34 pm

Reload Pictures in Gedi

Post by dbindernagel »

Hi,

I have a problem that the Gedi is caching pictures it has loaded.

Basically I have a panel where I load different pictures during runtime on a rectangle like this:

Code: Select all

icon.fill = "[pattern,[fit,any,MsgBox/error.svg]]";
But If I now change the picture and reopen the panel I still see the old picture.
I have to completely close the Gedi and reopen it for the changes to apply.
(With changing the picture I mean opening it outside of the Gedi in a different software and for example change the design or just a color.)

It is not a big problem but it is annyoing that I have to reopen the Gedi everytime I'm making changes to a picture.
Is there an option like 'Reload CTRL Libs' that I missed or another solution?

Thanks

BR
Dennis

PS:
Tested with 3.18 P020 and 3.19 P005
I'm using SVG images but I think this applies to all image types (but not tested).

gschijndel
Posts: 330
Joined: Tue Jan 15, 2019 3:12 pm

Re: Reload Pictures in Gedi

Post by gschijndel »

This is one of those things that can be added to the gedi (like a little DIY project from ETM).

In order to save some reinventing the wheel for everybody facing this issue I have attached some code, which should be saved as 'scripts/gedi/clearPixmapCache_ext.ctl'.

Code: Select all

void main()
{
  int menu = moduleAddMenu(getCatStr("gedi", "tools"));

  moduleAddAction("Clear image cache", "", "", menu, 0, "clearImageCache");
}

void clearImageCache()
{
  // Which pixmaps are cached is unknown, so simply try to remove all
  for (int i = 1; i < SEARCH_PATH_LEN; i++)
  {
    string directory = getPath(PICTURES_REL_PATH, "", getActiveLang(), i);

    // Pixmaps from the WinCC OA installation are not updated during runtime, so they can be skipped
    // The installation itself is already excluded with the for loop, but it also contains some subprojects
    if (!directory.startsWith(WINCCOA_PATH))
    {
      dyn_string files = getYoungerFiles(directory, 0);

      for (int x = 1; x <= dynlen(files); x++)
      {
        deleteImageFromCache(files[x]);
      }
    }
  }
}

dbindernagel
Posts: 151
Joined: Mon Feb 23, 2015 1:34 pm

Re: Reload Pictures in Gedi

Post by dbindernagel »

Thanks gschijndel,

that works perfectly!

Post Reply
3 posts • Page 1 of 1