SystemyDialogowe/UserAct.py

16 lines
635 B
Python
Raw Normal View History

2021-04-25 23:17:14 +02:00
from UserActType import UserActType
2021-04-26 15:13:52 +02:00
from ActFrame import ActFrame
2021-04-25 23:17:14 +02:00
2021-04-26 15:13:52 +02:00
class UserAct(ActFrame):
2021-04-25 23:17:14 +02:00
def __init__(self, actType, actParams = None):
2021-04-26 15:13:52 +02:00
if actType != None and type(actType) is not UserActType:
raise Exception('actParams has wrong type: expected type {}, got {}'.format(type(UserActType.WELCOME_MSG), type(actType)))
2021-04-25 23:17:14 +02:00
2021-05-16 23:11:55 +02:00
super(UserAct, self).__init__(actType, actParams)
def __str__(self):
params = []
for param in self.getActParams():
params.append('{}=\'{}\''.format(param[0], param[1]))
return '{}({})'.format(self.getActType().name.lower(), ','.join(params))