Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user selected Image save folder #88

Closed
11 tasks done
toonarmycaptain opened this issue Dec 15, 2018 · 3 comments
Closed
11 tasks done

Allow user selected Image save folder #88

toonarmycaptain opened this issue Dec 15, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request size/S

Comments

@toonarmycaptain
Copy link
Owner

toonarmycaptain commented Dec 15, 2018

  • User defined chart save folder
    • subfolders automatically created for each class on class_creation
    • create/check for class_save_folder in default user save folder and create if not present
    • spawn save chart with chart_name and class_save_folder default
    • change to save loc -> save_path/ + classname/ + chartname
  • Prompt to select on first run, otherwise default to folder in same folder as app folder
  • Add settings option in main menu, with submenu setting to change default image save folder
  • Set save folder spawns a GUI directory select
  • Remove app_data/image_data folder creation and path in DataFolder and references since it will not be used.
  • copy dionysus_charts folder to new location on altered setting
  • add tests for this new functionality:
@toonarmycaptain toonarmycaptain added the enhancement New feature or request label Dec 15, 2018
@toonarmycaptain toonarmycaptain self-assigned this Dec 15, 2018
@toonarmycaptain
Copy link
Owner Author

GitMate.io thinks possibly related issues are #84 (Make chart images save in correct folder.), #67 (Make avatar images save in correct folder. ), #17 (Logic for image generation), and #33 (Take avatar images and process them).

@toonarmycaptain
Copy link
Owner Author

Remove app_data/image_data folder since it will not be used.

toonarmycaptain referenced this issue Dec 19, 2018
Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 19, 2018
Prompts user for name, location for chart image, using default chart
save location as initial dialogue location.
Saves image in user location with user supplied name, and saves a copy
in class chart_data with filename safe chart_name.

Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 19, 2018
Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 19, 2018
Safe filename form of chart_name used to save chart_data_file and to
save a copy of the chart image in classname/chart_data with it.
Also used to supply a suggested filename to chart save dialogue.

Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 19, 2018
Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 19, 2018
Rename initial_dir arg in select_folder_dialogue to start_dir for
consistency with other functions.

Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 21, 2018
Paired imports per PEP8 line length.

Initial test failed on mirrored convert_to_json data:
json_data_to_convert = '{\n    "1": "a",\n    "b": 2,\n    "3": "c",\n    "d": 4\n}'
converted_json_data = {1: 'a', 'b': 2, 3: 'c', 'd': 4}

This is because JSON does not have integer dict keys, so it converts the
integer keys to strings. When loading from JSON, json.loads does not
differentiate between dict keys of stings containing integers and
keys of integers converted to strings when converted to JSON.
Thus the test data was modified to expect strings in test of integers
as dict keys: {"1": 'a', 'b': 2, "3": 'c', 'd': 4}.

Added notes to file_functions.py functions convert_to_json,
load_from_json, in create_chart.py to write_chart_data_to_file, and in
class_functions.py to write_classlist_to_file describing this behaviour,
as it will be an issue if and when chart_data_files are reloaded, since
the keys in score-avatar_dicts are float values which are converted to
strings when converted to JSON, and this will need to be handled.

Handling will probably be as simple as
original_score_avatar_dict = {float(score): avatar_list for score, avatar_list in dejsonified_score_avatar_dict.items()}

Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 21, 2018
Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 21, 2018
Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 21, 2018
Add feature where changing default save location moves folder and
contents to new setting.

Signed-off-by: David <toonarmycaptain@hotmail.com>
toonarmycaptain referenced this issue Dec 21, 2018
Signed-off-by: David <toonarmycaptain@hotmail.com>
@toonarmycaptain
Copy link
Owner Author

toonarmycaptain commented Dec 21, 2018

Complete: Issue appeared with JSON:

Initial test failed on mirrored convert_to_json data:

json_data_to_convert = '{\n    "1": "a",\n    "b": 2,\n    "3": "c",\n    "d": 4\n}'
converted_json_data = {1: 'a', 'b': 2, 3: 'c', 'd': 4}

This is because JSON does not have integer dict keys, so it converts the
integer keys to strings. When loading from JSON, json.loads does not
differentiate between dict keys of stings containing integers and
keys of integers converted to strings when converted to JSON.
Thus the test data was modified to expect strings in test of integers
as dict keys: {"1": 'a', 'b': 2, "3": 'c', 'd': 4}.

So test runs as:

json_data_to_convert = '{\n    "1": "a",\n    "b": 2,\n    "3": "c",\n    "d": 4\n}'
converted_json_data = {"1": 'a', 'b': 2, "3": 'c', 'd': 4}

assert load_from_json(json_data_to_convert) == converted_json_data

Added notes to file_functions.py functions convert_to_json,
load_from_json, in create_chart.py to write_chart_data_to_file, and in
class_functions.py to write_classlist_to_file describing this behaviour,
as it will be an issue if and when chart_data_files are reloaded, since
the keys in score-avatar_dicts are float values which are converted to
strings when converted to JSON, and this will need to be handled.

Handling will probably be as simple as
original_score_avatar_dict = {float(score): avatar_list for score, avatar_list in dejsonified_score_avatar_dict.items()}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size/S
Projects
None yet
Development

No branches or pull requests

1 participant