Skip to content

Commit

Permalink
Update migration to remove old delays
Browse files Browse the repository at this point in the history
Signed-off-by: Rune Haugaard <[email protected]>
  • Loading branch information
Noloxs committed May 27, 2024
1 parent 68dd87d commit 874f85e
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/classes/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,19 @@ def getInstance(cls):
def __init__(self):
self.loadouts = {utilities.generateUuid(): Loadout("Loadout 1", {"1": "1"})}
self.triggerKey = "ctrl"
self.triggerDelay = 100
self.triggerDelayJitter = 30
self.stratagemKeys = ["w", "a", "s", "d"]
self.stratagemKeyDelay = 30
self.stratagemKeyDelayJitter = 20
self.selectedExecutor = constants.EXECUTOR_PYNPUT
self.globalArmKey = None
self.globalArmMode = constants.ARM_MODE_TOGGLE
self.view_framework = constants.VIEW_PYQT5
self.loadFromFile()

## Consider no version to be version 1
if not hasattr(self, "version") or self.version < 2:
self.migrate_1_to_2()
## For future use:
# if self.version == 2:
# self.migrate_2_to_3()
if self.version == 2:
self.migrate_2_to_3()

print("Settings initialized")

def loadFromFile(self):
Expand Down Expand Up @@ -77,6 +74,20 @@ def migrate_1_to_2(self):
del self.strategemKeyDelayJitter
print("Settings migrated to version 2. Remember to save.")

def migrate_2_to_3(self):
self.version = 3

#TODO Migrate values to executor?

if hasattr(self, "triggerDelay"):
del self.triggerDelay
if hasattr(self, "triggerDelayJitter"):
del self.triggerDelayJitter
if hasattr(self, "stratagemKeyDelay"):
del self.stratagemKeyDelay
if hasattr(self, "stratagemKeyDelayJitter"):
del self.stratagemKeyDelayJitter
print("Settings migrated to version 3. Remember to save.")

class Loadout:
"""
Expand Down

0 comments on commit 874f85e

Please sign in to comment.