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

Feature request: SAVE STATE with current layout and images (not exporting) #121

Open
staaash opened this issue Dec 10, 2024 · 1 comment

Comments

@staaash
Copy link

staaash commented Dec 10, 2024

I'm tinkering with the layout of a complex collage and would like to take a break and return to it later:

Currently, there seems no option of closing the program and later re-opening the same session.

@staaash
Copy link
Author

staaash commented Dec 11, 2024

https://copilot.microsoft.com/chats/

Adding a "save the state" feature to PhotoCollage would be a great enhancement! While I haven't analyzed the code directly, I can suggest a general approach to implement this functionality:

Save State to a File: When the user wants to save the current state, serialize the current state of the collage (including positions, sizes, and any other relevant properties of the photos and objects) and save it to a file. You can use a format like JSON or XML for this.

Load State from a File: When the user wants to load a previously saved state, read the file and deserialize the data to restore the collage to its previous state.

User Interface: Add buttons or menu options for "Save State" and "Load State" in the user interface.

Here's a rough outline of how you might implement this in Python (assuming PhotoCollage is written in Python):

import json

def save_state(collage, filename):
    state = {
        'photos': collage.get_photos(),
        'objects': collage.get_objects(),
        # Add any other relevant properties
    }
    with open(filename, 'w') as file:
        json.dump(state, file)

def load_state(collage, filename):
    with open(filename, 'r') as file:
        state = json.load(file)
    collage.set_photos(state['photos'])
    collage.set_objects(state['objects'])
    # Restore any other relevant properties

# Example usage
collage = PhotoCollage()
save_state(collage, 'collage_state.json')
# Later...
load_state(collage, 'collage_state.json')

This is a simplified example, and the actual implementation would depend on the specific structure and classes used in PhotoCollage. If you need more detailed guidance or help with specific parts of the code, feel free to share more details about the PhotoCollage codebase, and I can assist further!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant