2023-04-08 02:04:40 +00:00
|
|
|
# Python imports
|
|
|
|
|
|
|
|
# Lib imports
|
|
|
|
|
|
|
|
# Application imports
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SaveLoadControllerException(Exception):
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
class WidgetSaveLoadController:
|
|
|
|
def __init__(self):
|
|
|
|
super(WidgetSaveLoadController, self).__init__()
|
|
|
|
self.saveable_data = []
|
|
|
|
self.save_collection = {
|
2023-04-09 22:33:07 +00:00
|
|
|
"uuid": "",
|
2023-04-08 02:04:40 +00:00
|
|
|
"width": -1,
|
|
|
|
"height": -1,
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"data": None,
|
|
|
|
"widget_type": None
|
|
|
|
}
|
|
|
|
|
|
|
|
def register_saveable_data(self, data):
|
|
|
|
self.saveable_data.append(data)
|
|
|
|
|
2023-04-08 03:39:49 +00:00
|
|
|
def set_saveable_data(self, data):
|
2023-04-08 02:04:40 +00:00
|
|
|
self.save_collection = data
|
|
|
|
|
2023-04-08 03:39:49 +00:00
|
|
|
def load_saveable_data(self):
|
|
|
|
raise SaveLoadControllerException("WidgetSaveLoadController: load_saveable_data needs to be overridden...")
|
|
|
|
|
2023-04-08 02:04:40 +00:00
|
|
|
def get_saveable_data(self):
|
|
|
|
return self.save_collection
|