-
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.
- Loading branch information
1 parent
06b4943
commit 39a87ed
Showing
11 changed files
with
121 additions
and
137 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
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,20 +1,30 @@ | ||
"""Read an write charge settings from and to json file.""" | ||
import json | ||
# import PySimpleGUI as sg | ||
import FreeSimpleGUI as sg | ||
# default | ||
# defaultSettings = {'manual':{'cancelled': True, 'currentSet': 12, 'chargeLimit': 80, '3_phases': False, 'phaseSet': True}, | ||
# 'pv': {'currentSet': 8, 'chargeLimit': 80, '3_phases': False}} | ||
|
||
defaultSettings = {'manual': {'currentSet': 12, 'chargeLimit': 80, '3_phases': False, 'phaseSet': True}, | ||
'pv': {'max_1_Ph_current': 14, 'min_3_Ph_current': 8, 'chargeLimit': 80, 'allow_3_phases': False}} | ||
|
||
|
||
def writeSettings(file="", settingsDict=None): | ||
""" | ||
writes dictionary to json formatted file. | ||
:param file: name of setting json file | ||
:param settingsDict: name of dictionary containing actual settings | ||
:return: --- | ||
""" | ||
if settingsDict is None: | ||
settingsDict = {} | ||
with open(file, "w") as write_file: | ||
json.dump(settingsDict, write_file, indent=4) | ||
|
||
|
||
def readSettings(file=""): | ||
""" | ||
reads dictionary from json formatted file. | ||
:param file: | ||
:return: | ||
""" | ||
with open(file) as readFile: | ||
return json.load(readFile) |
Oops, something went wrong.