-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1787 from Nick-Hall/json-state
- Loading branch information
Showing
12 changed files
with
252 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
# Copyright (C) 2010 Michiel D. Nauta | ||
# Copyright (C) 2011 Tim G L Lyons | ||
# Copyright (C) 2013 Doug Blank <[email protected]> | ||
# Copyright (C) 2017 Nick Hall | ||
# Copyright (C) 2017,2024 Nick Hall | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -86,6 +86,26 @@ def serialize(self): | |
self.__role.serialize(), | ||
) | ||
|
||
def get_object_state(self): | ||
""" | ||
Get the current object state as a dictionary. | ||
We override this method to handle the `role` property. | ||
""" | ||
attr_dict = super().get_object_state() | ||
attr_dict["role"] = self.__role | ||
return attr_dict | ||
|
||
def set_object_state(self, attr_dict): | ||
""" | ||
Set the current object state using information provided in the given | ||
dictionary. | ||
We override this method to handle the `role` property. | ||
""" | ||
self.__role = attr_dict.pop("role") | ||
super().set_object_state(attr_dict) | ||
|
||
@classmethod | ||
def get_schema(cls): | ||
""" | ||
|
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
# Copyright (C) 2010 Michiel D. Nauta | ||
# Copyright (C) 2011 Tim G L Lyons | ||
# Copyright (C) 2013 Doug Blank <[email protected]> | ||
# Copyright (C) 2017 Nick Hall | ||
# Copyright (C) 2017,2024 Nick Hall | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -151,6 +151,18 @@ def unserialize(self, data): | |
RefBase.unserialize(self, ref) | ||
return self | ||
|
||
def set_object_state(self, attr_dict): | ||
""" | ||
Set the current object state using information provided in the given | ||
dictionary. | ||
We override this method to convert `rect` into a tuple. | ||
""" | ||
rect = attr_dict["rect"] | ||
if rect is not None: | ||
attr_dict["rect"] = tuple(rect) | ||
super().set_object_state(attr_dict) | ||
|
||
def get_text_data_child_list(self): | ||
""" | ||
Return the list of child objects that may carry textual data. | ||
|
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
Oops, something went wrong.