Skip to content

Commit

Permalink
Merge pull request #656 from ZombieHDGaming/feature/export-setting
Browse files Browse the repository at this point in the history
Add File Export Setting
  • Loading branch information
joaorb64 authored Nov 27, 2023
2 parents 58683da + e417e13 commit d37b341
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Settings/TSHSettingsWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def UiMounted(self):
False
))

generalSettings.append((
QApplication.translate(
"settings.disable_export", "Disable TSH file exporting"),
"disable_export",
"checkbox",
False
))


self.add_setting_widget(QApplication.translate(
"settings", "General"), SettingsWidget("general", generalSettings))
Expand Down
4 changes: 3 additions & 1 deletion src/StateManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import time
from loguru import logger
from .Helpers.TSHDictHelper import deep_get, deep_set, deep_unset, deep_clone
from .SettingsManager import SettingsManager


class StateManager:
Expand Down Expand Up @@ -46,7 +47,8 @@ def ExportAll(ref_diff):
file.write(orjson.dumps(StateManager.state, option=orjson.OPT_NON_STR_KEYS | orjson.OPT_INDENT_2))
StateManager.state.pop("timestamp")

StateManager.ExportText(StateManager.lastSavedState, ref_diff)
if not SettingsManager.Get("general.disable_export", False):
StateManager.ExportText(StateManager.lastSavedState, ref_diff)
StateManager.lastSavedState = deep_clone(StateManager.state)

diff = DeepDiff(StateManager.lastSavedState,
Expand Down

0 comments on commit d37b341

Please sign in to comment.