sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #35396
[Bug 1511078] Re: [1.1.0] variable = <automatic image file name> overwrites existing images --- is by intention
This feature is there to support the easy creation of image sets, so you can switch between them at runtime.
... and the overwrite is to assure, that this is reliable, even if you recapture the image.
It can be best used together with import of .sikuli, that each represent
image sets for different situations.
So the variable/variable.png always represents the same visual item
named with the variable name.
So in your code, there is no need to do things like that:
if not "10.11" in Settings.getOSVersion():
Menu = Menu.png
else:
Menu = Menu1011.png
at every place needed.
The intention is that you once at the beginning of script evaluate the
environment and setup a suitable image path and then just use the images
either by using the variable or the image name.
If you do not want to switch to image sets this way, then in your case
you have to do it this way:
Somewhere at the beginning:
Menu = Menu.png
Menu1011 = Menu1011.png
... and later
if "10.11" in Settings.getOSVersion():
Menu = Menu1011
... so I will not change this feature.
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1511078
Title:
[1.1.0] variable = <automatic image file name> overwrites existing
images --- is by intention
Status in Sikuli:
Won't Fix
Bug description:
So in SikuliX 1.1, there seems to be a neat new feature which
automatically sets the name of a new image capture to be same as
variable name if you capture the image while the cursor is after the
equals sign (ie, when the cursor is on the right side of "Menu = ",
the image I capture will automatically be named to Menu.png).
However, this potentially has the unintended consequence overwriting
any existing image in the bundle that already has the same name. I've
encountered this myself when I tried to set a switch of using
different images depending on the platform tied to the same variable
name. Say I intended to do something like:
if not "10.11" in Settings.getOSVersion():
Menu = Menu.png
else:
Menu = Menu1011.png
When I try to do the capture for the second Menu statement, it ends up
overwriting the image in the first Menu statement because of the
automatic rename.
I think what's needed here is a check to make sure the image doesn't
already exist in the bundle before setting the name for the new image,
and using naming convention like a Menu(1).png, Menu(2).png, etc, if
there are existing ones. Or alternatively, make it an explicit option
in the Screen Capturing preferences panel so someone can disable it if
it does give them problems.
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1511078/+subscriptions
References