Skip to content

Instantly share code, notes, and snippets.

@kantlivelong
Created February 10, 2017 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kantlivelong/adc0fd9a4f42a88a8b1af7cb9a29792b to your computer and use it in GitHub Desktop.
Save kantlivelong/adc0fd9a4f42a88a8b1af7cb9a29792b to your computer and use it in GitHub Desktop.
def get_settings_version(self):
return 9
def on_settings_migrate(self, target, current=None):
self._logger.debug("on_settings_migrate() target=%s, current=%s" % (target, current))
if current is None or current < 2:
return
# v2 changes names of settings variables to accomidate system commands.
cur_switchingMethod = self._settings.get(["switchingMethod"])
if cur_switchingMethod is not None and cur_switchingMethod == "COMMAND":
self._logger.info("Migrating Setting: switchingMethod=COMMAND -> switchingMethod=GCODE")
self._settings.set(["switchingMethod"], "GCODE")
cur_onCommand = self._settings.get(["onCommand"])
if cur_onCommand is not None:
self._logger.info("Migrating Setting: onCommand={0} -> onGCodeCommand={0}".format(cur_onCommand))
self._settings.set(["onGCodeCommand"], cur_onCommand)
self._settings.set(["onCommand"], "")
cur_offCommand = self._settings.get(["offCommand"])
if cur_offCommand is not None:
self._logger.info("Migrating Setting: offCommand={0} -> offGCodeCommand={0}".format(cur_offCommand))
self._settings.set(["offGCodeCommand"], cur_offCommand)
self._settings.set(["offCommand"], "")
cur_autoOnCommands = self._settings.get(["autoOnCommands"])
if cur_autoOnCommands is not None:
self._logger.info("Migrating Setting: autoOnCommands={0} -> autoOnTriggerGCodeCommands={0}".format(cur_autoOnCommands))
self._settings.set(["autoOnTriggerGCodeCommands"], cur_autoOnCommands)
self._settings.set(["autoOnCommands"], "")
def get_template_conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment