-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up video handler and remove debug keyboard shortcut
- Loading branch information
Showing
6 changed files
with
35 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
from functools import wraps | ||
import os | ||
|
||
from ..components.serialize import Serializer | ||
from ..registry import Registry | ||
|
||
def persist_state(f): | ||
@wraps(f) | ||
def wrapped(*args, **kwargs): | ||
r = f(*args, **kwargs) | ||
|
||
json = Serializer.store_to_json(args[0]) | ||
with open('range-tagger.seg', 'w') as file: | ||
file.write(json) | ||
|
||
try: | ||
with open(Registry.CONFIG_FILE_LOCATION, 'w') as file: | ||
file.write(json) | ||
except FileNotFoundError: | ||
os.makedirs(os.path.dirname(Registry.CONFIG_FILE_LOCATION)) | ||
with open(Registry.CONFIG_FILE_LOCATION, 'w') as file: | ||
file.write(json) | ||
|
||
return r | ||
return wrapped |