-
Notifications
You must be signed in to change notification settings - Fork 421
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
Showing
12 changed files
with
246 additions
and
50 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
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# | ||
# Copyright (C) 2008 Zsolt Foldvari | ||
# 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 | ||
|
@@ -102,6 +102,27 @@ def __init__(self, text="", tags=None): | |
else: | ||
self._tags = [] | ||
|
||
def get_object_state(self): | ||
""" | ||
Get the current object state as a dictionary. | ||
We override this method to handle the `tags` and `string` properties. | ||
""" | ||
attr_dict = {"_class": self.__class__.__name__} | ||
attr_dict["tags"] = self._tags | ||
attr_dict["string"] = self._string | ||
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 `tags` and `string` properties. | ||
""" | ||
self._tags = attr_dict["tags"] | ||
self._string = attr_dict["string"] | ||
|
||
# special methods | ||
|
||
def __str__(self): | ||
|
Oops, something went wrong.