2018-04-02 22:41:10 +00:00
|
|
|
class Action:
|
2018-04-02 23:47:50 +00:00
|
|
|
"""Base class for remote actions"""
|
|
|
|
#this part should be removed, I think
|
|
|
|
#dunno
|
2018-04-02 22:41:10 +00:00
|
|
|
def __init__(self, datapool):
|
|
|
|
self._datapool = datapool
|
|
|
|
self.result = None
|
|
|
|
|
|
|
|
def run(self, data):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class data_get(Action):
|
|
|
|
def run(self, data):
|
|
|
|
return self._datapool.get(data["plugin"], data["count"])
|
|
|
|
|
|
|
|
class data_put(Action):
|
|
|
|
def run(self, data):
|
|
|
|
self._datapool.put(data['plugin'], data['items'])
|
|
|
|
|
|
|
|
class ActionManager:
|
|
|
|
@staticmethod
|
|
|
|
def get(name: str):
|
|
|
|
return globals()[name.replace('.', '_')]
|