Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added components to ProcedureStep and Procedure #132

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions topside/procedures/procedure.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class ExportFormat(enum.Enum):
# TODO(jacob): Investigate whether this would be better as a variant
# rather than a base class.
class Action:
pass
def get_action_type(self):
pass


@dataclass
Expand All @@ -35,6 +36,9 @@ class StateChangeAction(Action):
component: str
state: str

def get_action_type(self):
return self.component

def export(self, fmt):
if fmt == top.ExportFormat.Latex:
if self.state == 'open':
Expand All @@ -59,6 +63,9 @@ class MiscAction(Action):
"""
action_type: str

def get_action_type(self):
return self.action_type

def export(self, fmt):
if fmt == top.ExportFormat.Latex:
return self.action_type
Expand Down Expand Up @@ -164,8 +171,11 @@ def __init__(self, procedure_id, steps):
f'duplicate step ID {step.step_id} encountered in Procedure initialization')
self.steps[step.step_id] = step
self.step_id_to_idx[step.step_id] = i
if step.action:
if type(step.action) is tuple:
self.components.add(step.action[0])
jlsajfj marked this conversation as resolved.
Show resolved Hide resolved
elif step.action:
print (step.action)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug print?

self.components.add(step.action.get_action_type())

def index_of(self, step_id):
"""
Expand Down