Hello everyone!
I’m working on a menu item that would allow me to push “default settings” fro RV to users in the studio. So far i’ve managed to set things with
commands.writeSettings("Caching", "lookAheadCacheSizeNew", 10.0
But it gets overridden as soon as you close RV. Also in setting panel it is still showing old settings value.
How do i “commit” this change?
Thank you
Hi, yes RV saves the preferences on close per default, I don’t think there is anything that can be done against this.
I think writeSettings is not meant to overwrite default preferences but rather define your own settings for custom functionality.
However I think it’s possible to still use this.
What I would recommend is following:
Do something like a “restore default preferences on RV close”.
there is an event called after-preferences-write that is called when RV is closing and the final preferences were saved.
So your menu command could do something like:
from rv import commands
def restore_default_settings_on_close(event=None):
"""Restore default settings on RV close menu command."""
my_mode_name = "default" # Replace with your mode name (needs to stay active)
preference_write_event = "after-preferences-write"
# Binding to push default settings on RV close (preference write)
commands.bind(my_mode_name, "global", preference_write_event, push_default_settings)
def push_default_settings():
"""Push default settings to user preference file."""
commands.writeSettings("Caching", "lookAheadCacheSizeNew", 10.0)
# and so on
Untested, but I think something like this could work.
Cheers, Mirco
hey Micro, thank you very much! I will try this approach