Hi,
That is because the toggle_icon def goes grab your current bundle icons. I would try and bring the on off png’s to both bundles and start from there identifying which location is used for the png.
Or you could use the set_icon def instead and specify the on/off location .set_icon(icon_path)
def toggle_icon(new_state, on_icon_path=None, off_icon_path=None):
"""Set the state of button icon (on or off).
This method expects on.png and off.png in command bundle for on and off
icon states, unless full path of icon states are provided.
Args:
new_state (bool): state of the ui button icon.
on_icon_path (str, optional): full path of icon for on state.
default='on.png'
off_icon_path (str, optional): full path of icon for off state.
default='off.png'
"""
# find the ui button
uibuttons = get_all_buttons()
if not uibuttons:
mlogger.debug('Can not find ui button.')
return
# get icon for on state
if not on_icon_path:
on_icon_path = get_bundle_file('on.png')
if not on_icon_path:
mlogger.debug('Script does not have icon for on state.')
return
# get icon for off state
if not off_icon_path:
off_icon_path = get_bundle_file('off.png')
if not off_icon_path:
mlogger.debug('Script does not have icon for on state.')
return
icon_path = on_icon_path if new_state else off_icon_path
mlogger.debug('Setting icon state to: %s (%s)',
new_state, icon_path)
for uibutton in uibuttons:
uibutton.set_icon(icon_path)